Last active
November 25, 2015 00:42
-
-
Save marceloboeira/5ee382a6b49735548102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
meshes = input("Number of meshes: ") | |
voltage = zeros(meshes) | |
resistence = zeros((meshes, meshes)) | |
for i in range(meshes): | |
voltage[i] = input("Voltage of mesh %d: " % i) | |
resistence[i][i] = input("Resistence of mesh %d: " % i) | |
for i in range(meshes): | |
for j in range(meshes): | |
if i != j: | |
resistence[i][j] = -input("Resistence between mesh %d and %d: " % (i, j)) | |
result = dot(linalg.inv(resistence), voltage) | |
print result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment