Solving differential equation in series general solution

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)

답변 (1개)

John D'Errico
John D'Errico 2023년 3월 14일

0 개 추천

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

J
J 2023년 3월 14일
편집: J 2023년 3월 14일
Yes,the previous differential equation worked well, but as you can see, this result is showing with the solution that contains equation like this, y(0)/112 - D(y)(0)/56)*x^7 . However, I want to make the solution look like this, which is the general solution, y = C1(1 - (1/2)x^2 - (1/6)x^3 + ...) + C2(x + x^2 - (1/4)x^4 + ...) for this differental equation. How can I make that solution into exact value series general solution with what command?
For the initial value part, I was just inputing any examples. https://www.youtube.com/watch?v=gg9RuDRuRo8 I learned from this video and typed the same command but this equation also outputs containing terms including "y(0)" and "D(y)" which is not the exact value for solution. Also, the command "Dy" does not work as you can see in the screenshot, so I am wondering what's the problem here. Thank you!
Before calling "dsolve", add the line
Dy = diff(y)
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!!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

릴리스

R2022b

질문:

J
J
2023년 3월 14일

댓글:

J
J
2023년 3월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by