On Thu, Mar 26, 2009 at 11:31 PM, William Stein <[email protected]> wrote:
>
> On Thu, Mar 26, 2009 at 9:58 PM, Ondrej Certik <[email protected]> wrote:
>>
>> Hi,
>>
>> today I had to solve some function for my chemical kinetics class, so
>> I tried it in sympy first and I was surprised it just worked:
>
> Do you have a nicely documented description of the algorithm sympy
> uses to implement its solve? E.g., Maxima at least claims in the
> documentation to describe what its solve does.
It's in the docstrings, e.g.:
In [3]: solve?
Type: function
Base Class: <type 'function'>
String Form: <function solve at 0x9189cdc>
Namespace: Interactive
File: /home/ondra/repos/sympy/sympy/solvers/solvers.py
Definition: solve(f, *symbols, **flags)
Docstring:
Solves equations and systems of equations.
Currently supported are univariate polynomial and transcendental
equations and systems of linear and polynomial equations. Input
is formed as a single expression or an equation, or an iterable
container in case of an equation system. The type of output may
vary and depends heavily on the input. For more details refer to
more problem specific functions.
By default all solutions are simplified to make the output more
readable. If this is not the expected behavior, eg. because of
speed issues, set simplified=False in function arguments.
To solve equations and systems of equations of other kind, eg.
recurrence relations of differential equations use rsolve() or
dsolve() functions respectively.
>>> from sympy import *
>>> x,y = symbols('xy')
Solve a polynomial equation:
>>> solve(x**4-1, x)
[1, -1, -I, I]
Solve a linear system:
>>> solve((x+5*y-2, -3*x+6*y-15), x, y)
{x: -3, y: 1}
and:
In [5]: tsolve?
Type: function
Base Class: <type 'function'>
String Form: <function tsolve at 0x9190144>
Namespace: Interactive
File: /home/ondra/repos/sympy/sympy/solvers/solvers.py
Definition: tsolve(eq, sym)
Docstring:
Solves a transcendental equation with respect to the given
symbol. Various equations containing mixed linear terms, powers,
and logarithms, can be solved.
Only a single solution is returned. This solution is generally
not unique. In some cases, a complex solution may be returned
even though a real solution exists.
>>> from sympy import *
>>> x = Symbol('x')
>>> tsolve(3**(2*x+5)-4, x)
[(-5*log(3) + log(4))/(2*log(3))]
>>> tsolve(log(x) + 2*x, x)
[LambertW(2)/2]
Ondrej
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---