Files
Komplexe-Zahlen/Vektoren.ipynb
2026-03-14 21:05:34 +01:00

73 lines
1.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2026-02-26T09:09:10.857495Z",
"start_time": "2026-02-26T09:09:10.808456Z"
}
},
"source": [
"def add(v1, v2):\n",
" return (v1[0] + v2[0], v1[1] + v2[1])\n",
"\n",
"def sub(v1, v2):\n",
" return (v1[0] - v2[0], v1[1] - v2[1])\n",
"\n",
"def mul(k, v):\n",
" return (k*v[0], k*v[1])\n",
"\n",
"print(add((2, 1), (3, 4)))\n",
"print(sub((20,30),(40,20)))\n",
"print(mul(3,(20, 10)))\n",
"print(mul(-1,(20, 10)))"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(5, 5)\n",
"(-20, 10)\n",
"(60, 30)\n",
"(-20, -10)\n"
]
}
],
"execution_count": 2
},
{
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": "",
"id": "2a2788932fa811f7"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}