Package sage :: Package calculus :: Module equations :: Class SymbolicEquation
[hide private]
[frames] | no frames]

Class SymbolicEquation

source code

                      object --+    
                               |    
structure.sage_object.SageObject --+
                                   |
                                  SymbolicEquation


A symbolic equation, which consists of a left hand side, an operator
and a right hand side.

EXAMPLES:



Instance Methods [hide private]
 
__init__(self, left, right, op)
Create a symbolic expression.
source code
 
__call__(self, *args, **argv)
Substitute both sides of this equation This is very slow currently since we piggy-back off of the symbolic matrix functionality.
source code
 
__getitem__(self, i)
Return the ith part of this equation:...
source code
 
_scalar(self, scalar, op, checksign=True)
INPUT: scalar -- number op -- operation to perform checksign -- (default: True) boolean; if True and op is multiply or divides, switch direction of inequality of x is negative; otherwise direction will not switch.
source code
 
multiply_both_sides(self, x)
Multiply both sides of this inequality by $x$.
source code
 
divide_both_sides(self, x, checksign=True)
Divide both sides of the inequality by $x$.
source code
 
add_to_both_sides(self, x)
Add $x$ to both sides of this symbolic equation.
source code
 
subtract_from_both_sides(self, x)
Subtract $x$ from both sides of this symbolic equation.
source code
 
_arith(self, right, op)
This function is called internally to implement arithmetic operations on symbolic expressions.
source code
 
__add__(self, right)
Add two symbolic equations.
source code
 
__radd__(self, left)
Add two symbolic equations.
source code
 
__sub__(self, right)
Subtract two symbolic equations.
source code
 
__rsub__(self, left)
Subtract two symbolic equations.
source code
 
__mul__(self, right)
Multiply two symbolic equations.
source code
 
__rmul__(self, left)
Multiply two symbolic equations.
source code
 
__div__(self, right)
Divide two symbolic equations.
source code
 
_maxima_(self, session=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...)
Return version of this symbolic expression but in the given Maxima session.
source code
 
substitute(self, *args, **kwds)
Do the given symbolic substitution to both sides of the equation.
source code
 
subs(self, *args, **kwds)
Do the given symbolic substitution to both sides of the equation.
source code
 
__cmp__(self, right)
EXAMPLES:...
source code
 
_repr_(self)
Return non-ASCII art string representation of this symbolic equation.
source code
 
variables(self)
Return the variables appearing in this symbolic equation.
source code
 
operator(self)
Return the operator in this equation.
source code
 
left(self)
Return the left hand side of this equation.
source code
 
lhs(self)
Return the left hand side of this equation.
source code
 
left_hand_side(self)
Return the left hand side of this equation.
source code
 
right(self)
Return the right hand side of this equation.
source code
 
rhs(self)
Return the right hand side of this equation.
source code
 
right_hand_side(self)
Return the right hand side of this equation.
source code
 
__str__(self)
Return the string representation of this equation, in 2-d ASCII art.
source code
 
_latex_(self)
Return latex representation of this symbolic equation.
source code
 
__nonzero__(self)
Return True if this (in)equality is definitely true.
source code
 
_maxima_init_(self, maxima=Maxima, assume=False)
Return string representation for this symbolic equation in a form suitable for evaluation in Maxima.
source code
 
assume(self)
Assume that this equation holds.
source code
 
find_root(self, *args, **kwds)
If this is a symbolic equality with an equals sign \code{==} find numerically a single root of this equation in a given interval.
source code
 
forget(self)
Forget the given constraint.
source code
 
solve(self, x=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., multiplicities=False, solution_dict=False, explicit_solutions=False)
Symbolically solve for the given variable.
source code
 
expand(self, side=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...)
Expands one or both sides of the equation.
source code

