Jupyter für Mathe

This commit is contained in:
Erik Grobecker 2024-11-18 12:13:17 +01:00
parent e14a9a0d19
commit 0ddb8af527
Signed by: Erik
GPG key ID: 80D020D0ABBD3FB2
4 changed files with 551 additions and 34 deletions

View file

@ -1,27 +0,0 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs =
{ nixpkgs, ... }:
{
/*
This example assumes your system is x86_64-linux
change as neccesary
*/
devShells.x86_64-linux =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
default = pkgs.mkShell {
packages = [
pkgs.typst
pkgs.typstyle
pkgs.tinymist
pkgs.agebox
];
};
};
};
}

View file

@ -0,0 +1,298 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### **Grundlegende Operatoren und Funktionen**\n",
"\n",
"1. **Exponentiation** (Potenz)\n",
"\n",
" - `**`: Exponentiation\n",
" ```python\n",
" x**2 # x hoch 2\n",
" ```\n",
" - `exp(x)`: Exponentielle Funktion \\( e^x \\)\n",
" ```python\n",
" from sympy import exp\n",
" exp(x)\n",
" ```\n",
"\n",
"2. **Logarithmen**\n",
"\n",
" - `log(x)`: Natürlicher Logarithmus \\( \\ln(x) \\)\n",
" ```python\n",
" from sympy import log\n",
" log(x)\n",
" ```\n",
" - `log(x, base)`: Logarithmus zur Basis `base`\n",
" ```python\n",
" log(x, 10) # Logarithmus zur Basis 10\n",
" ```\n",
"\n",
"3. **Trigonometrische Funktionen**\n",
"\n",
" - `sin(x)`: Sinus\n",
" ```python\n",
" from sympy import sin\n",
" sin(x)\n",
" ```\n",
" - `cos(x)`: Kosinus\n",
" ```python\n",
" from sympy import cos\n",
" cos(x)\n",
" ```\n",
" - `tan(x)`: Tangens\n",
" ```python\n",
" from sympy import tan\n",
" tan(x)\n",
" ```\n",
" - `csc(x)`: Kosekans (1/sin(x))\n",
" ```python\n",
" from sympy import csc\n",
" csc(x)\n",
" ```\n",
" - `sec(x)`: Sekans (1/cos(x))\n",
" ```python\n",
" from sympy import sec\n",
" sec(x)\n",
" ```\n",
" - `cot(x)`: Kotangens (1/tan(x))\n",
" ```python\n",
" from sympy import cot\n",
" cot(x)\n",
" ```\n",
"\n",
"4. **Hyperbolische Funktionen**\n",
"\n",
" - `sinh(x)`: Sinus hyperbolicus\n",
" ```python\n",
" from sympy import sinh\n",
" sinh(x)\n",
" ```\n",
" - `cosh(x)`: Kosinus hyperbolicus\n",
" ```python\n",
" from sympy import cosh\n",
" cosh(x)\n",
" ```\n",
" - `tanh(x)`: Tangens hyperbolicus\n",
" ```python\n",
" from sympy import tanh\n",
" tanh(x)\n",
" ```\n",
"\n",
"5. **Trigonometrische Inverse Funktionen**\n",
" - `asin(x)`: Arkussinus (Inverser Sinus)\n",
" ```python\n",
" from sympy import asin\n",
" asin(x)\n",
" ```\n",
" - `acos(x)`: Arkuskosinus (Inverser Kosinus)\n",
" ```python\n",
" from sympy import acos\n",
" acos(x)\n",
" ```\n",
" - `atan(x)`: Arkustangens (Inverser Tangens)\n",
" ```python\n",
" from sympy import atan\n",
" atan(x)\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Algebraische Operationen**\n",
"\n",
"1. **Addition, Subtraktion, Multiplikation, Division**\n",
"\n",
" - `+`, `-`, `*`, `/`\n",
" ```python\n",
" x + y # Addition\n",
" x - y # Subtraktion\n",
" x * y # Multiplikation\n",
" x / y # Division\n",
" ```\n",
"\n",
"2. **Exponenten**\n",
"\n",
" - `**`: Potenz\n",
" ```python\n",
" x**2 # x hoch 2\n",
" ```\n",
"\n",
"3. **Wurzeln**\n",
" - `sqrt(x)`: Quadratwurzel\n",
" ```python\n",
" from sympy import sqrt\n",
" sqrt(x)\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Integral- und Ableitungsoperationen**\n",
"\n",
"1. **Ableitungen**\n",
"\n",
" - `diff(f, x)`: Erste Ableitung von `f` nach `x`\n",
" ```python\n",
" from sympy import diff\n",
" diff(f, x)\n",
" ```\n",
"\n",
"2. **Integrale**\n",
" - `integrate(f, x)`: Unbestimmtes Integral von `f` nach `x`\n",
" ```python\n",
" from sympy import integrate\n",
" integrate(f, x)\n",
" ```\n",
" - `integrate(f, (x, a, b))`: Bestimmtes Integral von `f` von `a` bis `b`\n",
" ```python\n",
" integrate(f, (x, 0, 1))\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Summen, Produkte und Faktorisierung**\n",
"\n",
"1. **Summe**\n",
"\n",
" - `sum(iterable)`: Summe über eine Reihe oder Liste\n",
" ```python\n",
" from sympy import Sum, symbols\n",
" n = symbols('n')\n",
" Sum(n, (n, 1, 10))\n",
" ```\n",
"\n",
"2. **Produkt**\n",
"\n",
" - `product(iterable)`: Produkt über eine Reihe oder Liste\n",
" ```python\n",
" from sympy import Product\n",
" Product(n, (n, 1, 10))\n",
" ```\n",
"\n",
"3. **Faktorisierung**\n",
"\n",
" - `factor(x)`: Faktorisieren eines Polynoms\n",
" ```python\n",
" from sympy import factor\n",
" factor(x**2 - 4)\n",
" ```\n",
"\n",
"4. **Entwicklung in Reihen**\n",
" - `series(f, x)`: Taylor-Reihe von `f` um `x`\n",
" ```python\n",
" from sympy import series\n",
" series(f, x)\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Matrixoperationen**\n",
"\n",
"1. **Matrix**\n",
"\n",
" - `Matrix([[1, 2], [3, 4]])`: Erstellen einer Matrix\n",
" ```python\n",
" from sympy import Matrix\n",
" A = Matrix([[1, 2], [3, 4]])\n",
" ```\n",
"\n",
"2. **Determinante**\n",
"\n",
" - `det(A)`: Determinante einer Matrix\n",
" ```python\n",
" A.det()\n",
" ```\n",
"\n",
"3. **Inverses einer Matrix**\n",
" - `inv(A)`: Inverse der Matrix `A`\n",
" ```python\n",
" A.inv()\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Grenzwerte und Limes**\n",
"\n",
"1. **Grenzwert (Limit)**\n",
"\n",
" - `limit(f, x, c)`: Grenzwert von `f` für `x → c`\n",
" ```python\n",
" from sympy import limit\n",
" limit(f, x, 0)\n",
" ```\n",
"\n",
"2. **Unendlicher Grenzwert**\n",
" - `limit(f, x, oo)`: Grenzwert für `x → ∞`\n",
" ```python\n",
" limit(f, x, float('inf'))\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Differentialgleichungen**\n",
"\n",
"1. **Lösen von Differentialgleichungen**\n",
" - `dsolve(eq, func)`: Lösen einer gewöhnlichen Differentialgleichung\n",
" ```python\n",
" from sympy import Function, dsolve, Derivative\n",
" f = Function('f')\n",
" dsolve(Derivative(f(x), x) - f(x), f(x))\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Sonstige nützliche Funktionen**\n",
"\n",
"1. **Ganze Zahlen (Modulararithmetik)**\n",
"\n",
" - `mod(x, y)`: Modulo-Operation\n",
" ```python\n",
" from sympy import mod\n",
" mod(x, y)\n",
" ```\n",
"\n",
"2. **Boden- und Deckenfunktion**\n",
" - `floor(x)`: Abrunden auf die nächste ganze Zahl\n",
" ```python\n",
" from sympy import floor\n",
" floor(x)\n",
" ```\n",
" - `ceiling(x)`: Aufrunden auf die nächste ganze Zahl\n",
" ```python\n",
" from sympy import ceiling\n",
" ceiling(x)\n",
" ```\n",
"\n",
"---\n",
"\n",
"### **Zusammenfassung der wichtigsten Funktionen**\n",
"\n",
"| **Funktion** | **SymPy-Befehl** | **Beschreibung** |\n",
"| --------------------------- | --------------------------------------------- | -------------------------------------- |\n",
"| Exponentiation | `exp(x)` | \\( e^x \\) |\n",
"| Trigonometrische Funktionen | `sin(x)`, `cos(x)`, `tan(x)` | Sinus, Kosinus, Tangens |\n",
"| Ableitung | `diff(f, x)` | Ableitung von `f` nach `x` |\n",
"| Integral | `integrate(f, x)` | Unbestimmtes Integral von `f` nach `x` |\n",
"| Summe | `Sum(expression, (variable, start, end))` | Summe über eine Reihe |\n",
"| Produkt | `Product(expression, (variable, start, end))` | Produkt über eine Reihe |\n",
"| Faktorisierung | `factor(f)` | Faktorisierung von `f` |\n",
"| Grenzwert | `limit(f, x, c)` | Grenzwert von `f` für `x → c` |\n",
"| Matrixoperationen | `Matrix([[1, 2], [3, 4]])` | Erstellen von Matrizen |\n",
"| Differentialgleichung lösen | `dsolve(eq, func)` | Lösen von Differentialgleichungen |\n",
"\n",
"---\n",
"\n",
"\n",
"<!--->siehe https://chatgpt.com/share/673b2049-b010-8013-a3d7-9552c03da480</--->\n"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,236 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sympy"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAGFCAYAAABg2vAPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAKuUlEQVR4nO3dT4iV9R7H8e+55sqTgX8ClWAkqVChhS4UEVyICobWwqiFQS4UUWgTCjo0R/yDmxbiQhCTwZ0xrhTdhJOEYojRKmylIjjgH1RKQxw8d3FpwquXnJzT8fZ5veBsfueZ5/n+zmJ4n/MMZxrtdrtdAECsf3V7AACgu8QAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhx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+3bt4+sPX78uD755JMaN25cffXVV6MKgb/iv0OgqqrZbNbs2bPr2rVrI2uj2cNYazQaHX8dgD+IAeiAadOm1ZYtW+rrr78euRf/7bff1po1a2rjxo21e/fukWM3bNhQQ0NDdfTo0XrllVe6Mu+9e/fqhx9+qDlz5oysjWYPwP83MQAd8vnnn9e0adNq69atdeHChVq1alV9/PHHtW/fvpFjrl69WocOHarvv/++pkyZUs1ms5rNZn333XfPPGe73a7h4eEnHu12+5nro7Fp06a6f//+U+/2n2cPf9eMQAe1gY45fPhwu6raEyZMaH/44Yft4eHhFzrf4OBgu6qe63H58uXnOmdvb2+7qtr79+8fkz2M9Yw3b95sV1W7r6/vufYDjF53PpOEEG+99VZV/eceeH9/f40bN+6Fzjdv3ry6cOHCE2sbNmyo6dOnV19f3xPr06dP/9Pz7dixo3bt2lW7d++uzZs3P/OY0e5hrGcEOk8MQIf8+OOP9d5779WiRYvq7Nmzdfjw4dq0adMLnfPVV1+t+fPnP7U2efLkp9b/zI4dO6rValWr1apt27Y985i/soexnBH4e/ibAeiAn3/+uZYvX14LFy6swcHBWr16dbVarbp37163R6uqqp07d1ar1are3t6n3q3/7mXfAzB2xACMsStXrtTSpUvr7bffrmPHjtX48eNr7969defOndqzZ0+3x6svv/yyvvjii1qxYkWtXLmyzp8//8Sj6uXYw6lTp2pgYKCOHz9eVVU//fRTDQwM1MDAgP/dAGPMlw7BGBoaGqrFixfXa6+9VoODgzVx4sSR59avX19HjhypS5cuVU9Pz5hdc7Rf6LNkyZI6c+bM/3z++vXrY76H0c5YVdXT01NXr1595nOXL18e09cQ0okBAAjnNgEAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABBODABAODEAAOHEAACEEwMAEE4MAEA4MQAA4cQAAIQTAwAQTgwAQDgxAADhxAAAhBMDABDu3/AkdJMFQJALAAAAAElFTkSuQmCC",
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"from sympy import symbols, latex\n",
"\n",
"x = symbols('x')\n",
"expr = x**2 + 2*x + 1\n",
"\n",
"# LaTeX-String erstellen\n",
"latex_code = latex(expr)\n",
"\n",
"# Plot erstellen\n",
"plt.text(0.5, 0.5, f\"${latex_code}$\", fontsize=12, ha='center')\n",
"plt.axis('off')\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x^{2} + 2 x + 1\n"
]
}
],
"source": [
"from sympy import symbols, latex\n",
"\n",
"x = symbols('x')\n",
"expr = x**2 + 2*x + 1\n",
"\n",
"# LaTeX-String erzeugen\n",
"latex_code = latex(expr)\n",
"print(latex_code)\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3 x^{2} + 2\n",
"\\frac{x^{4}}{4} + x^{2} + x\n"
]
}
],
"source": [
"from sympy import diff, integrate, symbols, latex\n",
"\n",
"x = symbols('x')\n",
"f = x**3 + 2*x + 1\n",
"\n",
"# Ableitung\n",
"derivative = diff(f)\n",
"print(latex(derivative)) # Ausgabe: 3 x^{2} + 2\n",
"\n",
"# Integral\n",
"integral = integrate(f)\n",
"print(latex(integral)) # Ausgabe: \\frac{x^{4}}{4} + x^{2} + x\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$\n",
"3 x^{2} + 2\n",
"\\frac{x^{4}}{4} + x^{2} + x\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-2\n",
"2\n"
]
}
],
"source": [
"from sympy import solve\n",
"\n",
"eq = x**2 - 4\n",
"solution = solve(eq)\n",
"\n",
"# Lösungen anzeigen\n",
"for sol in solution:\n",
" print(latex(sol)) # Ausgabe: -2 und 2\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAEsAAAAUCAYAAADFlsDIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAABJ0AAASdAHeZh94AAACB0lEQVR4nO3YvWsVQRTG4SeawlJQsLAQOwvjfyBEAoIIgko6NVoLIWAhCHJyBMFGxUoLIWksrSSijSbYCYKgiApCsFBR0UII4lcs7r26Jjfxfmw2V/BtZnZmmN/Zd2dnd07f/Py8/2pNa1Y7gH9J/Y1KZg7ibqHvWURsqzqg1VZmbsS7YltE9FEwq6AZTON9yUFswH7sxQA24wseYQITEfGjTGaH3DlkvX4UWxodzcyajojxsoPGMC7jtdoKfolNOICr2JOZwxFR9ibaFjci5jDOr7dtWbNWSs+xD1PFJ5mZp3AfB9Vu4HqvciszKyLuLNH+JjOv4CwGlWxWmdxe+Rp+rZffepm76mZlZj+O1C9v9TJ31c3COWzHzYi43cvclveszJxV+DK0oGsRcegvc47iBJ7icBtzd6VOue1s8C/wuY3xr5brzMzjuIQnGIqID23M3bG64bZsVkQMdRBbU2XmGC7isVrAb8uaeyW5le9ZmXlSLeCH2FWhUV1zq/wplZmncQYPsLuVVyAzJzGCYxExWRW3mSozKzNH1AL+jnsYzcyFw2abGNJY/R39g3XBXaQqV9bWerkWY0uMmcHkgrYBfMJUxdxFqvK4M65+QG1VmbkeO3A+Ij5WxV1KzcyKzAy9kc/aqXYkuVAVsFk+q6GiWbN+53EoOZ/ViSLiBtZVjC3ms/7QTx5045MkGXPbAAAAAElFTkSuQmCC",
"text/latex": [
"$\\displaystyle \\left[ -2, \\ 2\\right]$"
],
"text/plain": [
"[-2, 2]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sympy import symbols, solve, init_printing\n",
"from IPython.display import display\n",
"\n",
"# SymPy-Darstellung aktivieren\n",
"init_printing()\n",
"\n",
"x = symbols('x')\n",
"eq = x**2 - 4\n",
"\n",
"# Gleichung lösen und anzeigen\n",
"solutions = solve(eq)\n",
"display(solutions)\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout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WYS7s3MmUpLcTo2we3V2rNxdkQMqxdk5g14HPOUaLwMAzGlmh+Ep3B9REzJzLfwdmbuHREvNZP+2tX4Yw/G1/R1ephv4y4coDhtoNLr3IEtlF5peMOIXZV/87GImFA7CyLi99oY7NoUEBEPYKxSzd7G3ji4bgWUwjBUV2yG+5Ve7GElineLiLlV4n8GT0TEVZWMd5SqeQ1968MGVGNHd6mIyBbpPZyRmT9jHCYq4Q7nVPv/UnXibWzf0qEp5zalWHWnw8RKTpM2qhedv8M23dCPqn83HVZH0Nq6x1otvuXF7YrD9mnQRlTjMctYO6+fsvuNpsM+qsYhPfDWVaSnHNcp6oozkCVJdwOlGOzbz73/djRzWF0lRmRmu6FdE3viV6Uz7g92r8bZ1Vgfs/X7ue8/giWOiYjPlGvFFjirxZdKRNzT7MEyc3BmDsvMVbswZ27X7Jwb9EG4pXq9r5L7q9JubJuZh3enZGbuVbUdKxztpD8ar+KmzDwAHyqVaT/lKF7S4n9OuS9uqTS8NY7ERZk5HZ/jJwzGIVhDKdvN69F4PImpmfms4sCVsKlyX1w1Ipb1BeIfQZejV0XZzrhbcdQ4xdCbsHtEfNvhvtPxiOLIY5WvCvviZaX5PDQiFjbk1hfmqUr7MUa5722DZ5W77b8CA/7/4to3/Kc/IK4I/AXg3nrQh3yL0AAAAABJRU5ErkJggg==",
"text/latex": [
"$\\displaystyle 0.5 e^{0.5 x}$"
],
"text/plain": [
" 0.5⋅x\n",
"0.5⋅ℯ "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sympy import symbols, diff, exp, init_printing\n",
"from IPython.display import display\n",
"init_printing()\n",
"\n",
"# Symbol für die Variable x definieren\n",
"x = symbols('x')\n",
"\n",
"# Funktion definieren: f(x) = e^(0.5x)\n",
"f = exp(0.5 * x)\n",
"\n",
"# Ableitung berechnen\n",
"f_derivative = diff(f, x)\n",
"\n",
"# Ergebnis anzeigen\n",
"print(f\"Ableitung von f(x) = {f}:\")\n",
"print(f_derivative)\n",
"display(f_derivative)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (Nix)",
"language": "python",
"name": "nix-python"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,12 +1,22 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
packages = [
pkgs.typst
pkgs.typstyle
pkgs.tinymist
pkgs.tdf
pkgs.agebox
pkgs.mermaid-cli
packages = with pkgs; [
typst
typstyle
tinymist
tdf
agebox
mermaid-cli
# for math
python312
python312Packages.sympy
python312Packages.numpy
python312Packages.matplotlib
python312Packages.scipy
python312Packages.pandas
python312Packages.jupyter
python312Packages.ipykernel
];
}