1
$\begingroup$

I want to solve n ODE in Mathematica, but there is an error I cannot understand: "The function x appears with no arguments."

This is the code I used:

eqn = x''[y] + a x'[y] Sin[y - y0] + a x[y] (Cos[y - y0] - s) == 0; 

sol = DSolve[eqn, x, y]

Could anyone help me? Is there another function that solve the problem?

$\endgroup$
2
  • $\begingroup$ Your eqn should read eqn = x''[y] + a x'[y] Sin[y - y0] + a x[y] (Cos[y - y0] - s) == 0; However, DSolve cannot handle this equation. $\endgroup$
    – Bob Hanlon
    Commented Nov 7, 2016 at 5:52
  • $\begingroup$ Thank you, @BobHanlon . So which function should I use? $\endgroup$
    – sara nj
    Commented Nov 7, 2016 at 6:17

2 Answers 2

2
$\begingroup$

DSolve is going to have issues with your ode, I doubt that there is a closed form answer. You might look instead at using NDSolve and settle for a numerical approximation. Notice that this will force you to pick concrete values for $y_0$ in order to run numerical solvers.

Alternatively, you could linearize the equation and use DSolve to capture leading order behavior (just like we approximate a pendulum by $y'' + y = 0$ instead of $y'' + \sin y = 0$). Techniques exist to extend this method to capture higher order terms instead of just linearizing.

$\endgroup$
2
$\begingroup$

Continuation of the answer of @erfink: Use NDSolve and see what influence parameters have.

 eqn[y0_, xs_, x0_, s_, a_] = 
       x''[y] + a x'[y] Sin[y - y0] + a x[y] (Cos[y - y0] - s) == 0 && 
        x'[0] == xs && x[0] == x0;

xsol[z_, y0_, xs_, x0_, s_, a_, b_, 
c_] := (x[z] /. First@NDSolve[eqn[y0, xs, x0, s, a], x, {y, b, c}])

Manipulate[
Plot[xsol[z, y0, xs, x0, s, a, -3, 3], {z, -3, 3}], {{y0, 0}, -3, 
3}, {{xs, 0}, -3, 3}, {{x0, 1}, -3, 3}, {{s, 0}, -3, 
3}, {{a, 1}, -3, 3}]

Attention: Use z instead of y. Otherwise you get problems with the y in NDSolve.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.