Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 I need a help to solve equations system
#1
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]?
buran wrote May-04-2018, 03:11 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Quote
#2
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?
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Solve a system of non-linear equations in Python (scipy.optimize.fsolve) drudox 7 9,052 Aug-18-2018, 02:27 AM
Last Post: scidam
  Euler class for solve System of ODE drudox 0 715 Jul-08-2018, 09:31 PM
Last Post: drudox

Forum Jump:


Users browsing this thread: 1 Guest(s)