Inherited from structure.sage_object.SageObject: __hash__, __new__, __repr__, _axiom_, _axiom_init_, _gap_, _gap_init_, _gp_, _gp_init_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _kash_init_, _macaulay2_, _macaulay2_init_, _magma_, _magma_init_, _maple_, _maple_init_, _mathematica_, _mathematica_init_, _octave_, _octave_init_, _pari_, _pari_init_, _r_init_, _sage_, _singular_, _singular_init_, category, db, dump, dumps, plot, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, left, right, op)
(Constructor)

source code 

Create a symbolic expression.

Internally a symbolic expression is simply a left side
(\code{self._left}), operator (\code{self._op}), and a right
hand side (\code{self._right}), where the left and right hand
sides are symbolic expressions and the operator is a Python
equation or inequality operator, e.g., \code{operator.le}.

EXAMPLES:

One should not call the SymbolicEquation constructor directly,
since it does no type checking.  However, we illustrate how to
do so below.

Bad illustrative usage:
    sage: eqn = sage.calculus.equations.SymbolicEquation(-x, x^2 + 1, operator.gt); eqn
    -x > x^2 + 1

Really bad usage!
    sage: eqn.__init__(x, 2*x+pi, operator.lt)
    sage: eqn                 # cripes!
    x < 2*x + pi

Overrides: object.__init__

__call__(self, *args, **argv)
(Call operator)

source code 

Substitute both sides of this equation

This is very slow currently since we piggy-back off of the
symbolic matrix functionality.

EXAMPLES:
   sage: var('theta')
   theta
   sage: eqn =   (x^3 + theta < sin(x*theta))
   sage: eqn(x = 5)
   theta + 125 < sin(5*theta)
   sage: eqn(theta=x, x=0)
   x < 0
   sage: var('y')
   y
   sage: eqn = x^3 < sin(y)
   sage: eqn(2)
   8 < sin(y)
   sage: eqn(2,3)
   8 < sin(3)
   sage: eqn = x^3 < 2
   sage: eqn(2)
   8 < 2

__getitem__(self, i)
(Indexing operator)

source code 

Return the ith part of this equation:

OUTPUT:
    self[0] -- left hand side
    self[1] -- operator
    self[2] -- right hand side

EXAMPLES:
    sage: eqn = x^2 + sin(x) < cos(x^2)
    sage: eqn[0]
    sin(x) + x^2
    sage: eqn[1]
    <built-in function lt>
    sage: eqn[2]
    cos(x^2)
    sage: eqn[-1]
    cos(x^2)

_scalar(self, scalar, op, checksign=True)

source code 

INPUT:
    scalar -- number
    op -- operation to perform
    checksign -- (default: True) boolean; if True and op is
                 multiply or divides, switch direction of
                 inequality of x is negative; otherwise
                 direction will not switch.

EXAMPLES:
    sage: var('x y')
    (x, y)
    sage: f = x + 3 < y - 2
    sage: f*-1
    -x - 3 > 2 - y
    sage: f._scalar(-1, operator.mul, checksign=True)
    -x - 3 > 2 - y
    sage: f._scalar(-1, operator.mul, checksign=False)
    -x - 3 < 2 - y
    sage: f * 5
    5*(x + 3) < 5*(y - 2)
    sage: f - 3
    x < y - 5
    sage: f + 2
    x + 5 < y

multiply_both_sides(self, x)

source code 

Multiply both sides of this inequality by $x$.

EXAMPLES:
    sage: var('x,y'); f = x + 3 < y - 2
    (x, y)
    sage: f.multiply_both_sides(7)
    7*(x + 3) < 7*(y - 2)
    sage: f.multiply_both_sides(-1/2)
    (-x - 3)/2 > (2 - y)/2        
    sage: f*(-2/3)
    -2*(x + 3)/3 > -2*(y - 2)/3
    sage: f*(-pi)
    -1*pi*(x + 3) > -1*pi*(y - 2)
    sage: f*(1+I)
    Traceback (most recent call last):
    ...
    ValueError: unable to multiply or divide both sides of an inequality by a number whose sign can't be determined.

