Vinzent Steinberg wrote:
> On May 4, 3:31 pm, Akshay Srinivasan <[email protected]>
> wrote:
>   
>> Vinzent , I wanted to know how you planned to change the terms after
>> they were returned by find. This isn't entirely obvious to me. Shouldn't
>> the replacement part be inside find itself ?
>>     
>
> This is a good question. :) Sympy expressions are immutable, so it's
> necessary to rebuild the whole expression with the replacements
> applied. I did not want to cope with this, so I just intended to write
> a function that finds all occurrences of a certain pattern (for
> example sin(x)/cos(x)) in an expression. Using this, I could just pass
> over the job to subs. Of course this is quite inefficient, but it
> should work. :)
>
> Vinzent
> >
>   
 >>> expr=tan(x**2)+x**2
 >>> find(expr,a**2)
[x**2,x**2]

but,
 >>> expr=tan(x) + x
 >>> find(expr,a)
[tan(x), x, x]

This returns everything in the expression instead of giving [x,x] . I 
guess this has something to do with expr.match ?
I'm reminded of os.walk .

Akshay

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