Comment #5 on issue 1275 by ondrej.certik: tsolve errors on exponentials
http://code.google.com/p/sympy/issues/detail?id=1275

Thanks, thats another bug, I made it the issue 1276.

The patch now applies. I created a git patch of it, attached. So before the  
patch:

In [1]: tsolve(1.0 + 2.0*x + 3.0*sqrt(1-x**2),x)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)

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

/home/ondra/repos/sympy/sympy/solvers/solvers.py in tsolve(eq, sym)
     758                 break
     759         else:
--> 760             assert False, 'tsolve: at least one Function expected  
at this point'
     761
     762         # perform the substitution

AssertionError: tsolve: at least one Function expected at this point


And after the patch:

In [1]: tsolve(1.0 + 2.0*x + 3.0*sqrt(1-x**2),x)
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)

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

/home/ondra/repos/sympy/sympy/solvers/solvers.py in tsolve(eq, sym)
     792             if cv_inv.is_Pow:
     793                 for sol in cv_sols:
--> 794                     sols = sols +
solve(pow(sym,1/cv_inv.exp)-cv_inv.base.subs(t, sol),sym)
     795             else:
     796                 for sol in cv_sols:

/home/ondra/repos/sympy/sympy/solvers/solvers.py in solve(f, *symbols,  
**flags)
     173             poly = f.as_poly( symbol )
     174             assert poly is not None
--> 175             result = roots(poly, cubics=True, quartics=True).keys()
     176
     177         elif strategy == GS_RATIONAL:

/home/ondra/repos/sympy/sympy/polys/rootfinding.pyc in roots(f, *symbols,  
**flags)
     275
     276             for i, h in enumerate(poly_sqf(g)):
--> 277                 for zero in _roots(h):
     278                     if zeros.has_key(zero):
     279                         zeros[zero] += i+1

/home/ondra/repos/sympy/sympy/polys/rootfinding.pyc in _roots(g)
     232                     [factors] = poly_factors(g)[1:]
     233
--> 234             if n > 1 and len(factors) != 1:
     235                 # extract first rational roots
     236                 # this decomposes the polynomial into polynomials of

UnboundLocalError: local variable 'factors' referenced before assignment

So that's probably related to the issue 1276.

If you figure out where the problem is with the git version is, it'd be  
awesome. You
can use git bisect for that. Here is some info how to get started with git:

http://docs.sympy.org/sympy-patches-tutorial.html#quick-start

Attachments:
        0001-Fixes-the-tsolve-1.0-2.0-x-3.0-sqrt-1-x-2-cj3.patch  2.5 KB

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to