# Numerical solution of a system of non linear equations 9 equations with 9 unknowns This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi Everyone,
I have a problem similar to the problem of "Numerical solution of a system of non linear equations" similar to the one posted by Francesco. But in my case I have a system of 9 non linear equations with 9 unknowns. I tried to use the same form as the answer which was given to Francesco but I had an error

Traceback (click to the left of this block for traceback)
...
ZeroDivisionError: matrix is numerically singular.


Please could any one figure out what is wrong with the code?

import mpmath

p1=[0,0,0]
p2=[-12,0,0]
p3=[1/24,-17/24*sqrt(287),0]
p4=[-23/8, 1/32*sqrt(119)*sqrt(6)*(sqrt(3) + 3), -1/32*sqrt(119)*sqrt(6)*(sqrt(3) - 3)]
**comment** **coordinates of points are represented as p5=[x5, y5, z5] and the others are represented similarly**
var(" x5 y5 z5 x6 y6 z6 x7 y7 z7")

eq25 = (p2-x5)^2+(p2-y5)^2+(p2-z5)^2-100 == 0
eq46 = (p4-x6)^2+(p4-y6)^2+(p4-z6)^2-121 == 0
eq45 = (p4-x5)^2+(p4-y5)^2+(p4-z5)^2-121 == 0
eq16 = (p1-x6)^2+(p1-y6)^2+(p1-z6)^2-100 == 0
eq27 = (p2-x7)^2+(p2-y7)^2+(p2-z7)^2-144 == 0
eq37 = (p3-x7)^2+(p3-y7)^2+(p3-z7)^2-144 == 0
eq56 = (x6-x5)^2+(y6-y5)^2+(z6-z5)^2-144 == 0
eq67 = (x6-x7)^2+(y6-y7)^2+(z6-z7)^2-100 == 0
eq57 = (x7-x5)^2+(y7-y5)^2+(z7-z5)^2-25 == 0

f= [lambda x5,y5,z5,x6,y6,z6,x7,y7,z7: eq25.lhs().subs(x5=RR(x5), y5=RR(y5), z5=RR(z5), x6=RR(x6), y6=RR(y6), z6=RR(z6), x7=RR(x7), y7=RR(y7), z7=RR(z7)),
lambda x5,y5,z5,x6,y6,z6,x7,y7,z7: eq46.lhs().subs(x5=RR(x5), y5=RR(y5), z5=RR(z5), x6=RR(x6), y6=RR(y6), z6=RR(z6), x7=RR(x7), y7=RR(y7), z7=RR(z7)),
lambda x5,y5,z5,x6,y6,z6,x7,y7,z7: eq45.lhs().subs(x5=RR(x5), y5=RR(y5), z5=RR(z5), x6=RR(x6), y6=RR(y6), z6=RR(z6), x7=RR(x7), y7=RR(y7), z7=RR(z7)),
lambda x5,y5,z5,x6,y6,z6,x7,y7,z7: eq16.lhs().subs(x5=RR(x5), y5=RR(y5), z5=RR(z5), x6=RR(x6), y6=RR(y6), z6=RR(z6), x7=RR(x7), y7=RR(y7), z7=RR(z7)),
lambda x5,y5,z5,x6,y6,z6,x7,y7,z7: eq27.lhs().subs(x5=RR(x5), y5=RR(y5), z5=RR(z5), x6=RR(x6), y6=RR(y6), z6=RR(z6), x7=RR(x7), y7=RR(y7), z7=RR(z7)),
lambda x5,y5,z5,x6,y6,z6,x7,y7,z7: eq37.lhs().subs(x5=RR(x5), y5=RR(y5), z5=RR(z5), x6=RR(x6), y6=RR(y6), z6=RR(z6), x7=RR(x7), y7 ...
edit retag close merge delete