Quadratic Expressions#

class cake.expressions.quadratic.QuadraticExpression(a: Any, b: Any, c: Any)[source]#

Bases: PolynomialExpression

Represents a quadratic expression, can be expressed in the form ax**2 + bx + c

Parameters:
  • a (Any[Like[cake.BasicNode]]) – Values for expression

  • b (Any[Like[cake.BasicNode]]) – Values for expression

  • c (Any[Like[cake.BasicNode]]) – Values for expression

as_expression() Expression[source]#
differentiate() cake.expressions.LinearExpression[source]#

Differentiates a quadratic expression, returing a linear expression

discriminant() Any[source]#
classmethod from_expression(expr: Expression) QuadraticExpression[source]#

Converts a Expression to a cake.expressions.QuadraticExpression.

Note

Expression must be in the form Add(ax**2, bx, c, [...])

Parameters:

expr (Expression) – Expression to convert

Raises:

TypeError – Expression of incorrect form was passed

classmethod generic() QuadraticExpression[source]#

Returns generic version of expression

property has_max: bool#

Returns whether a graph has a maximum point

property has_min: bool#

Returns whether a graph has a minimum point

integrate() Expression[source]#

Integrates a quadratic expression, returning and expression

property intercept: Any#

Returns when the graph intersects the y axis

r_solve(y: Any, **kwds) Any[source]#

Solves expression for a given value of y

roots(*, evaluate: bool = True, **ev_kwds) Tuple[Any, Any][source]#

Returns roots of quadratic

solve(x: Any, **kwds) Any[source]#

Solves expression for a given value of x

turning_point() cake.geometry.Point2D[source]#

Works out the min/max point on the curve