Previous Up Next

23.4.1  Approximating solutions of y′=f(t,y)

The odesolve command can solve first order differential equations or first order systems. This section covers equations, while systems of equations are discussed in the next section.

odesolve finds values of the solution of a differential equation of the form y′=f(t,y); specifically, it will approximate y(t1) for a specified t1.

odesolve can take its arguments in various ways. Letting t and y be the independent and dependent variables, t0 and y0 be the initial values, t1 the place where you want the value of y, f be the function in the differential equation, f(t,y) be an expression which determines the function f (see Section 8.2.1 for the difference between a function and an expression).

Examples

odesolve(sin(t*y),[t,y],[0,1],2)

or:

odesolve(sin(t*y),t=0..2,y,1)

or:

odesolve(0..2,(t,y)->sin(t*y),1)

or:

f(t,y):=sin(t*y); odesolve(0..2,f,1)
     

1.82241255674
          
odesolve(0..2,f,1,tstep=0.3)
     

1.82241255675
          
odesolve(sin(t*y),t=0..2,y,1,tstep=0.5)
     

1.82241255674
          
odesolve(sin(t*y),t=0..2,y,1,tstep=0.5,curve)
     



















    0.0

1.0
    0.0238917513909

1.00028543504
    0.065808814858

1.00216696089
    0.108895370376

1.00594077449
    ⋮
    1.96462490594

1.8389834135
    1.97769352646

1.83297839039
    1.9908403154

1.82679805346
    2.0

1.82241255674



















          

Previous Up Next