Multiplying by complex numbers works only if it's an equality:
    sage: f = sqrt(2) + x == y^3
    sage: f.multiply_both_sides(I)
    I*(x + sqrt(2)) == I*y^3
    sage: f.multiply_both_sides(-1)
    -x - sqrt(2) == -y^3

Some further examples:
    sage: (x^3 + 1 > 2*sqrt(3)) * (-1)
    -x^3 - 1 < -2*sqrt(3)
    sage: (x^3 + 1 >= 2*sqrt(3)) * (-1)
    -x^3 - 1 <= -2*sqrt(3)
    sage: (x^3 + 1 <= 2*sqrt(3)) * (-1)
    -x^3 - 1 >= -2*sqrt(3)        

divide_both_sides(self, x, checksign=True)

source code 

Divide both sides of the inequality by $x$.

INPUT:
    x -- number
    checksign -- (default: True) boolean; if True, switch direction of
                 inequality of x is negative; otherwise direction
                 will not switch.

EXAMPLES:
    sage: var('theta')
    theta
    sage: eqn =   (x^3 + theta < sin(x*theta))
    sage: eqn.divide_both_sides(theta, checksign=False)
    (x^3 + theta)/theta < sin(theta*x)/theta
    sage: assume(theta > 0)
    sage: eqn.divide_both_sides(theta)
    (x^3 + theta)/theta < sin(theta*x)/theta
    sage: eqn/theta
    (x^3 + theta)/theta < sin(theta*x)/theta
    sage: forget(theta > 0)
    sage: eqn.divide_both_sides(theta)
    Traceback (most recent call last):
    ...
    ValueError: unable to multiply or divide both sides of an inequality by a number whose sign can't be determined.

As a shorthand you can just use the divides notation:
    sage: (x^3 + 1 > x^2 - 1) / (-1)
    -x^3 - 1 < 1 - x^2

The quantity $x^2 - 1$ could be either negative or positive depending on $x$, so
dividing by it is not defined.
    sage: (x^3 + 1 > x^2 - 1) / (x^2 - 1)
    Traceback (most recent call last):
    ...
    ValueError: unable to multiply or divide both sides of an inequality by a number whose sign can't be determined.

If we specify that $x^2 - 1> 0$, then dividing is defined. 
    sage: assume(x^2 - 1 > 0)
    sage: (x^3 + 1 > x^2 - 1) / (x^2 - 1)
    (x^3 + 1)/(x^2 - 1) > 1
    sage: forget()

We can also specify that $x^2 - 1 < 0$.  Note that now the inequality direction changes. 
    sage: assume(x^2 - 1 < 0)
    sage: (x^3 + 1 > x^2 - 1) / (x^2 - 1)
    (x^3 + 1)/(x^2 - 1) < 1
    sage: forget()            

add_to_both_sides(self, x)

source code 

Add $x$ to both sides of this symbolic equation.

EXAMPLES:
    sage: var('x y z')
    (x, y, z)
    sage: eqn = x^2 + y^2 + z^2 <= 1
    sage: eqn.add_to_both_sides(-z^2)
    y^2 + x^2 <= 1 - z^2
    sage: eqn.add_to_both_sides(I)
    z^2 + y^2 + x^2 + I <= I + 1            

subtract_from_both_sides(self, x)

source code 

Subtract $x$ from both sides of this symbolic equation.

EXAMPLES:
    sage: eqn = x*sin(x)*sqrt(3) + sqrt(2) > cos(sin(x))
    sage: eqn.subtract_from_both_sides(sqrt(2))
    sqrt(3)*x*sin(x) > cos(sin(x)) - sqrt(2)
    sage: eqn.subtract_from_both_sides(cos(sin(x)))
    -cos(sin(x)) + sqrt(3)*x*sin(x) + sqrt(2) > 0        

_arith(self, right, op)

source code 

This function is called internally to implement arithmetic
operations on symbolic expressions.

INPUT:
    self -- a symbolic equation
    right -- a symbolic equation
    op -- an operation, e.g., operator.add

