37 lines
995 B
Python
37 lines
995 B
Python
# %%
|
|
# Grenzwerte mit python berechnen
|
|
import sympy as sp
|
|
from IPython.display import display
|
|
|
|
# Latex printing in interacitve windows initialisieren
|
|
sp.init_printing(use_latex=True)
|
|
|
|
n = sp.symbols("n")
|
|
|
|
functions = [
|
|
3 / (n + 2),
|
|
(n + 2) / 3,
|
|
(n + 2) / 3 * n,
|
|
3 * n / (n + 2),
|
|
3 * n / (6 * n + 2),
|
|
(4 - n**2) / (2 + n) ** 2,
|
|
(2 * n - 5 - 4 * n**2) / (3 - 8 * n**2 - 10 * n),
|
|
(3 * n**2 + 5 * n + 1) / (n - 1) ** 2,
|
|
(10**12 - 5 * n**2 + 6 * n**3 + 10**10 * n) / (5 - 7 * n**4 - 5 * n**2),
|
|
((2**n + 3) / (3**n + 2)) - 1,
|
|
((3 + n**100 + 2**n) / (n**2 - 3**n - 2)) + 4,
|
|
(2 + (6 * n**6 / (2 + 3 * n**3)) - 7 * n**3) / (n + (1 + n) ** 3),
|
|
]
|
|
|
|
for function in functions:
|
|
a = sp.limit_seq(function, n) # Grenzwert berechnen
|
|
|
|
# erstellt symbolisches limes n -> unendlich funktion
|
|
lim = sp.Limit(function, n, sp.oo)
|
|
|
|
# erstellt den equation object
|
|
eq = sp.Eq(lim, a)
|
|
|
|
# Display equation object in interactive window
|
|
display(eq)
|