Updates:
        Cc: Vinzent.Steinberg
        Labels: -NeedsReview

Comment #158 on issue 1694 by smichr: solve has many issues with fractions
http://code.google.com/p/sympy/issues/detail?id=1694

1694 is doing well.

It is weak in advanced Lambert pattern recognition and handles trig function via Euler substitutions. It should be as robust in solvable multi-system equations as it is in single equations now. If you have some favorite functions to test, that would be useful for feedback.

I think it was Vinzent that posted the following equations. I have held those as a sort of torture test for the solver and am happy to say that there are only two failures in solving for the roots of the function and its first three derivatives. Here is the test and the output is appended.

def dotest_german():
    from sympy import limit, oo, diff
    x = Symbol('x')
    a = Symbol('a')
    # partially taken from German "Abitur", Saxonia, advanced math course
    # see http://www.sn.schule.de/~matheabi/
    f1 = x**3 - 9*x
    f2 = 4*x * (1 - a*sqrt(x))
    f3 = x**x
    f4 = 1/a * log(1/a**3 - x**2)
    f5 = exp(a*x) * (x - 1)**2
    f6 = 10*exp(-a*x) * sin(a*x)
    f7 = 1 - log(4*x**2 + a)
    f8 = (x**3 + a*x) / (x**2 - a)
    f9 = (S.Half*x - a) * exp(1/a*x)
    f10 = 2*x * log(x) - a*x
    f11 = 1/a * (x - 2*a) * sqrt(x)
    f12 = -exp(2*a*x) + 4*exp(a*x) + 5
    f13 = (2*x - 1) * exp(a*x)
    f14 = x**2 * exp(1 - a*x)
    f15 = a*x**2 * (1 - log(x**2/a))
    f16 = exp(x) / (8*(a + x)**2)
    f17 = exp(x/2) + a/x
    f18 = 1 / log(a*x)
    f19 = (a**2 + 1) * (sin(a*x) + cos(a*x))
    f20 = x/a * sqrt(a**2 - x)
    f21 = (x - 1)**2 * (x + 4) / (x + a) / (x + 2)
for ii,f in enumerate(eval('[' + ', '.join('f%i' % i for i in range(1, 22)) + ']')):
        print 'graph discussion for f%i = %s' % (ii+1,f)
        if f==f11:
            pass
        if f == f2 or f==f11 or f==f20:
            limits = False
        else:
            limits = True
        df=diff(f,x)
        d2f=diff(df,x)
        d3f=diff(d2f,x)
        print 'f=',f
        print 'df=',df
        print 'd2f=',d2f
        print 'd3f=',d3f
        #graph_discussion(f, limits=limits)
        #continue
        if 1:
            print 'limits'
            if f not in [f6]:
                print '->oo',limit(f, x, oo)
            else: #f=f6
                print 'ValueError: Cannot determine the sign of sin(a*x)'
            if f not in [f6]:
                print '-->-oo',limit(f, x, -oo)
        try:
            #graph_discussion(f, limits=limits)
            try:
                print 'soln',solve(f,x)
            except:
                print 'FAIL0',f
                stop()
            try:
                if f==f21:
                    print solve(df,x,simplified=0)
                else:
                    print solve(df,x)
            except:
                print 'FAIL1',df
                stop()
            try:
                if f==f21:
                    print solve(d2f,x, simplified=False)
                else:
                    print solve(d2f,x)
            except:
                print 'FAIL2',d2f
                stop()
if f in [f3]: #f3 can't be solved by mathematicac, either; f21 is a 4th order
                continue
            try:
                if f==f21:
                    print solve(d3f,x,simplified=False)
                else:
                    print solve(d3f,x)
            except:
                print 'FAIL3',d3f
                stop()
        except:# Exception as e:
            print 'other FAILURE!'#print type(e), e
        print

====== OUTPUT ===========

graph discussion for f3 = x**x
f= x**x
df= x**x*(1 + log(x))
d2f= x**x*(1 + log(x))**2 + x**x/x
d3f= 3*x**x*(1 + log(x))/x + x**x*(1 + log(x))**3 - x**x/x**2
limits
->oo oo
-->-oo oo
soln [0]
[0, exp(-1)]
FAIL2 x**x*(1 + log(x))**2 + x**x/x
other FAILURE!

graph discussion for f17 = a/x + exp(x/2)
f= a/x + exp(x/2)
df= -a/x**2 + exp(x/2)/2
d2f= 2*a/x**3 + exp(x/2)/4
d3f= -6*a/x**4 + exp(x/2)/8
limits
->oo oo
-->-oo 0
soln FAIL0 a/x + exp(x/2)
other FAILURE!


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to