diff --git a/differentialrechnung/serie_9_11.py b/differentialrechnung/serie_9_11.py new file mode 100644 index 0000000..c09f33e --- /dev/null +++ b/differentialrechnung/serie_9_11.py @@ -0,0 +1,36 @@ +# %% +# Import SymPy for symbolic mathematics +import sympy as sp + +# Import display helpers to render LaTeX output in Jupyter/IPython +from IPython.display import display, Math + +# Define the symbolic variable x +x = sp.symbols("x") + +# List of functions to differentiate +functions = [ + 5 ** (x**3 - sp.sqrt(x) + 7), + sp.log(9 * x**2 - 4, 2), + sp.log(x**256) ** (1 / 4), + 1 / (1 + sp.exp(-x)), + sp.log(x) ** sp.log(x), + (2 ** (-sp.sqrt(sp.Abs(x)))) / (sp.log(2)), +] + + +# Loop over each function, compute its derivative, and display both +for func in functions: + + # Differentiate with respect to x, then simplify the result + derivativ = sp.simplify(sp.diff(func)) + + # Render f(x) and f'(x) as LaTeX; the double backslash (\\) creates a line break + display( + Math( + r"f(x) = {} \\ f'(x) = {}".format( + sp.latex(func, ln_notation=True), sp.latex(derivativ, ln_notation=True) + ) + ) + ) +# %% diff --git a/differentialrechnung/serie_9_9.py b/differentialrechnung/serie_9_9.py new file mode 100644 index 0000000..0bf91ce --- /dev/null +++ b/differentialrechnung/serie_9_9.py @@ -0,0 +1,32 @@ +# %% +# Import SymPy for symbolic mathematics +import sympy as sp + +# Import display helpers to render LaTeX output in Jupyter/IPython +from IPython.display import display, Math + +# Define the symbolic variable x +x = sp.symbols("x") + +# List of functions to differentiate +functions = [ + sp.exp(-x), + x * sp.exp(x), + (x + 2) * sp.exp(x), + sp.exp(-(x**2)), + (x + 1) * 2**x, + (x + 1) * 3 ** -(x**2), +] + + +# Loop over each function, compute its derivative, and display both +for func in functions: + + # Differentiate with respect to x, then simplify the result + derivativ = sp.simplify(sp.diff(func)) + + # Render f(x) and f'(x) as LaTeX; the double backslash (\\) creates a line break + display( + Math(r"f(x) = {} \\ f'(x) = {}".format(sp.latex(func), sp.latex(derivativ))) + ) +# %%