EXAMPLES:
We create two symbolic equations and add them:
    sage: e1 = x^3 + x < sin(2*x)
    sage: e2 = x^2 - x < cos(x)
    sage: e1._arith(e2, operator.add)
    x^3 + x^2 < sin(2*x) + cos(x)

We try to multiply them, which doesn't really make sense:
    sage: e1._arith(e2, operator.mul)
    Traceback (most recent call last):
    ...
    ValueError: cannot multiply or divide inequalities.

We can multiply equalities though:
    sage: e1 = x^3 + x == sin(2*x)
    sage: e2 = x^2 - x == cos(x)
    sage: f = e1._arith(e2, operator.mul); f
    (x^2 - x)*(x^3 + x) == cos(x)*sin(2*x)

By the way, we can expand the above product by calling the
\code{expand} method:
    sage: f.expand()
    x^5 - x^4 + x^3 - x^2 == cos(x)*sin(2*x)

__add__(self, right)
(Addition operator)

source code 

Add two symbolic equations.

EXAMPLES:
    sage: var('a,b')
    (a, b)
    sage: m = 144 == -10 * a + b
    sage: n = 136 == 10 * a + b
    sage: m + n
    280 == 2*b        

__radd__(self, left)
(Right-side addition operator)

source code 

Add two symbolic equations.

EXAMPLES:
    sage: var('a,b')
    (a, b)            
    sage: m = 144 == -10 * a + b
    sage: n = 136 == 10 * a + b
    sage: int(-144) + m
    0 == b - 10*a - 144        

__sub__(self, right)
(Subtraction operator)

source code 

Subtract two symbolic equations.

EXAMPLES:
    sage: var('a,b')
    (a, b)            
    sage: m = 144 == 20 * a + b
    sage: n = 136 == 10 * a + b
    sage: m - n
    8 == 10*a        

__rsub__(self, left)

source code 

Subtract two symbolic equations.

EXAMPLES:
    sage: var('a,b')
    (a, b)
    sage: m = 144 == -10 * a + b
    sage: n = 136 == 10 * a + b
    sage: int(144) - m
    0 == b - 10*a - 144        

__mul__(self, right)

source code 

Multiply two symbolic equations.

EXAMPLES:
    sage: m = x == 5*x + 1
    sage: n = sin(x) == sin(x+2*pi)
    sage: m * n
    x*sin(x) == (5*x + 1)*sin(x)        

__rmul__(self, left)

source code 

Multiply two symbolic equations.
    sage: m = 2*x == 3*x^2 - 5
    sage: int(-1) * m
    -2*x == 5 - 3*x^2        

__div__(self, right)

source code 

Divide two symbolic equations.

EXAMPLES:
    sage: m = x == 5*x + 1
    sage: n = sin(x) == sin(x+2*pi)
    sage: m / n
    x/sin(x) == (5*x + 1)/sin(x)
    sage: m = x != 5*x + 1
    sage: n = sin(x) != sin(x+2*pi)
    sage: m / n
    x/sin(x) != (5*x + 1)/sin(x)        

_maxima_(self, session=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...)

source code 

Return version of this symbolic expression but in the given
Maxima session.

EXAMPLES:
    sage: e1 = x^3 + x == sin(2*x)
    sage: z = e1._maxima_()
    sage: z.parent() is sage.calculus.calculus.maxima
    True
    sage: z = e1._maxima_(maxima)
    sage: z.parent() is maxima
    True
    sage: z = maxima(e1)
    sage: z.parent() is maxima
    True

Overrides: structure.sage_object.SageObject._maxima_

substitute(self, *args, **kwds)

source code 

Do the given symbolic substitution to both sides of the equation.  The
notation is the same for substitute on a symbolic expression.

EXAMPLES:
    sage: var('a')
    a
    sage: e = (x^3 + a == sin(x/a)); e
    x^3 + a == sin(x/a)
    sage: e.substitute(x=5*x)
    125*x^3 + a == sin(5*x/a)
    sage: e.substitute(a=1)
    x^3 + 1 == sin(x)
    sage: e.substitute(a=x)
    x^3 + x == sin(1)
    sage: e.substitute(a=x, x=1)
    x + 1 == sin(1/x)
    sage: e.substitute({a:x, x:1})
    x + 1 == sin(1/x)

