![]() |
I need a help to solve equations system - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: I need a help to solve equations system (/thread-9919.html) |
I need a help to solve equations system - alizo_as - May-04-2018 I have this code bellow from __future__ import division import numpy as np from sympy import * t, r = symbols('t, r') A = np.matrix(input("Insert Matrix nxn: ")) n = A.shape[1] C = MatrixSymbol('P', n, n) D = np.multiply(A,C) SomP = D.sum(axis=1) F = np.multiply(A,C) for j in range(n): for k in range(n): if D[j,k]!=0: F[j,k] = D[j,k] - t*(SomP[k] - D[k,j]) - r*D[k,j] print F[j,k]and, for example, giving the matrix [[0,1,1],[1,0,1],[1,1,0]], I get this equations: [[-r*P[1, 0] - t*P[1, 2] + P[0, 1]]] [[-r*P[2, 0] - t*P[2, 1] + P[0, 2]]] [[-r*P[0, 1] - t*P[0, 2] + P[1, 0]]] [[-r*P[2, 1] - t*P[2, 0] + P[1, 2]]] [[-r*P[0, 2] - t*P[0, 1] + P[2, 0]]] [[-r*P[1, 2] - t*P[1, 0] + P[2, 1]]] How do I solve this system of equations F[j,k]? RE: I need a help to solve equations system - Gribouillis - May-04-2018 In what sense are the F[j, k] a system of equations? I only see a set of coefficients depending on r, t and the coefficients of P. What are the unknowns? Can you also describe the mathematical problem that you are trying to solve? |