6 variables equation

Mathematics about graphical computing
ahmedatef87
Posts: 3
Joined: Thu Jan 16, 2014 3:11 pm

6 variables equation

Postby ahmedatef87 » Fri Jan 17, 2014 11:54 am

Hello, i would like to ask about a complicated mathematical model if it is valid for pynomo
1 unknown: y
5 variables: x1, x2, x3, x4, x5

equation:

y= x1* (a*x1 +b* x2 + c* x3 + d* x4+ e* x5+ f) + x2* (g*x2+h*x3 + i*x4 + j*x5 + k) + X3* (L*x3 +m*x4 + n*x5 + o) + x4* (p*x4 + q*x5 + r) + x5* (s*x5+t) + u

from a to u are constants
Leif
Posts: 55
Joined: Mon Dec 31, 2007 3:03 pm
Location: Finland
Contact:

Re: 6 variables equation

Postby Leif » Sat Jan 18, 2014 9:15 am

Hello,

I think this is tough question. Equation is possible to cast into nomographic form if it can be turned into determinant of matrix equals zero, where each row of matrix has functions of only one or two variables. In your case this could be three-grid nomograph and a determinant of matrix:

[f1, g1, h1],
[f2, g2, h2],
[f3, g3, h3]

where for example functions f1,g1 and h1 are functions of x1,x2, etc.

I wrote small script to build this general determinant form with python and sympy. Just uncomment to see some terms. It is to be noted that each term has in the end quite a sum of coefficients. For example the last line:

detr.coeff(x1,1).coeff(x2,1)

print coefficients of x1*x2 term (your b) and result here reproduced is:

f1_0*g2_0*h3_3 + f1_0*g2_1*h3_2 + f1_0*g2_2*h3_1 + f1_0*g2_3*h3_0 - f1_0*g3_0*h2_3 - f1_0*g3_1*h2_2 - f1_0*g3_2*h2_1 - f1_0*g3_3*h2_0 + f1_1*g2_0*h3_2 + f1_1*g2_2*h3_0 - f1_1*g3_0*h2_2 - f1_1*g3_2*h2_0 + f1_2*g2_0*h3_1 + f1_2*g2_1*h3_0 - f1_2*g3_0*h2_1 - f1_2*g3_1*h2_0 + f1_3*g2_0*h3_0 - f1_3*g3_0*h2_0 - f2_0*g1_0*h3_3 - f2_0*g1_1*h3_2 - f2_0*g1_2*h3_1 - f2_0*g1_3*h3_0 + f2_0*g3_0*h1_3 + f2_0*g3_1*h1_2 + f2_0*g3_2*h1_1 + f2_0*g3_3*h1_0 - f2_1*g1_0*h3_2 - f2_1*g1_2*h3_0 + f2_1*g3_0*h1_2 + f2_1*g3_2*h1_0 - f2_2*g1_0*h3_1 - f2_2*g1_1*h3_0 + f2_2*g3_0*h1_1 + f2_2*g3_1*h1_0 - f2_3*g1_0*h3_0 + f2_3*g3_0*h1_0 + f3_0*g1_0*h2_3 + f3_0*g1_1*h2_2 + f3_0*g1_2*h2_1 + f3_0*g1_3*h2_0 - f3_0*g2_0*h1_3 - f3_0*g2_1*h1_2 - f3_0*g2_2*h1_1 - f3_0*g2_3*h1_0 + f3_1*g1_0*h2_2 + f3_1*g1_2*h2_0 - f3_1*g2_0*h1_2 - f3_1*g2_2*h1_0 + f3_2*g1_0*h2_1 + f3_2*g1_1*h2_0 - f3_2*g2_0*h1_1 - f3_2*g2_1*h1_0 + f3_3*g1_0*h2_0 - f3_3*g2_0*h1_0

So there is quite a task to find your variables a,b,c,... from variables f1_0,... if possible. It is interesting if this solves out.

br,

\leif

Code: Select all

from sympy import *
x1,x2,x3,x4,x5,x6 = symbols("x1,x2,x3,x4,x5,x6")
f1,f2,f3,g1,g2,g3,h1,h2,h3 = symbols("f1,f2,f3,g1,g2,g3,h1,h2,h3")
#f1
f1_0,f1_1,f1_2,f1_3,f1_4,f1_5 = symbols("f1_0,f1_1,f1_2,f1_3,f1_4,f1_5")
f1=f1_0+f1_1*x1+f1_2*x2+f1_3*x1*x2+f1_4*x1**2+f1_5*x2**2
#g1
g1_0,g1_1,g1_2,g1_3,g1_4,g1_5 = symbols("g1_0,g1_1,g1_2,g1_3,g1_4,g1_5")
g1=g1_0+g1_1*x1+g1_2*x2+g1_3*x1*x2+g1_4*x1**2+g1_5*x2**2
#h1
h1_0,h1_1,h1_2,h1_3,h1_4,h1_5 = symbols("h1_0,h1_1,h1_2,h1_3,h1_4,h1_5")
h1=h1_0+h1_1*x1+h1_2*x2+h1_3*x1*x2+h1_4*x1**2+h1_5*x2**2