subs(self, *args, **kwds)

source code 

Do the given symbolic substitution to both sides of the equation.  The
notation is the same for substitute on a symbolic expression.

EXAMPLES:
    sage: var('a')
    a
    sage: e = (x^3 + a == sin(x/a)); e
    x^3 + a == sin(x/a)
    sage: e.substitute(x=5*x)
    125*x^3 + a == sin(5*x/a)
    sage: e.substitute(a=1)
    x^3 + 1 == sin(x)
    sage: e.substitute(a=x)
    x^3 + x == sin(1)
    sage: e.substitute(a=x, x=1)
    x + 1 == sin(1/x)
    sage: e.substitute({a:x, x:1})
    x + 1 == sin(1/x)

__cmp__(self, right)
(Comparison operator)

source code 

EXAMPLES:
    sage: (x>0) == (x>0)
    True
    sage: (x>0) == (x>1)
    False
    sage: (x>0) != (x>1)
    True

_repr_(self)

source code 

Return non-ASCII art string representation of this
symbolic equation.  This is called implicitly when
displaying an equation (without using print).

EXAMPLES:
We create an inequality $f$ and called the \code{_repr_}
method on it, and note that this produces the same
string as just displaying $f$:
    sage: f = x^3 + 1/3*x - sqrt(2) <= sin(x)
    sage: f._repr_()
    'x^3 + x/3 - sqrt(2) <= sin(x)'
    sage: f
    x^3 + x/3 - sqrt(2) <= sin(x)

When using print the \code{__str__} method is called instead,
which results in ASCII art:
    sage: print f
                       3   x
                      x  + - - sqrt(2) <= sin(x)
                           3

variables(self)

source code 

Return the variables appearing in this symbolic equation.

OUTPUT:
    tuple -- tuple of the variables in this equation (the
             result of calling this is cached).

EXAMPLES:
    sage: var('x,y,z,w')
    (x, y, z, w)
    sage: f =  (x+y+w) == (x^2 - y^2 - z^3);   f
    y + x + w == -z^3 - y^2 + x^2
    sage: f.variables()
    (w, x, y, z)

operator(self)

source code 

Return the operator in this equation.

EXAMPLES:
    sage: eqn = x^3 + 2/3 >= x - pi
    sage: eqn.operator()
    <built-in function ge>
    sage: (x^3 + 2/3 < x - pi).operator()
    <built-in function lt>
    sage: (x^3 + 2/3 == x - pi).operator()
    <built-in function eq>

left(self)

source code 

Return the left hand side of this equation.

EXAMPLES:
    sage: eqn = x^3 + 2/3 >= x - pi
    sage: eqn.lhs()
    x^3 + 2/3
    sage: eqn.left()
    x^3 + 2/3
    sage: eqn.left_hand_side()
    x^3 + 2/3

SYNONYMS: \code{lhs}, \code{left_hand_side}

lhs(self)

source code 

Return the left hand side of this equation.

EXAMPLES:
    sage: eqn = x^3 + 2/3 >= x - pi
    sage: eqn.lhs()
    x^3 + 2/3
    sage: eqn.left()
    x^3 + 2/3
    sage: eqn.left_hand_side()
    x^3 + 2/3

SYNONYMS: \code{lhs}, \code{left_hand_side}

left_hand_side(self)

source code 

Return the left hand side of this equation.

EXAMPLES:
    sage: eqn = x^3 + 2/3 >= x - pi
    sage: eqn.lhs()
    x^3 + 2/3
    sage: eqn.left()
    x^3 + 2/3
    sage: eqn.left_hand_side()
    x^3 + 2/3

SYNONYMS: \code{lhs}, \code{left_hand_side}

right(self)

source code 

Return the right hand side of this equation.

EXAMPLES:
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).right()
    sqrt(3) + 5/2
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).rhs()
    sqrt(3) + 5/2
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).right_hand_side()
    sqrt(3) + 5/2

