Code
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import sympy as sp
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import sympy as sp
'figure.figsize']=(5,3) plt.rcParams[
Zeigen Sie, dass die Funktion \(y(x) = C\frac{x}{1 + x}\) die allgemeine Lösung der Differentialgleichung \(x(1+x)y'(x) - y(x) = 0\) ist. Wie lautet die partikuläre Lösung zum Anfangswert \(y(1)=8\)? Erstellen Sie in Python einen Plot der partikulären Lösung.
Die Aufladung eines Kondensators der Kapazität \(C\) ab dem Zeitpunkt \(t=0\) über einen ohmschen Widerstand \(R\) auf die Endspannung \(u_0\) erfolgt nach dem Exponentialgesetz \(u_C(t) = u_0 (1- e^{-\frac{t}{RC}})\). Skizzieren Sie die Funktion \(u_C(t)\). Zeigen Sie, dass diese Funktion eine partikuläre Lösung der Differentialgleichung \(RC\dot{u_C}(t) + u_C(t) = u_0\) ist, die diesen Einschaltvorgang beschreibt. Erstellen Sie in Python Plots der Funktion \(u_C(t)\) für verschiedene Werte von \(C\) und \(R\).
Quellen:
Lösen Sie folgende DGL mit der Methode der Trennung der Variablen und überprüfen Sie jeweils Ihre Ergebnisse am Computer mittels SymPy.
Quellen:
Überprüfen Sie, ob die DGL exakt ist, und lösen Sie das Anfangswertproblem.
\[\dot{y} = \frac{-y^2}{2yt + 1}, \quad y(1)=-2\]
Quelle: Bronson: Schaum’s “Differential Equations”, p.36
Gegeben ist die Differentialgleichung \(y' = \frac{-2xy}{1 + x^2}\).
Quelle: Bronson: Schaum’s “Differential Equations”, Aufgaben 5.2 und 5.11, S. 33 und 36
Lösen Sie das folgende Anfangswertproblem \(yy' = \cos(2x), y(0) = -1\).
Ist die Differentialgleichung \(\dot{y}(t) = \frac{t + \sin(y(t))}{2y(t) - t\cos(y(t))}\) exakt? Begründen Sie Ihre Antwort. Geben Sie die allgemeine Lösung der Differentialgleichung in impliziter Form an.
Ein Auto mit Masse \(m\) und Anfangsgeschwindigkeit \(v_0\) bewegt sich nur unter dem Einfluss des als quadratisch von der Geschwindigkeit abhängig angenommenen Luftwiderstands.
Lösen Sie das Anfangswertproblem
\[y' = \frac{-x}{y}, \; y(0)=1.\]
Quelle: Farlow: Introduction to Differential Equations. Example 3, p. 40f.
= np.linspace(1, 10)
x = 16*x/(1 + x)
y
plt.figure()'r')
plt.plot(x, y,'x')
plt.xlabel('y')
plt.ylabel(True) plt.grid(
= np.linspace(0, 10)
t = 1
R = 1
C = 1
u0 = u0*(1 - np.exp(-t/(R*C)))
u
plt.figure()'r')
plt.plot(t, u,'t')
plt.xlabel('u')
plt.ylabel(True) plt.grid(
= sp.symbols('t')
t = sp.symbols('y', cls=sp.Function) y
sp.init_printing()= sp.Eq(y(t)*y(t).diff(t), t*sp.exp(t))
diffeq diffeq
\(\displaystyle y{\left(t \right)} \frac{d}{d t} y{\left(t \right)} = t e^{t}\)
sp.dsolve(diffeq, y(t))
\(\displaystyle \left[ y{\left(t \right)} = - \sqrt{2} \sqrt{C_{1} + t e^{t} - e^{t}}, \ y{\left(t \right)} = \sqrt{2} \sqrt{C_{1} + t e^{t} - e^{t}}\right]\)
= sp.Eq(y(t).diff(t)*(1 + t**2), t*y(t))
diffeq diffeq
\(\displaystyle \left(t^{2} + 1\right) \frac{d}{d t} y{\left(t \right)} = t y{\left(t \right)}\)
sp.dsolve(diffeq, y(t))
\(\displaystyle y{\left(t \right)} = C_{1} \sqrt{t^{2} + 1}\)
False) sp.init_printing(
=True)
sp.init_printing(use_unicode
= sp.Eq(y(t).diff(t), -y(t)**2/(2*y(t)*t + 1))
diffeq diffeq
\(\displaystyle \frac{d}{d t} y{\left(t \right)} = - \frac{y^{2}{\left(t \right)}}{2 t y{\left(t \right)} + 1}\)
sp.dsolve(diffeq, y(t))
\(\displaystyle \left[ y{\left(t \right)} = \frac{- \sqrt{C_{1} t + 1} - 1}{2 t}, \ y{\left(t \right)} = \frac{\sqrt{C_{1} t + 1} - 1}{2 t}\right]\)
False) sp.init_printing(
\(y(x) = -\sqrt{\sin(2x) + 1}\)
\(\frac{t^2}{2} + t\sin(y) - y^2 = c\)
= np.linspace(0, 60*5) # seconds
t = 30 # meters per second
v0 = 1000 # kg
m = 1.0
c
= v0/(1 + c*v0/m*t)
v
plt.figure()'r')
plt.plot(t, v,'t')
plt.xlabel('v')
plt.ylabel(True) plt.grid(
ist exakt, \(y=\sqrt{1 - x^2}\)