#f2
f2_0,f2_1,f2_2,f2_3,f2_4,f2_5 = symbols("f2_0,f2_1,f2_2,f2_3,f2_4,f2_5")
f2=f2_0+f2_1*x1+f2_2*x2+f2_3*x1*x2+f2_4*x1**2+f2_5*x2**2
#g2
g2_0,g2_1,g2_2,g2_3,g2_4,g2_5 = symbols("g2_0,g2_1,g2_2,g2_3,g2_4,g2_5")
g2=g2_0+g2_1*x1+g2_2*x2+g2_3*x1*x2+g2_4*x1**2+g2_5*x2**2
#h2
h2_0,h2_1,h2_2,h2_3,h2_4,h2_5 = symbols("h2_0,h2_1,h2_2,h2_3,h2_4,h2_5")
h2=h2_0+h2_1*x1+h2_2*x2+h2_3*x1*x2+h2_4*x1**2+h2_5*x2**2

#f3
f3_0,f3_1,f3_2,f3_3,f3_4,f3_5 = symbols("f3_0,f3_1,f3_2,f3_3,f3_4,f3_5")
f3=f3_0+f3_1*x1+f3_2*x2+f3_3*x1*x2+f3_4*x1**2+f3_5*x2**2
#g3
g3_0,g3_1,g3_2,g3_3,g3_4,g3_5 = symbols("g3_0,g3_1,g3_2,g3_3,g3_4,g3_5")
g3=g3_0+g3_1*x1+g3_2*x2+g3_3*x1*x2+g3_4*x1**2+g3_5*x2**2
#h3
h3_0,h3_1,h3_2,h3_3,h3_4,h3_5 = symbols("h3_0,h3_1,h3_2,h3_3,h3_4,h3_5")
h3=h3_0+h3_1*x1+h3_2*x2+h3_3*x1*x2+h3_4*x1**2+h3_5*x2**2


""" #uncomment to see functions in matrix
print f1
print g1
print h1
print f2
print g2
print h2
print f3
print g3
print h3
"""
matr = Matrix([[f1,g1,h1],[f2,g2,h2],[f3,g3,h3]])
detr = matr.det().expand(basic=True)
#print matr #uncomment to see matrix
#print detr #uncomment to see determinant
detr.coeff(x1,1).coeff(x2,1)
ahmedatef87
Posts: 3
Joined: Thu Jan 16, 2014 3:11 pm

Re: 6 variables equation

Postby ahmedatef87 » Sat Jan 18, 2014 12:04 pm

thank you so much. i have already tried a lot to do that but i couldn't. i think i have to simplify the equation as much as possible.
Leif
Posts: 55
Joined: Mon Dec 31, 2007 3:03 pm
Location: Finland
Contact:

Re: 6 variables equation

Postby Leif » Sat Jan 18, 2014 3:33 pm

Are you trying to make nomograph of some specific equation or just work a very general case?

If you have a specific equation as polynomial approximation, it could be easier to use the original equation. If you could post the original equation here (or with email if you want to limit the audience)?

br,

\leif
Last edited by Leif on Sat Jan 18, 2014 8:55 pm, edited 1 time in total.
ahmedatef87
Posts: 3
Joined: Thu Jan 16, 2014 3:11 pm

Re: 6 variables equation

Postby ahmedatef87 » Sat Jan 18, 2014 8:45 pm

i have about 150,000 readings of 6 variables. i used SYSTAT to predict a suitable equation with the highest possible R^2 value. there was no reference equation for me
Leif
Posts: 55
Joined: Mon Dec 31, 2007 3:03 pm
Location: Finland
Contact:

Re: 6 variables equation

Postby Leif » Sun Jan 19, 2014 9:29 am

One possibility to try is to fit your data to the nomographic matrix form. In my script there were 9X6=36 variables to tune (for example f1_0,f1_1,f1_2,f1_3,f1_4,f1_5, etc.). One could pick up some (clever) set from these variables and to try to fit data to tune them.

br,

\leif

Return to “Mathematics”

Who is online

Users browsing this forum: No registered users and 2 guests