{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lleis de Kirchhoff" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from sympy import *\n", "x, y, z = symbols(\"x y z\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1) \n", "Trobar $I_{1}$, $I_{2}$ i $I_{3}$ \n", "Dades: $R_{1} = 2 \\ \\Omega$, $R_{2} = 6 \\ \\Omega$, $R_{3} = 4 \\ \\Omega$. $\\mathcal{E}_{1} = 5 \\ V$, $\\mathcal{E}_{2} = 12 \\ V$ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](img/Kirchhoff1.png)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{x: 1/22, y: -13/11, z: -27/22}" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "solve([Eq(x+z-y, 0), Eq(6*y+2*x,-7 ), Eq(-4*z-6*y,12 )],[x,y,z])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0.045454545454545456, -1.1818181818181819, -1.2272727272727273)" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "1/22, -13/11, -27/22" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2) \n", "Trobar $I_{1}$, $I_{2}$ i $I_{3}$ \n", "Dades: $R_{1} = 1 \\ \\Omega$, $R_{2} = 4 \\ \\Omega$, $R_{3} = 2 \\ \\Omega$. $\\mathcal{E}_{1} = 12 \\ V$, $\\mathcal{E}_{2} = 5 \\ V$, $\\mathcal{E}_{3} = 7 \\ V$, $r = 1 \\ \\Omega$ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](img/Kirchhoff2.png)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{x: 146/31, y: 47/31, z: -99/31}" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "solve([Eq(x+z-y, 0), Eq(5*y+2*x,17 ), Eq(-3*z-5*y,2 )],[x,y,z])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(4.709677419354839, 1.5161290322580645, -3.193548387096774)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "146/31 , 47/31 , -99/31" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3) \n", "Trobar $I_{1}$, $I_{2}$ i $I_{3}$ \n", "Dades: $R_{1} = 10 \\ \\Omega$, $R_{2} = 3 \\ \\Omega$, $R_{3} = 6 \\ \\Omega$. $\\mathcal{E}_{1} = 5 \\ V$, $\\mathcal{E}_{2} = 6 \\ V$, $\\mathcal{E}_{3} = 12 \\ V$, $r_{1} = 1 \\ \\Omega$, $r_{2} = 3 \\ \\Omega$, $r_{3} = 2 \\ \\Omega$ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](img/Kirchhoff3.png)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{x: 95/101, y: -11/101, z: -84/101}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "solve([Eq(x+y+z, 0), Eq(-6*y+11*x,11 ), Eq(-8*z+6*y,6 )],[x,y,z])" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0.9405940594059405, -0.10891089108910891, -0.8316831683168316)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "95/101,-11/101,-84/101" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4) \n", "Trobar $I_{1}$, $I_{2}$ i $I_{3}$ \n", "Dades: $R_{1} = 7 \\ \\Omega$, $R_{2} = 12 \\ \\Omega$, $R_{3} = 4 \\ \\Omega$. $\\mathcal{E}_{1} = 5 \\ V$, $\\mathcal{E}_{2} = 3 \\ V$, $\\mathcal{E}_{3} = 12 \\ V$, $\\mathcal{E}_{4} = 12 \\ V$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](img/Kirchhoff4.png)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{x: 67/40, y: 23/160, z: 291/160}" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "solve([Eq(x+y-z, 0), Eq(12*y-7*x,-10 ), Eq(-4*z-12*y,-9 )],[x,y,z])" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(1.675, 0.14375, 1.81875)" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "67/40,23/160,291/160" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5) \n", "Trobar $I_{1}$, $I_{2}$ i $I_{3}$ \n", "Dades: $R_{1} = 8 \\ \\Omega$, $R_{2} = 12 \\ \\Omega$, $R_{3} = 5 \\ \\Omega$, $R_{4} = 2 \\ \\Omega$. $\\mathcal{E}_{1} = 12 \\ V$, $\\mathcal{E}_{2} = 5 \\ V$, $\\mathcal{E}_{3} = 7 \\ V$, $r = 1 \\ \\Omega$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](img/Kirchhoff5.png)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{x: 65/209, y: -40/209, z: -105/209}" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "solve([Eq(x+z-y, 0), Eq(13*y+8*x,0 ), Eq(-5*z-13*y,5 )],[x,y,z])" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0.31100478468899523, -0.19138755980861244, -0.5023923444976076)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "65/209, -40/209,-105/209" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }