On Mon, Feb 2, 2009 at 3:49 PM, limist <[email protected]> wrote:
>
> Hi all - I suspect this is a dumb noob question but after browsing the
> tutorial and other docs, I can't get this to work,
>
> from sympy import symbols, solve
>
> x = symbols('x')
> f_x = (((2/x + x_max) * (1-exp(x*x_max)) + 2*x_max*exp(x*x_max)) / (exp
> (x*x_max) - 1 - x*x_max)) - x_mean
> solutions = solve(f_x, x)
>
> ...I get the error, ValueError: Symbolic value, can't compute for the
> f_x line.  x_max, x_mean are supplied parameters (constants, in f_x).
>
> Any help appreciated!

This is what I am getting with the latest sympy:

In [1]: var("x_max x_mean")
Out[1]: (x_max, x_mean)

In [2]: f_x = (((2/x + x_max) * (1-exp(x*x_max)) + 2*x_max*exp(x*x_max)) / (exp
   ...: (x*x_max) - 1 - x*x_max)) - x_mean

In [3]: f_x
Out[3]:
          ⎛     x⋅x_max⎞ ⎛        2⎞            x⋅x_max
          ⎝1 - ℯ       ⎠⋅⎜x_max + ─⎟ + 2⋅x_max⋅ℯ
                         ⎝        x⎠
-x_mean - ─────────────────────────────────────────────
                                     x⋅x_max
                      1 + x⋅x_max - ℯ

In [4]: solve(f_x, x)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/ondra/repos/sympy/<ipython console> in <module>()

/home/ondra/repos/sympy/sympy/solvers/solvers.pyc in solve(f, *symbols, **flags)
    240             # assumptions, it should be checked, that for the solution,
    241             # b!=0.
--> 242             result = tsolve(f, *symbols)
    243         elif strategy == -1:
    244             raise Exception('Could not parse expression %s' % f)

/home/ondra/repos/sympy/sympy/solvers/solvers.pyc in tsolve(eq, sym)
    774
    775
--> 776     raise ValueError("unable to solve the equation")
    777
    778

ValueError: unable to solve the equation



Which means that a solver for such an equation is not yet implemented.
However, looking at the equation, it contains x in terms like:

x + exp(x),

so it is not solvable in terms of elementary functions, is it? What is
it's solution? If you know an algorithm to solve it, we can then
enhance the solver. If you'd like to give it a shot, we are at help to
get this implemented.

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to