{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6fb7a41f-327c-4314-9ff0-1f1cab1ec91d",
   "metadata": {},
   "source": [
    "# Vorlesung 20.10.2026"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "3b4680fb-f1d5-4724-8cd3-dc66efbb7803",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:39:41.662189Z",
     "iopub.status.busy": "2026-10-20T06:39:41.661894Z",
     "iopub.status.idle": "2026-10-20T06:39:41.665800Z",
     "shell.execute_reply": "2026-10-20T06:39:41.664895Z",
     "shell.execute_reply.started": "2026-10-20T06:39:41.662163Z"
    }
   },
   "outputs": [],
   "source": [
    "def g(x):\n",
    "    return 0.5 * x + 0.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "eda6ab69-c917-4531-b5d7-085cf966bce7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:39:42.815378Z",
     "iopub.status.busy": "2026-10-20T06:39:42.815140Z",
     "iopub.status.idle": "2026-10-20T06:39:42.819565Z",
     "shell.execute_reply": "2026-10-20T06:39:42.818584Z",
     "shell.execute_reply.started": "2026-10-20T06:39:42.815355Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.0\n"
     ]
    }
   ],
   "source": [
    "print(g(1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "0d9deeec-3ba8-43a3-a45d-2995ad78babc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:39:43.054607Z",
     "iopub.status.busy": "2026-10-20T06:39:43.054380Z",
     "iopub.status.idle": "2026-10-20T06:39:43.058903Z",
     "shell.execute_reply": "2026-10-20T06:39:43.058121Z",
     "shell.execute_reply.started": "2026-10-20T06:39:43.054584Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.0"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "2badc4b6-ab99-4c94-9c82-8bb6e7adedd1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T07:08:58.558481Z",
     "iopub.status.busy": "2026-10-20T07:08:58.558050Z",
     "iopub.status.idle": "2026-10-20T07:08:58.564056Z",
     "shell.execute_reply": "2026-10-20T07:08:58.563003Z",
     "shell.execute_reply.started": "2026-10-20T07:08:58.558430Z"
    }
   },
   "outputs": [],
   "source": [
    "def h(x):\n",
    "    \"\"\"Das ist unsere geknickte Geradenfunktion.\"\"\"\n",
    "    if x < 5:\n",
    "        return 0.5 * x + 0.5\n",
    "    else:\n",
    "        return 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "4bfd076e-b34b-4d8f-b80f-415a14cba548",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T07:06:44.435469Z",
     "iopub.status.busy": "2026-10-20T07:06:44.398409Z",
     "iopub.status.idle": "2026-10-20T07:07:48.558201Z",
     "shell.execute_reply": "2026-10-20T07:07:48.555277Z",
     "shell.execute_reply.started": "2026-10-20T07:06:44.432571Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "81a235c2-d2da-43d4-bb7e-6fd63ad5f938",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:49:01.298738Z",
     "iopub.status.busy": "2026-10-20T06:49:01.298448Z",
     "iopub.status.idle": "2026-10-20T06:49:01.303111Z",
     "shell.execute_reply": "2026-10-20T06:49:01.302180Z",
     "shell.execute_reply.started": "2026-10-20T06:49:01.298713Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function h in module __main__:\n",
      "\n",
      "h(x)\n",
      "    Das ist unsere geknickte Geradenfunktion.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(h)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "7bb53594-8288-4cd2-86e2-6c2cd31c9a67",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:49:04.061594Z",
     "iopub.status.busy": "2026-10-20T06:49:04.061348Z",
     "iopub.status.idle": "2026-10-20T06:49:04.065078Z",
     "shell.execute_reply": "2026-10-20T06:49:04.064122Z",
     "shell.execute_reply.started": "2026-10-20T06:49:04.061569Z"
    }
   },
   "outputs": [],
   "source": [
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "ae46df34-5e1a-4e97-8a90-4a14ee803c02",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:50:39.514857Z",
     "iopub.status.busy": "2026-10-20T06:50:39.514604Z",
     "iopub.status.idle": "2026-10-20T06:50:39.519252Z",
     "shell.execute_reply": "2026-10-20T06:50:39.518238Z",
     "shell.execute_reply.started": "2026-10-20T06:50:39.514832Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function sin in module math:\n",
      "\n",
      "sin(x, /)\n",
      "    Return the sine of x (measured in radians).\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(math.sin)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "df4965d5-3aba-4bcf-8fb7-2c78a3e9eb79",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:56:46.091688Z",
     "iopub.status.busy": "2026-10-20T06:56:46.091394Z",
     "iopub.status.idle": "2026-10-20T06:56:46.096488Z",
     "shell.execute_reply": "2026-10-20T06:56:46.095591Z",
     "shell.execute_reply.started": "2026-10-20T06:56:46.091662Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.8939966636005579"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.sin(90)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "12fe6c79-30a1-445a-9cb0-a506ee2e122b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T07:00:42.414111Z",
     "iopub.status.busy": "2026-10-20T07:00:42.413838Z",
     "iopub.status.idle": "2026-10-20T07:00:42.418235Z",
     "shell.execute_reply": "2026-10-20T07:00:42.417217Z",
     "shell.execute_reply.started": "2026-10-20T07:00:42.414086Z"
    }
   },
   "outputs": [],
   "source": [
    "def bogenmass(alpha):\n",
    "    return math.pi / 180 * alpha"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "4f6d7378-2e0b-4ffe-804f-9a25d8a11b0a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T07:00:58.662458Z",
     "iopub.status.busy": "2026-10-20T07:00:58.662183Z",
     "iopub.status.idle": "2026-10-20T07:00:58.667245Z",
     "shell.execute_reply": "2026-10-20T07:00:58.666325Z",
     "shell.execute_reply.started": "2026-10-20T07:00:58.662433Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "math.sin(bogenmass(90))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "0fb20e32-e54a-4820-9f02-109e1976175b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T07:02:09.744374Z",
     "iopub.status.busy": "2026-10-20T07:02:09.744099Z",
     "iopub.status.idle": "2026-10-20T07:02:09.748031Z",
     "shell.execute_reply": "2026-10-20T07:02:09.746997Z",
     "shell.execute_reply.started": "2026-10-20T07:02:09.744348Z"
    }
   },
   "outputs": [],
   "source": [
    "# 3.785 liter = 1 gallone"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "edb49114-9395-4f34-8488-9171843ef436",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T07:03:31.758126Z",
     "iopub.status.busy": "2026-10-20T07:03:31.757856Z",
     "iopub.status.idle": "2026-10-20T07:03:31.761990Z",
     "shell.execute_reply": "2026-10-20T07:03:31.760937Z",
     "shell.execute_reply.started": "2026-10-20T07:03:31.758101Z"
    }
   },
   "outputs": [],
   "source": [
    "def gallonen_in_liter(gallonen):\n",
    "    return gallonen * 3.785"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "3db1bc83-640f-48f8-b514-f9fc5ff30e81",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T07:03:37.474054Z",
     "iopub.status.busy": "2026-10-20T07:03:37.473801Z",
     "iopub.status.idle": "2026-10-20T07:03:37.478869Z",
     "shell.execute_reply": "2026-10-20T07:03:37.477757Z",
     "shell.execute_reply.started": "2026-10-20T07:03:37.474030Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "15.14"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gallonen_in_liter(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "bad097ad-648e-4fe7-9268-4f55dffde270",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:42:49.976889Z",
     "iopub.status.busy": "2026-10-20T06:42:49.976584Z",
     "iopub.status.idle": "2026-10-20T06:42:49.981852Z",
     "shell.execute_reply": "2026-10-20T06:42:49.980699Z",
     "shell.execute_reply.started": "2026-10-20T06:42:49.976835Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "faee5152-1b43-4c0a-a881-55ec0d5154c0",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:42:53.614000Z",
     "iopub.status.busy": "2026-10-20T06:42:53.613744Z",
     "iopub.status.idle": "2026-10-20T06:42:53.618877Z",
     "shell.execute_reply": "2026-10-20T06:42:53.617959Z",
     "shell.execute_reply.started": "2026-10-20T06:42:53.613975Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2.0"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "b329c1a9-5245-4178-9415-e0f3c854c579",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-10-20T06:42:59.294529Z",
     "iopub.status.busy": "2026-10-20T06:42:59.294381Z",
     "iopub.status.idle": "2026-10-20T06:42:59.298673Z",
     "shell.execute_reply": "2026-10-20T06:42:59.298023Z",
     "shell.execute_reply.started": "2026-10-20T06:42:59.294516Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h(7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "06b142d3-a3f3-4ec0-8640-249a957ca582",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "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.13.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
