Vote count:
0
i need to set up a system of linear equations and solve it. The calculations are based on a graph and are always of the same format. I need ideas how to solve my problem efficiently...
At first I create all necessary equations. Here is an example:
q = 4,9 + r
r = 2,3 + 0,03q + 0,11d + 0,85(1 + r)
d = 15,3 + 0,02q + 0,74r
This step is already done. My program creates this formulas. My problem is now, what is the most efficient way to calculate the values? I need to prepare the equations to be able to use them in a matrix solver. Hence, i have to eliminate the brackets and combine the values...
I thought of combining multiple java libraries to reach the goal. At first I wanted to use a simplifier to simplify all equations and finally a matrix solver to calculate the values. Here are my thoughts:
Step 1: Eliminate brackets if necessary)
q = 4,9 + r
r = 2,3 + 0,03q + 0,11d + 0,85 + 0.85r
d = 15,3 + 0,02q + 0,74r
Step 2: Combine values)
q = 4,9 + r
r = 3,15 + 0,03q + 0,11d + 0.85r
d = 15,3 + 0,02q + 0,74r
Step 3: Prepare matrix)
-4,9 = -q + r
-3,15 = -r + 0,03q + 0,11d + 0,85r
-15,3 = -d + 0,02q + 0,74r
Step 3.2: Combine values)
-4,9 = -q + r
-3,15 = -0,15r + 0,03q + 0,11d
-15,3 = -d + 0,02q + 0,74r
Step 3.3: Sort values)
-4,9 = -q + r
-3,15 = 0,03q - 0,15r + 0,11d
-15,3 = 0,02q + 0,74r -d
Step 3.4: Matrix structure)
-4,9 = -1 1 0
-3,15 = 0,03 -0,15 0,11
-15,3 = 0,02 0,74 -1
And now I can use a matrix solver like jama. There are several steps that have to be performed. But whats the most efficient way without reinventing the wheel?
Thanks in advance.
Set up system of linear equations and solve
Aucun commentaire:
Enregistrer un commentaire