Issue 1169: unify symbols and var
http://code.google.com/p/sympy/issues/detail?id=1169

Comment #9 by Vinzent.Steinberg:
These strange issues appear with the patch:

>>> from sympy import *
>>> [sympify(arg) for arg in (sin(x), ('x',0,1))]
[sin(x), (x, 0, 1)]
>>> integrate(*_)
sin(1)
>>> integrate(sin(x), (x, 0, 1))
1 - cos(1)

Don't have a clue what's causing this.


>>> def NS(e, n=15, **options):
...     return str(sympify(e).evalf(n, **options))
...
>>> NS(pi - 4*Integral('sqrt(1-x**2)', (x, 0, 1)), 15, maxprec=30,  
chop=True)
'-.0e-16'

In fact, this is numerically zero (for 15 accurate decimal digits). Don't  
know why it
doesn't work anymore.


>>> var('x y z w')
(x, y, z, w)
>>> e = (x-y)*(z-y) + sin((x-y)*(z-y))
>>> substs, reduced = cse([e],  
optimizations=[(cse_opts.sub_pre,cse_opts.sub_post)])
>>> substs
[(x0, z - y), (x1, x - y), (x2, x0*x1)]
# according to test:[(x0, z-y), (x1, x-y), (x2, x0*x1)]
>>> import itertools
>>> x0,x1,x2 = list(itertools.islice(cse_main.numbered_symbols(), 0, 3))
>>> substs == [(x0, z-y), (x1, x-y), (x2, x0*x1)]
True

No clue why this comparison fails in the tests.


>>> n, k = symbols('nk', integer=True)
>>> C0, C1, C2 = symbols('C0', 'C1', 'C2')
>>> rsolve_poly([-1, 1], n, n) == C0 + (n**2 - n)/2
False
>>> rsolve_poly([-1, 1], n, n)
C0 - n/2 + 1/2*n**2
>>> C0 + (n**2 - n)/2
C0 - n/2 + 1/2*n**2

The new result is like before, but the comparison fails for some reason.


>>> solution = rsolve_ratio([-2*n**3+n**2+2*n-1, 2*n**3+n**2-6*n,
...         -2*n**3-11*n**2-18*n-9, 2*n**3+13*n**2+22*n+8], 0, n)
>>> solution
(3*C1 - 2*C1*n)/(2 - 2*n**2)
>>> solution in [ (-3*C1 + 2*C1*n)/(-2 + 2*n**2),
...                          ( 3*C1 - 2*C1*n)/( 2 - 2*n**2) ]
False

Same here.

>>> rsolve_hyper([n**2-2, -2*n-1, 1], 0, n)
C0*RisingFactorial(2**(1/2), n) + C1*RisingFactorial(-2**(1/2), n)
>>> _ in [C0*rf(sqrt(2), n) + C1*rf(-sqrt(2), n),
...       C1*rf(sqrt(2), n) + C0*rf(-sqrt(2), n)]
False

Again.


It seems that sometimes x != x due to the patch. Any idea why?




-- 
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 sympy-issues@googlegroups.com
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