Proseminar zu Differentialgleichungen (SS 01)

This command will generate the phase plot of a planar vector field. The first argument f is the
vector field. The second is a list of initial conditions. The third is the maximal time for which the solution will be computed. In addition there are some optional graphics arguments which are passed to the Show[] command.

\(\(PhasePlot[f_, ic_, tmax_, opts___] := 
        Block[{i, n = Length[ic], ff, ivp, sol, 
            phaseplot}, 
ff = 
            f\  /. \ {x -> x[t], y -> y[t]}; 
Off[
            ParametricPlot::"ppcom"]; 
Do[
ivp = {\(x'\)[t] == ff[\([1]\)], \(y'\)[t] == 
                  ff[\([2]\)], x[0] == ic[\([i, 1]\)], 
                y[0] == ic[\([i, 2]\)]}; 
sol = 
              NDSolve[ivp, {x[t], y[t]}, {t, \(-tmax\), 
                  tmax}]; 
phaseplot[i] = 
              ParametricPlot[{x[t], y[t]}\  /. \ sol, {t, \(-tmax\), tmax}, 
                DisplayFunction -> Identity]
, {i, 1, 
              n}]; 
On[
            ParametricPlot::"ppcom"]; 
Show[
            Table[phaseplot[i], {i, 1, n}], 
            DisplayFunction -> $DisplayFunction, 
            opts]
];\)\)

1)

DSolve[x'[t] ==  a x[t] (K  - x[t]), x[t], 
      t]

D[x[t]  /.  %, t]  // Simplify

2)

x[t_] = (E^(- (a/2) t)) y[t];

x''[t] +  a x'[t] + b x[t]  == 0 // 
      Simplify

DSolve[%, y[t], t]

Clear[x]

3)

DSolve[m x''[t] == -ρ x'[t]  +  m g, x[t], 
      t]

4)

DSolve[x'[t] == a[t] x[t] , x[t], t]

5)

DSolve[y'[x] == 2 y[x]  + 1  + (x^2), y[x], x]

6)

DSolve[y'[x] == - y[x]  + (1/x) , y[x], x]

7)

DSolve[y'[x] == -((x  )/y)[x] , y[x], 
      x]

PhasePlot[{ y, -x }, {{0, 1}, {0, 2}, {0, 3}, {0, 4}}, π, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

8)

u[x_] = y[x]/x;

u'[x] == D[ y[x]/x, x]  /. {y'[x_] -> f[u[x]], 
          y[x_] -> x u[x]} // Simplify

DSolve[% , u[x], x]

9)

DSolve[y'[x] == ((a x  +  d y[x])/(bx  + c y[x])), y[x], 
      x]

Senke/Quelle

PhasePlot[{x +  y, -x  + y}, {{1, 
            1}, {-1, -1}, {-1, 1}, {1, -1}, {2, 
            2}, {-2, -2}, {-2, 2}, {2, -2}, {3, 
            3}, {-3, -3}, {-3, 3}, {3, -3}}, 2, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

Sattel

PhasePlot[{x +  y, 
          x  - y}, {{1 - (Sqrt[2]), 1}, {-1 + (Sqrt[2]), -1}, {1 + (Sqrt[2]), 
            1}, {-1 - (Sqrt[2]), -1}, {1, 1}, {-1, -1}, {-1, 
            1}, {1, -1}, {2, 2}, {-2, -2}, {-2, 
            2}, {2, -2}, {3, 3}, {-3, -3}, {-3, 
            3}, {3, -3}}, 2, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

10)

D[c x  +  d y, y] == 
      D[-a x  -  b y, x]

a = -d;

∫(c x  +  d y) \[DifferentialD]x +C[
        y]

Simplify[%  /.  
        Flatten[DSolve[D[%, y] == -a x  -  b y, C[y], 
            y]]]

Clear[a]

11)

Clear[μ]

μ[x_, y_] = 
        (1/(c (x^2) - (a - d) x y - b (y^2)));

