Richtungsfelder bei DGL'n 1.Ordnung Traktrix

richtungesinus.nb Ha 7/97   Isoklinen

Needs["Graphics`Master`"]

\(PlotDGLField[
        f_, {x_, x0_, x1_, dx_:  Automatic}, {y_, y0_, y1_, 
          dy_:  Automatic}, 
	opts___] := 
      PlotVectorField[{1, f}\/\@\(1 + f\^2\), {x, x0, x1, dx}, {y, y0, y1, 
          dy}, opts]\)

xmin = 0; xmax = 3.8; ymin = 0; ymax = 3; dx = 0.2; 
    dy = 0.2;

Fur Anfangswertprobleme ist unten fa[x0,y0] zuständig.

Clear[g, k, c]

gTerm = (1/(k - x)) (Sqrt[(k^2) - (((k - x))^2)]);
gN[x_, 
          yd_] := (1/(k - x)) (Sqrt[(k^2) - (((k - x))^2)]);
g = (1/(k - x)) (Sqrt[(k^2) - (((k - x))^2)]);

gTerm

k = 4; 
    vec = PlotDGLField[
        gTerm, {x, xmin, xmax, dx}, {yd, ymin, ymax, 
          dy}, 
PlotStyle -> {RGBColor[1, 0, 1]}, 
        DisplayFunction -> Identity   ]; Clear[k]

deso=DSolve[yd'[x]==g,yd[x],x]

\(\(\(
\)\(\(\(({hi} = yd[x] /. deso)\);\)

    \(f[x_, c_] := Evaluate[hi /. C[1] -> c];\)

    f[x, c]\)\)\)

% /. k -> 4

x0 = 0; y0 = 0; k = 4;

DSolve[{yd'[x]==g,yd[x0] == y0},yd[x],x];
{hi} = yd[x] /. %;
fa[x_, x0_, y0_] := 
      Evaluate[hi]
fa[x, x0, y0]

fa[x, 0, 0] /. k -> 4

Expand[%]

% // N

fa[1.8, 0, 0]

fa[x, 0, 0]

k = 4; Clear[x0, y0];

\(\(alle = 
        Join[Table[fa[x, x0, ymin], {x0, xmin, xmax}], 
          Table[fa[x, xmin, y0], 
			{y0, ymin, ymax}], 
          Table[fa[x, x0, ymax], {x0, xmin, xmax}], 
		Table[
            fa[x, xmax, y0], {y0, ymin, ymax}]];\)\)

\(\(alleGraph = 
        Plot[Evaluate[alle], {x, xmin, xmax}, 
          PlotStyle -> Farbig, 
		PlotRange -> {ymin, ymax}, 
          DisplayFunction -> Identity];\)\)

\(\(dummy = 
        Plot[{0}, {x, xmin, xmax}, 
          PlotRange -> {ymin, ymax}, 
		DisplayFunction -> 
            Identity];\)\)

Show[dummy, vec, DisplayFunction -> $DisplayFunction, 
      AspectRatio -> Automatic]

Show[alleGraph, vec, DisplayFunction -> $DisplayFunction, 
        AspectRatio -> Automatic];

Verfahren von Heun

h = 0.2;

heun[{xk_, yk_}] := {xk + h, 
          N[yk + (1/2) h (gN[xk, yk] + 
                    gN[xk + h, yk + h gN[xk, yk]])]};

\(heunListe[{x_, y_}] := 
      Module[{x1, m0, z, mz, y1}, x1 = x + h; 
		m0 = gN[x, y]; \ 
        z = y + h\ m0; \ \ mz = gN[x1, z]; \ \ y1 = \ 
          y + h\ \((m0 + mz)\)/2; 
	\ Print[	{x1, m0, z, 
            mz, \((m0 + mz)\)/2, y1}]; \ {x1, y1}]\)

k = 4; punkte =  NestList[heunListe, {0, 0}, 15]

heunpkt = 
        ListPlot[punkte, 
          Prolog -> {RGBColor[0, 1, 0], 
              AbsolutePointSize[8]}];

graph = 
        Plot[fa[x, 0, 0], {x, 0, 3}, Prolog -> RGBColor[0, 0, 1], 
          Epilog -> RGBColor[1, 0, 1] ];

Show[heunpkt , graph];

Show[heunpkt, graph, vec, 
        AspectRatio -> Automatic];