Hi Aaron ! 

I was thinking in context with the following problem,where I was looking 
into the pattern matching. I found this :
>>> pattern = (a+b*sin(c+d*x))**n
>>> term = (1 + 3 * sin(5 + 4 * y))** 10
>>> pattern.matches(term)
{a_: 1, n_: 10, d_: 4, c_: 5, b_: 3, x_: y}

>>> pattern = (a*sin(b+c*x))**n
>>> term = (3*sin(5+4*y))**3
>>> pattern.matches(term)
>>> 

Same goes, with :
>>> pattern2 = (a+ b*log(x))**n
>>> term2 = (3 + 2*log(x))**2
>>> pattern2.matches(term2)
{a_: 3, n_: 2, b_: 2}

But, 
>>> pattern3 = (b*log(x))**n
>>> term3 = (3*log(x))**2
>>> 

This is due to the fact,that the term, (3*log(x))**2 is now 9*log(x_)**2. 
(Is it a bug? or an improper implementation of pattern matching? If, yes, 
how can this be tackled?)

Due to this, I think special cases have to be considered(while implementing 
integration rules) where such case is occurring, during pattern matching. 
Please let me know your views on it.
Thanks,
Ankit



On Wednesday, March 8, 2017 at 11:24:21 PM UTC-5, Aaron Meurer wrote:
>
> You can use Pow(10*x, 2, evaluate=False). 
>
> Aaron Meurer 
>
> On Wed, Mar 8, 2017 at 11:06 PM, Ankit <[email protected] 
> <javascript:>> wrote: 
> > Hello ! I have this question ! 
> > 
> > Python automatically evaluates 10**2 to 100 or say (10*10) to 100 . 
> > 
> >  Same is the case where our expression is , for example: (2*log(x))**2, 
> it 
> > will become 4*log(x_)**2 
> > 
> > or 
> > 
> > (10*x)**2 becomes 100*x_**2                  (Also, how is x different 
> from 
> > x_ ?) 
> > 
> > Is there anyway,we can stop this evaluation and write these expressions 
> in 
> > non-evaluated form. 
> > 
> > What I thought of was to take them as Strings, and use Evaluate= False, 
> with 
> > sympify . But, if this expression is written in Sympy, like expr= 
> (10*x)**2, 
> > it will automatically get evaluated and expr = 100*x_**2. 
> > 
> > Please let me know the possible solution ! 
> > 
> > Thanks, 
> > Ankit 
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sympy. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/sympy/0fe38ea6-3e74-4326-9c78-119b9466e457%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/cbf027df-b0b8-468d-a2de-97d2bb4099d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to