D[μ[x, y] (c x  +  d y), y] == 
        D[-μ[x, y] (a x  +  b y), x] // 
      Simplify

∫μ[x, y] (c x  +  d y) \[DifferentialD]x  + 
          C[y]  // Simplify // PowerExpand

FullSimplify[%  /.  
        Flatten[DSolve[
            D[%, y] == -μ[x, y] (a x  +  b y), C[y], 
            y]]]

Simplify[(1/μ)[x, y] {D[%, x], D[%, y]}]

12)

DSolve[y'[x] == a[x] y[x]  + b[x] y[x]^α, y[x], x] // 
      FullSimplify

13)

DSolve[x'[t] + x[t]/t ==  t^2 x[t]^2, x[t], t]

14)

DSolve[y'[x] == a[x] y[x]  + b[x] y[x]^2 + c[x], y[x], 
      x]

15)

DSolve[y'[x] - (1 - 2  x) y[x]  + y[x]^2 == 2  x, y[x], 
        x] // FullSimplify

16)

DSolve[y'[x] == (E^(-x)) y[x]^2 + 
          y[x]  - (E^x), y[x], x]

17)

DSolve[{y'[x] == y[x]^2 - (x^2), y[0] == 1}, y[x], x] // 
      FullSimplify

Needs["DiscreteMath`DiffEqs`"]

y[x_]= (Underoverscript[(∑^⋆), (j = 0), ∞]) (x^j) h[j];h[0] = 1;

ShiftPowers[(Underoverscript[(∑^⋆), (j = 0), ∞])j (x^(-1 + j)) h[j]-(Underoverscript[(∑^⋆), (j = 0), ∞]) (x^j) (∑_(k = 0)^j) h[k] h[j - k] + (x^2),x]

SplitSum[%, 3]  // FactorSum  // Simplify

h[0] = 1; h[1] = 1; h[2] = 1; h[3] = 2/3;

%%

h[j_] := (1/j) (∑_(k = 0)^(j - 1))h[k] h[
                j - 1 - k]  /;  (j > 3)

(∑_(j = 0)^7) (x^j) h[j]

Clear[y]

18)

DSolve[y'[
          x] == -((3  x y[x]  + y[x]^2)/((x^2) + 
                x y[x])), y[x], x]

19)

DSolve[y'[
          x] == -y[
                x]/(x y[x] - (E^(-2 y[x]))), y[x], 
      x]

20)

A=(({{0, 1}, {0, 0}}));B=(({{0, 0}, {1, 0}}));

A . B - B . A // MatrixForm

MatrixExp[A] . MatrixExp[A] == MatrixExp[A + B]

21)

S=(({{a + d, b}, { c, a - d}}));

x = (Sqrt[(d^2) + b c]);
A:=(E^a)(({{Cosh[x] + 
                    d (( Sinh[x])/x), b (( Sinh[x])/x)}, {c (( Sinh[x])/x),  Cosh[x] - 
                    d  Sinh[x]/x}}));

MatrixExp[S] == A // FullSimplify

Clear[x]

S=(({{0, -π}, { π, 0}}));

MatrixExp[S] // Simplify // MatrixForm

22)

A=(({{1, 0}, {0, 2}}));

PhasePlot[A . { x, y }, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 5, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

A=(({{0, -1}, {2, 0}}));

PhasePlot[A . { x, y }, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 3, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

A=(({{0, 1}, {1, 0}}));

PhasePlot[A . { x, y }, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 3, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

23)

z[t_] = x[t] +  I y[t];
x'[
          t] = α x[t]  -  β y[
              t];
y'[t] = β x[t]  + α y[t];

D[z[t], t] // Simplify

Clear[x, y, z, Derivative]

24)

A=(({{0, 3}, {1, -2}}));

DSolve[{x'[t] == (A . {x[t], y[t]})[[1]], y'[
              t] == (A . {x[t], y[t]})[[2]]}, {x[t], y[t]}, t] // 
      Simplify

A=(({{-1, 2}, {-1, 1}}));

