This works: if h = c*(e+f*x)^p then h/gcd(h,diff(h,x) ) should produce f*x+e. Setting x to 0 gives you e. subtracting e from f*x+e and setting x to 1 gives you f.
c is kind of arbitrary, since if c=q^p, you can put it inside the ()^p. If c is 1, then to find p, try log(h)/log(e+f*x). This all works in Maxima; not sure how if it works in sympy. RJF On Wednesday, June 8, 2016 at 7:54:05 PM UTC-7, Richard Fateman wrote: > > I suggest you get rid of all factors not dependent on x by scanning > through each term in a product, if you have a product. > then you need only find if the expression is R= (e+f*x)^p. > compute t A= taylor series expansion around 0 of R and B=taylor series of > diff(R,x). > > Some algebra should get you e,f,p, if you had some R of that form. check > by substitution. > > Just a suggestion. > > RJF > > > > On Thursday, May 5, 2016 at 7:01:41 AM UTC-7, Alexander Lindsay wrote: >> >> I am trying to build a rule for manual integration. I want to test >> whether an expression matches the general form: >> >> c (e + f x)**p >> >> where c, f, and p can be non-zero expressions not containing x, whereas >> e can be zero but again cannot contain x. >> >> Moreover, if the expressions matches the above form, I would like to >> parse it such that I know the values for c, e, f, and p. >> >> Any suggestions on general strategies for achieving my goals? I have >> been thinking about prolific use of func and args. I imagine that I >> would consider various branches for my test since c = 1, e = 0, f = 1, >> and p = 1 would all change the class type of the expression or >> sub-expressions. >> > -- 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/c52fbb2c-a0fc-49f6-b17a-1942797e91fd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
