# Solving differential equation in series general solution

1 vue (au cours des 30 derniers jours)
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)
##### 0 commentairesAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

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 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
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.

### Catégories

En savoir plus sur Numeric Solvers dans Help Center et File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!