SYNONYMS: \code{rhs}, \code{right_hand_side}

rhs(self)

source code 

Return the right hand side of this equation.

EXAMPLES:
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).right()
    sqrt(3) + 5/2
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).rhs()
    sqrt(3) + 5/2
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).right_hand_side()
    sqrt(3) + 5/2

SYNONYMS: \code{rhs}, \code{right_hand_side}

right_hand_side(self)

source code 

Return the right hand side of this equation.

EXAMPLES:
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).right()
    sqrt(3) + 5/2
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).rhs()
    sqrt(3) + 5/2
    sage: (x + sqrt(2) >= sqrt(3) + 5/2).right_hand_side()
    sqrt(3) + 5/2

SYNONYMS: \code{rhs}, \code{right_hand_side}

__str__(self)
(Informal representation operator)

source code 

Return the string representation of this equation, in 2-d ASCII art.

OUTPUT:
    string

EXAMPLES:
    sage: f =  (x^2 - x == 0)
    sage: f
    x^2 - x == 0
    sage: print f
                                       2
                                      x  - x == 0

Here we call \code{__str__} explicitly:
    sage: (x > 2/3).__str__()
    '                                         2\r\n                                     x > -\r\n                                         3'

Overrides: object.__str__

_latex_(self)

source code 

Return latex representation of this symbolic equation.

This is obtained by calling the \code{_latex_} method
on both the left and right hand sides, and typesetting
the operator symbol correctly.

OUTPUT:
    string -- a string

EXAMPLES:
The output is a strig with backslashes, so prints funny:
    sage: (x^(3/5) >= pi)._latex_()
    '{x}^{\\frac{3}{5}}   \\geq  \\pi'

Call the latex method to get an object that prints more nicely:
    sage: latex(x^(3/5) >= pi)
    {x}^{\frac{3}{5}}   \geq  \pi

__nonzero__(self)
(Boolean test operator)

source code 

Return True if this (in)equality is definitely true.  Return False
if it is false or the algorithm for testing (in)equality is
inconclusive.

EXAMPLES:
    sage: k = var('k')
    sage: pol = 1/(k-1) - 1/k -1/k/(k-1);
    sage: bool(pol == 0)
    True
    sage: f = sin(x)^2 + cos(x)^2 - 1
    sage: bool(f == 0)
    True
    sage: bool( x == x )
    True
    sage: bool( x != x )
    False
    sage: bool( x > x )
    False
    sage: bool( x^2 > x )
    False
    sage: bool( x + 2 > x )
    True
    sage: bool( x - 2 > x )
    False

_maxima_init_(self, maxima=Maxima, assume=False)

source code 

Return string representation for this symbolic equation
in a form suitable for evaluation in Maxima.

EXAMPLES:
    sage: (x^(3/5) >= pi^2 + e^i)._maxima_init_()
    '((x) ^ (3/5)) >= (((%pi) ^ (2)) + ((%e) ^ (%i)))'
    sage: (x == 0)._maxima_init_(assume=True)
    'equal(x, 0)'
    sage: (x != 0)._maxima_init_(assume=True)
    'notequal(x, 0)'

Overrides: structure.sage_object.SageObject._maxima_init_

assume(self)

source code 

Assume that this equation holds.  This is relevant for
symbolic integration, among other things.

EXAMPLES:
We call the assume method to assume that $x>2$:
    sage: (x > 2).assume()

Bool returns True below if the inequality is \emph{definitely}
known to be True. 
    sage: bool(x > 0)
    True
    sage: bool(x < 0)
    False

This may or may not be True, so bool returns False:
    sage: bool(x > 3)
    False

TESTS:
    sage: v,c = var('v,c')
    sage: assume(c != 0)
    sage: integral((1+v^2/c^2)^3/(1-v^2/c^2)^(3/2),v)
    -75*sqrt(c^2)*arcsin(sqrt(c^2)*v/c^2)/8 - v^5/(4*c^4*sqrt(1 - v^2/c^2)) - 17*v^3/(8*c^2*sqrt(1 - v^2/c^2)) + 83*v/(8*sqrt(1 - v^2/c^2))
    

