On 10 January 2012 22:25, Robert <[email protected]> wrote: > Thanks for all the responses, > you bring up a good argument about some of the additional > complications of simplifcation depending on some of the potential > factors of the Symbol. I appreciate your thoughtfullness on this > response. > > > on a similar note what is the best way to replace an expression that > has 1.0s everywhere > nsimpify is there for exactly this reason. It finds floats that could be represented better by rationals and substitutes them. Probably there are some similar but more fine-tuned functions in sympy but I don't know them.
> > In [36]: print 1.0*a**1.0 > 1.0*a**1.0 > > this seems to be the simplest: > > In [37]: print (1.0*a**1.0).subs(1.0, 1) > a > as you already said this will work only with 1.0, but not with 2.0 > > > On Jan 10, 2:41 pm, "Alexey U. Gudchenko" <[email protected]> wrote: > > 11.01.2012 00:27, [email protected] пишет: > > > > > On the other hand I don't know why a**2.0/a is not a**1.0. This seems > like > > > a bug... > > > > However, the 'simplify' works for this case: > > > > In [3]: simplify(a**2.0/a) > > Out[3]: a**1.0 > > > > Remarks: > > We implicitly assume that a<>0 during this simplification. > > > > If e.g. > > > > >>> a = Symbol('a', positive=True) # then 'a' became to be 'real' too > > > > then this simplification can be automatic, I think. At least I have no > > objection to add the last case to the issue tracker. > > > > -- > > Alexey U. > > -- > 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. > > -- 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.
