Untitled (1)

Here I will give a simple example of numerical solutions to differential equations.

> alias( y=y(t), y0=y(1), yp0=D(y)(1) ): definition of notations

> eqn := t^2*diff(y,[t$2]) + t*diff(y,t) +(t^2-1)*y =0; This gives the equation of n=1Bessel functions.

eqn := t^2*diff(y,`$`(t,2))+t*diff(y,t)+(t^2-1)*y =...

> initvals := y0=1, yp0 = 0: Initial conditions. You need two of them for a second order ODE.

> F := dsolve( {eqn, initvals}, y, type=numeric ); Solve it!

F := proc (rkf45_x) local i, rkf45_s, outpoint, r1,...

> F(3);

[t = 3, y = .297248965800930021, diff(y,t) = -.6467...

> Y := t -> rhs( op(2,F(t) ) ); Transform it into a function Y(t).

Y := proc (t) options operator, arrow; rhs(op(2,F(t...

> plot(Y,1..10); You can see that the plot looks like a Bessel function.

[Maple Plot]

>