DSolve[{x'[t] == (A . {x[t], y[t]})[[1]], y'[
              t] == (A . {x[t], y[t]})[[2]]}, {x[t], y[t]}, t] // 
      Simplify

{x[t], y[t]}  /.  %

ComplexExpand[%]  // Simplify

25)

J=(({{2, 0}, {0, -1}}));U=(({{1, -1}, {1, 2}}));
MatrixForm[
      A = U . J . Inverse[U] ]

MatrixExp[
            t A] . (Transpose[U][[1]] + Transpose[
                  U][[2]]) // Simplify // Expand

{x[t_], y[t_]} = %;

{x'[t] == (A . {x[t], y[t]})[[1]], y'[
            t] == (A . {x[t], y[t]})[[2]]} // 
      Simplify

Clear[A, U, J, x, y]

26)

eqns = {x'[t] == a x[t]  +  b y[t], y'[t] == 
            c x[t]  + d y[t] };

eqns[[1]]  //  D[#, t] &

%  /.  Solve[eqns[[2]], y'[t]]

%  /.  Solve[eqns[[1]], y[t]]  // Flatten  // 
      Simplify

Clear[eqns]

28)

x[t_] := (E^(A t)) 
          (Subscript[x, 0]) + (∫_0^t) (E^(A (t - τ))) s[τ] \[DifferentialD]τ

x'[t] ==  A x[t]  + s[t] // Simplify

Clear[x]

29)

A=(({{1, -1}, {1, 2}}));s[t_] = {-36 t, -2 (E^t)};

x[t_] = MatrixExp[A t] . {(Subscript[x, 0]), 
                (Subscript[y, 0])} + (∫_0^t) MatrixExp[A (t - τ)] . 
                  s[τ] \[DifferentialD]τ  // ComplexExpand // 
        FullSimplify

Clear[A, s, x]

30)

A=(({{1, 0}, {0, 0}}));

PhasePlot[A . { x, y }, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 6, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

A=(({{0, 1}, {0, 0}}));

PhasePlot[A . { x, y }, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 6, 
        PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

31)

A=(({{1, -1, -1}, {1, 3, 1}, {-3, 1, -1}}));

MatrixExp[t A]  // MatrixForm

Clear[A]

32)

A=(({{-1, 1, -2}, {0, -1, 4}, {0, 0, 1}}));

MatrixExp[t A]  // MatrixForm

Clear[A]

33)

n = 3; u[j_] = (x^(j - 1));
X = Table[u[j], {j, 1, n}];

A = 
        Transpose[
          Table[ PadRight[CoefficientList[ D[u[j], x], x ], n], {j, 1, 
              n}]];

MatrixForm[A]

(A . Array[a, n]) . X ==  D[Array[a, n] . X, x]

Eigenvalues[A]

MatrixForm[EA = MatrixExp[t A]]

(EA . Array[a, n]) . X

Clear[A, EA, u, n]

34)

Collect[(λ - α) (λ -  β) (λ - γ), λ]

Collect[(λ - α - I β) (λ - α + I β) (λ - γ), λ]

s = α + β + γ; 
    m = α β + α γ + β γ; 
    d = α β γ;
m s - d // Simplify

s = 2  α + γ; 
    m = (α^2) + (β^2) + 2 α γ; 
    d = ((α^2) + (β^2)) γ;
m s - d // FullSimplify

(λ^3) - S (λ^2) + M λ  - 
          M S  ==  ((λ^2) + M) (λ - S)  // 
      Simplify

42)

DSolve[{x'''[t] - x''[t] + 4 x'[t] - 4 x[t] == 0, 
        x[0] == 1, x'[0] == -1, x''[0] == 1}, 
      x[t], t]

43)

DSolve[x''''[t] + 2  x''[t] + x[t] == 0, x[t], 
      t]

45)

Needs["DiscreteMath`RSolve`"]

RSolve[{x[n + 2] == x[n + 1] + x[n], x[1] == 1, 
        x[2] == 1}, x[n], n]

61)

Clear[u, v]

