Hi,

On Friday, 25 October 2013 06:26:53 UTC-4, Pietro Zambelli wrote:
>
> Hi all, 
>
>
> I'm new to sympy and I found a strange behaviour that I'm not able to 
> understand, probably I'm doing something wrong... 
>
> :-)
>
>
> {{{
>
> In [1]: from sympy import symbols
>
>
> In [2]: xa, ya, xb, yb = symbols('xa ya yb yb')
>
>
>
xb and yb both point to the same SymPy symbol, Symbol('yb'), so when you 
are substituting xb, you are actually substituting Symbol('yb')... with 2 
in [4], 0 in [5], 4 in [6].

 

> In [3]: yk = ya + yb
>
>
> In [4]: yk.subs([(xa, 0), (ya, 4), (xb, 2), (yb, 4)])
>
> Out[4]: 6
>
>
>

 

> In [5]: yk.subs([(xa, 0), (ya, 4), (xb, 0), (yb, 4)])
>
> Out[4]: 4
>
> In [6]: yk.subs([(ya, 4), (yb, 4)])
>
> Out[5]: 8
>
>
> In [7]: import sympy
>
>
> In [8]: sympy.__version__
>
> Out[7]: '0.7.3'
> }}}
>
> Why the result is changing from line 4 to line 6? The variable xa and xb 
> are not used in the equation at line 3, but they changed the result... I'm 
> confused..
>
> Any hints?
>
> Pietro
>


Cheers,
Julien 

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to