In line 4585 of ode.py RootOf instances return the Rational forms, e.g., >>> RootOf(2.3*x-2,0) 20/23.
The default behavior of solve is "Float in, Float out" unless rational=True. (The docstring for solve should be updated to say that the default behavior is rational=None.) On Saturday, April 4, 2015 at 11:27:07 PM UTC-5, G B wrote: > > Still wrestling with dsolve... Below is a call with an arbitrary > differential equation. Any idea why dsolve is returning terms with these > enormous integers? All of the coefficients are floats in this case. The > expression is impervious to .n() (as mentioned in my earlier question). > Converting to a numpy function to evaluate the results works, but throws > an exception when called. > > I can't seem to get past this point in the analysis. Any idea how I can > get this into a form I can continue working with? > > A=symbols(r'A',cls=Function) > t=symbols(r't') > Eq4=-123456.78*A(t)-9876.54*A(t).diff(t)-0.00032*A(t).diff(t,2)+1357908.64 > soln=dsolve(Eq4) > print(soln.n()) > > A(t) == C1*exp(125*t*(-33935533038108675 - > sqrt(1151618536954453541512853661417481))/274877906944) + > C2*exp(125*t*(-33935533038108675 + > sqrt(1151618536954453541512853661417481))/274877906944) + 10.999060885923 > > > fn=lambdify(t,soln.rhs,'numpy') > > > fn(3.2) > > > ---------------------------------------------------------------------------AttributeError > Traceback (most recent call > last)<ipython-input-42-bde0572cbbe1> in <module>()----> 1 fn(3.2) > //anaconda/lib/python3.4/site-packages/numpy/__init__.py in > <lambda>(_Dummy_73) > AttributeError: 'int' object has no attribute 'sqrt' > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/1cbc6317-96c6-45e8-9122-a9e346f38f96%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