u[t_, 0] = 0;v[t_, 0] = 0;Derivative[1, 0][u][t_, 0]=0;Derivative[1, 0][v][t_, 0]=0;

eqn = {(∂_t) 
              u[t, r] - (1 - (E^v)[t, r]), (∂_t) 
              v[t, r] - (ω^2) ((E^u)[t, r] - 
                  1)};

n = 3;

eqn = Series[eqn, {r, 0, n}]

Do[eq[j]=Simplify[{Coefficient[eqn, r, j][[1]] == 0,Coefficient[eqn, r, j][[2]] == 0,Derivative[0, j][u][0, 0]==If[j == 1, 1, 0],Derivative[0, j][v][0, 0]==0}];,{j, n}]

Do[
dsol[j]=Flatten[DSolve[eq[j],{Derivative[0, j][u][t, 0],Derivative[0, j][v][t, 0]},t]];
dsol[j] = FullSimplify[dsol[j]];
Do[eq[k]  = 
                eq[k]  /.  dsol[j];, {k, j + 1, n}],
{j, n}]

dsolall = Flatten[Table[dsol[j], {j, n}], 1];

uu[t_, r_] = Series[u[t, r], {r, 0, n}] /.  dsolall

vv[t_, r_] = Series[v[t, r], {r, 0, n}] /.  dsolall

func = Normal[{uu[t, r], vv[t, r]} ] /. {r -> 0.2, ω -> 1};  
    ParametricPlot[Evaluate[func], {t, 0, 2  π}];

ϕ[t_, r_] = ArcTan[vv[t, r]/uu[t, r]];

phid[t_, r_] = (∂_t) ϕ[t, r] // Simplify;

int = (∫_0^(T[r]))phid[t, r] \[DifferentialD]t // 
        Simplify

int = 
      Series[Normal[int], {r, 0, 2}] /.  
          T[0] -> ((2  π )/ω) // 
        FullSimplify

Solve[{Coefficient[int, r, 1] == 0, 
          Coefficient[int, r, 2] == 0}, {T'[0], T''[0]}]  // 
      Flatten

62)

eqn = {x'[t] -> 
            x[t] (r - a x[t]  -  b y[t]), y'[t] -> 
            y[t] (-s + c x[t]  - d y[t])};

V[x_, y_] = c (x - (r/a) Log[x])  +  b y

(∂_t) V[x[t], y[t]]  /.  eqn // FullSimplify

%   /.  {α -> c, β -> b}

68)

DSolve[{x'[t] == x[t]^2, y'[t] == -y[t]}, {x[t], 
        y[t]}, t]

PhasePlot[{(x^2), -y}, {{2, 2}, {1, 1}, {-1, 2}, {-1, 
            1}, {1, -1}, {2, -2}, {-1, -1}, {-1, -2}}, 2, PlotRange -> {{-5, 5}, {-5, 5}}, 
        Ticks -> False];

69)

DSolve[{x'[t] == x[t] (x[t] +  2  y[t]), y'[t] == 
          y[t] (2  x[t] + y[t])}, {x[t], y[t]}, t]

PhasePlot[{x (x +  2  y), y (2  x + y)}, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 2, 
        PlotRange -> {{-3, 3}, {-3, 3}}, 
        Ticks -> False];

70)

DSolve[{x'[t] == x[t] (x[t] -  2  y[t]), y'[t] == 
          y[t] (-2 x[t] + y[t])}, {x[t], y[t]}, t]

PhasePlot[{x (x -  2  y), y (-2 x + y)}, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 2, 
        PlotRange -> {{-3, 3}, {-3, 3}}, 
        Ticks -> False];

71)

DSolve[{x'[t] == y[t]^5, y'[t] == 
          x[t] + y[t]^2}, {x[t], y[t]}, t]

PhasePlot[{(y^5), x + (y^2)}, 
        Flatten[Table[{i, j}, {i, -2, 2}, {j, -2, 2}], 1], 2, 
        PlotRange -> {{-3, 3}, {-3, 3}}, 
        Ticks -> False];