Differential equation of first order and second degree

By Reinaldo Baretti Machín
www.geocities.com/serienumerica2
[email protected]


c DE of the first order and second degree
c Differential Equations Ref. Morris & Brown page 69
c   p**2 -(2.*x+3.*y)*p + 6.*x*y=0 where  p=dy/dx ,
      data c, xi,xf,nstep/1.,0.,2.,5000/
c one solution is ysol(x)= c*exp(3.*x)
      ysol(x)= c*exp(3.*x)
c solve for p as in a quadratic equation one root is p=
      f(x,y)= .5*( (2.*x+3.*y)+sqrt( (2.*x+3.*y)**2-24.*x*y))
      dx=(xf-xi)/float(nstep)
      y0=ysol(xi)
      kp=int(float(nstep)/40.)
      kount=kp
      print*,'nstep,dx=',nstep,dx
      print*,'  '
      Print*,'      x          y            ysol '
      print 100,xi,y0,ysol(xi)
      do 10 i=1,nstep
      x=xi+dx*float(i)
      y1=y0+dx*f(x-dx,y0)
      if(i.eq.kount)then
      print 100,x,y1,ysol(x)
      kount=kount + kp
      endif
      y0=y1
10    continue
100   format(3(1x,e10.3))
      stop
      end


      RUN
       nstep,dx= 5000  0.00039999999

       x          y            ysol
  0.000E+00  0.100E+01  0.100E+01
  0.500E-01  0.116E+01  0.116E+01
  0.100E+00  0.135E+01  0.135E+01
  0.150E+00  0.157E+01  0.157E+01
  0.200E+00  0.182E+01  0.182E+01
  0.250E+00  0.212E+01  0.212E+01
  0.300E+00  0.246E+01  0.246E+01
  0.350E+00  0.286E+01  0.286E+01
  0.400E+00  0.332E+01  0.332E+01
  0.450E+00  0.385E+01  0.386E+01
  0.500E+00  0.448E+01  0.448E+01
  0.550E+00  0.520E+01  0.521E+01
  0.600E+00  0.604E+01  0.605E+01
  0.650E+00  0.702E+01  0.703E+01
  0.700E+00  0.816E+01  0.817E+01
  0.750E+00  0.947E+01  0.949E+01
  0.800E+00  0.110E+02  0.110E+02
  0.850E+00  0.128E+02  0.128E+02
  0.900E+00  0.149E+02  0.149E+02
  0.950E+00  0.173E+02  0.173E+02
  0.100E+01  0.200E+02  0.201E+02
  0.105E+01  0.233E+02  0.233E+02
  0.110E+01  0.271E+02  0.271E+02
  0.115E+01  0.314E+02  0.315E+02
  0.120E+01  0.365E+02  0.366E+02
  0.125E+01  0.424E+02  0.425E+02
  0.130E+01  0.493E+02  0.494E+02
  0.135E+01  0.573E+02  0.574E+02
  0.140E+01  0.665E+02  0.667E+02
  0.145E+01  0.773E+02  0.775E+02
  0.150E+01  0.898E+02  0.900E+02
  0.155E+01  0.104E+03  0.105E+03
  0.160E+01  0.121E+03  0.122E+03
  0.165E+01  0.141E+03  0.141E+03
  0.170E+01  0.164E+03  0.164E+03
  0.175E+01  0.190E+03  0.191E+03
  0.180E+01  0.221E+03  0.221E+03
  0.185E+01  0.256E+03  0.257E+03
  0.190E+01  0.298E+03  0.299E+03
  0.195E+01  0.346E+03  0.347E+03
  0.200E+01  0.402E+03  0.403E+03

      
Hosted by www.Geocities.ws

1