find_root(self, *args, **kwds)

source code 

If this is a symbolic equality with an equals sign \code{==}
find numerically a single root of this equation in a given
interval.  Otherwise raise a \code{ValueError}.  See the
documentation for the global \code{find_root} method for more
about the options to this function.

Note that this symbolic expression must involve at most one
variable.

EXAMPLES:
    sage: (x == sin(x)).find_root(-2,2)
    0.0
    sage: (x^5 + 3*x + 2 == 0).find_root(-2,2)
    -0.63283452024215225
    sage: (cos(x) == sin(x)).find_root(10,20)
    19.634954084936208

We illustrate some valid error conditions:
    sage: (cos(x) != sin(x)).find_root(10,20)
    Traceback (most recent call last):
    ...
    ValueError: Symbolic equation must be an equality.
    sage: (SR(3)==SR(2)).find_root(-1,1)
    Traceback (most recent call last):
    ...
    RuntimeError: no zero in the interval, since constant expression is not 0.

There must be at most one variable:
    sage: x, y = var('x,y')
    sage: (x == y).find_root(-2,2)
    Traceback (most recent call last):
    ...
    NotImplementedError: root finding currently only implemented in 1 dimension.

forget(self)

source code 

Forget the given constraint.

EXAMPLES:
    sage: var('x,y')
    (x, y)
    sage: forget()
    sage: assume(x>0, y < 2)
    sage: assumptions()
    [x > 0, y < 2]
    sage: forget(y < 2)
    sage: assumptions()
    [x > 0]

solve(self, x=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., multiplicities=False, solution_dict=False, explicit_solutions=False)

source code 

Symbolically solve for the given variable.

WARNING: In many cases, only one solution is computed. 

INPUT:
    x -- a SymbolicVariable object (if not given, the first in
         the expression is used)

    multiplicities -- (default: False) if True, also returns
                  the multiplicities of each solution, in order.

    solution_dict -- (default: False) if True, return the
                solution as a dictionary rather than an equation.
    
    explicit_solution -- (default: False); if True, require
        that all solutions returned be explicit (rather than
        implicit) OUTPUT: A list of SymbolicEquations with the
        variable to solve for on the left hand side.

EXAMPLES:
    sage: S = solve(x^3 - 1 == 0, x)
    sage: S
    [x == (sqrt(3)*I - 1)/2, x == (-sqrt(3)*I - 1)/2, x == 1]
    sage: S[0]
    x == (sqrt(3)*I - 1)/2
    sage: S[0].right()
    (sqrt(3)*I - 1)/2
    sage: S = solve(x^3 - 1 == 0, x, solution_dict=True)
    sage: S
    [{x: (sqrt(3)*I - 1)/2}, {x: (-sqrt(3)*I - 1)/2}, {x: 1}]

We illustrate finding multiplicities of solutions:
    sage: f = (x-1)^5*(x^2+1)
    sage: solve(f == 0, x)
    [x == -1*I, x == I, x == 1]
    sage: solve(f == 0, x, multiplicities=True)
    ([x == -1*I, x == I, x == 1], [1, 1, 5])

expand(self, side=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...)

source code 

Expands one or both sides of the equation.

If side is not specified, then both sides of the equation
are expanded by calling \code{expand()} on the corresponding
\class{SymbolicExpression}.

If side is `left' (or `right'), then only the left (or right)
side of the equation is expanded.

EXAMPLES:
    sage: a = (16*x-13)/6 == (3*x+5)/2 - (4-x)/3
    sage: a.expand()
    8*x/3 - 13/6 == 11*x/6 + 7/6
    sage: a.expand('left')
    8*x/3 - 13/6 == (3*x + 5)/2 - (4 - x)/3
    sage: a.expand('right')
    (16*x - 13)/6 == 11*x/6 + 7/6