Solving differential equation in series general solution

4 vues (au cours des 30 derniers jours)
J
J le 14 Mar 2023
Commenté : J le 14 Mar 2023
I was trying to solve differential equation in series general solution of (x+1)y''-(2-x)y'+y=0 and typed command, but it is not showing the correct solution and it is showing like the photo. However, I have to make the general solution look like y = C1(1 - (1/2)x^2 - (1/6)x^3 + ...) + C2(x + x^2 - (1/4)x^4 + ...) and could you please type the command for this part?
syms y(x)
S = dsolve((x+1)*diff(y,2)-(2-x)*diff(y)+y==0, 'ExpansionPoint',0,'Order',8)
syms C1 C2
C1*S(1) + C2*S(2)
Also, could you make any example of initial conditions like for example y(0)=2, y'(0) = 1. I think I am not sure how to put the initial value command because it is not working properly when I type for example command like this below. I appreciate it!
syms y(x)
S = dsolve((x+1)*diff(y,2)-(2-x)*diff(y)+y==0, 'ExpansionPoint',0,'Order',8, y(0)==2, Dy(0)==1)
syms C1 C2
C1*S(1) + C2*S(2)

Réponses (1)

John D'Errico
John D'Errico le 14 Mar 2023
I just showed you how to solve the problem, for two unknown constants. Of course, your question here involves an initial value at x ==0. Becareful, as if the series is singular at x==0, then trying to solve for an initial condition at x==0 will fail.
Take the series solution, as I showed you how to formulate it. You can also differentiate it. Now, substitute x==0 into both the series, and the derivative of that series. Could you now use solve to compute the value of those undetermined coefficients?
  3 commentaires
Torsten
Torsten le 14 Mar 2023
Before calling "dsolve", add the line
Dy = diff(y)
J
J le 14 Mar 2023
Thank you! It worked! Could you please type the command for solving the issue of the first paragraph part that I wrote in the comment? This is because I want to make the solution look like y = C1(1 - (1/2)x^2 - (1/6)x^3 + ...) + C2(x + x^2 - (1/4)x^4 + ...), and not like, y(0)/112 - D(y)(0)/56)*x^7+... Thank you!!

Connectez-vous pour commenter.

Produits


Version

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by