The code is able to solve for "x**2*Derivative(f(x), x, x) - 
2*x*Derivative(f(x), x) + 2*f(x) - log(x) = 0" but is giving very complex 
solution. Is there any way to simplify complex equations.

The solution it is giving is
"(C1*sin(log(x)*Abs(im(sqrt(-log(x)**2)/log(x)**2) - arg(x)/(log(Abs(x))**2 
+ arg(x)**2))) + C2*cos((im(sqrt(-log(x)**2)/log(x)**2) - 
arg(x)/(log(Abs(x))**2 + 
arg(x)**2))*log(x)))*exp((re(sqrt(-log(x)**2)/log(x)**2) + 
log(Abs(x))/(log(Abs(x))**2 + arg(x)**2))*log(x)) + 
(C3*sin(log(x)*Abs(im(sqrt(-log(x)**2)/log(x)**2) + arg(x)/(log(Abs(x))**2 
+ arg(x)**2))) + C4*cos(-(-im(sqrt(-log(x)**2)/log(x)**2) - 
arg(x)/(log(Abs(x))**2 + 
arg(x)**2))*log(x)))*exp((-re(sqrt(-log(x)**2)/log(x)**2) + 
log(Abs(x))/(log(Abs(x))**2 + arg(x)**2))*log(x)) + log(x)/2 + 3/4"

while the actual solution is "c1*x + c2*x**2 + log(x)/2 + 3/4"
Here last two term that is particular solution is coming same, there is 
problem with general solution.

But code is not able to solve if I replace log(x) with any thing else like 
"x or x**2" in the question, in this case it is giving this error

```File "sympy/solvers/ode.py", line 3963, in 
_solve_undetermined_coefficients
    "(unable to solve for coefficients)." % eq)
NotImplementedError: Could not solve `2*f(x) - exp(x) - 3*Derivative(f(x), 
x) + Derivative(f(x), x, x)` using the method of undetermined coefficients 
(unable to solve for coefficients)```

@Ondrej @Aaron Any comments on this?


On Friday, March 21, 2014 5:42:41 AM UTC+5:30, Aaron Meurer wrote:
>
> The error message gives a hint (unable to solve for coefficients). So 
> somehow the point where solve() is called on the coefficients it 
> doesn't work. You'll have to put some print statements in the code to 
> see what is the input and output of solve that doesn't work. 
>
> Aaron Meurer 
>
> On Thu, Mar 20, 2014 at 1:50 PM, Kundan Kumar 
> <[email protected] <javascript:>> wrote: 
> > Aaron, 
> > When I am running dsolve for nonhomogeneous euler equation it is giving 
> > error 
> > 
> > NotImplementedError: Could not solve `-x + 2*f(x) - exp(x) - 
> > 3*Derivative(f(x), x) + Derivative(f(x), x, x)` using the method of 
> > undetermined coefficients (unable to solve for coefficients File 
> > "sympy/solvers/ode.py", line 561, in dsolve 
> >     return _helper_simplify(eq, hint, hints, simplify) 
> >   File "sympy/solvers/ode.py", line 583, in _helper_simplify 
> >     rv = odesimp(solvefunc(eq, func, order, match), func, order, hint) 
> >   File "sympy/solvers/ode.py", line 3300, in 
> > ode_nth_linear_euler_eq_nonhomogeneous 
> >     return ode_nth_linear_constant_coeff_undetermined_coefficients(eq, 
> func, 
> > order, match).replace(x,log(x)) 
> >   File "sympy/solvers/ode.py", line 3862, in 
> > ode_nth_linear_constant_coeff_undetermined_coefficients 
> >     return _solve_undetermined_coefficients(eq, func, order, match) 
> >   File "sympy/solvers/ode.py", line 3963, in 
> > _solve_undetermined_coefficients 
> >     "(unable to solve for coefficients)." % eq) 
> > NotImplementedError: Could not solve `-x + 2*f(x) - exp(x) - 
> > 3*Derivative(f(x), x) + Derivative(f(x), x, x)` using the method of 
> > undetermined coefficients (unable to solve for coefficients)) 
> > 
> > I read the code of undetermined coefficients, this error comes only when 
> > there is no value of "list" of coefficients of Particular solution like 
> a0, 
> > a1, .. 
> > Since the equation it is showing is perfect and it can easily solved by 
> > method of undetermined coefficients. I checked collectterms, r['list'], 
> > r['sol'], these are working fine. The most probably error may be arising 
> due 
> > to trialset. 
> > Since you know the inside-out of this undetermined function, can you 
> suggest 
> > why this is happening? 
>

-- 
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/4b86f5e4-4f6f-4f3e-961c-1e61d829d282%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to