Differential Equations

 # Maple solves differential equations using dsolve:

  deq := diff( y(x), x$2 ) + y(x) = 0;   # y''(x)+y(x)=0
  dsolve( deq, y(x) );

#  Try ?dsolve for more information.
#  Initial conditions give a unique solution that can be graphed.

 de := diff( y(x), x ) = y(x) - sin(x);
 ic := y(0)=01;
 sol:= dsolve( {de,ic}, y(x));

# To graph the solution, extract the expression after the equal sign
# of the answer. Maple function rhs does this, and then the expression
# can be graphed.

 u:=rhs(sol);
 plot( u, x = 0..10);

# Let's make a slope field, using  the DEplot command from
# the DEtools package:

 with(DEtools):
 de := diff( y(x), x ) = y(x) - sin(x);
 DEplot( de, y(x), x = -3..3, y = -3..3,
    arrows = line, dirgrid = [30,30]);

# Plot a few trajectories and the direction field.

 ics:=[ [y(0)=0], [y(0)=1], [y(0)=3] ];
   # Set of initial conditions. A double list.
   # Identical Result: ics:=[[0,0],[0,1],[0,3]]:
opts:=color='black',linecolor='red',arrows='line',dirgrid=[30,30]:
DEplot( de, y(x), x = -3..3, y = -3..3,opts,ics);