Example:
Consider the initial value problem for the Riccati equation
\[
\frac{{\text d}y}{{\text d}x} = x^2 + y^2 , \qquad y(0) = \frac{3}{2} .
\]
Since the initial condition is set at the origin, we seek the solution of the above initial value problem is terms of Maclaurin power series
\[
y(x) = \frac{3}{2} + \sum_{n\ge 1} c_n x^n .
\]
**DESCRIPTION OF PROBLEM GOES HERE**
This is a description for some MATLAB code. MATLAB is an extremely useful tool for many different areas in engineering, applied mathematics, computer science, biology, chemistry, and so much more. It is quite amazing at handling matrices, but has lots of competition with other programs such as Mathematica and Maple. Here is a code snippet plotting two lines (
y vs. x and
z vs. x) on the same graph. Click to view the code!
syms y(x)
dydx = y^2+x^2;
constants = zeros(1,6);
constants(1) = subs(y(0),y(0),3/2)/factorial(0);
C=dydx;
constants(2) = subs(limit(C,x,0),y(0),3/2)/factorial(1);
for i = 2:5
C = subs(diff(C,x), diff(y(x),x),dydx);
constants(i+1) = subs(limit(C,x,0),y(0),3/2) / factorial(i);
end
disp(' C0 C1 C2 C3 C4 C5')
disp(constants)
fprintf('\n')
fprintf('C0 = 3/2 C1 = 9/4, C2 = 27/8, C3 = 259/48, C4 = 251/32, C5 = 3789/320\n')
fprintf('\n')