4
Answers

solving 3 equations with 3 unknowns

johnny_yammine

johnny_yammine

20y
3.1k
1
How can i solve three equations with three unknows in C#, in matlab for example i use the fsolve, is there exist such a function in C#. the equations are the following: a(1)*vecx(1)+a(2)*vecx(2)+a(3)*vecx(3) ; a(1)*((Y1(4)*z(2))-(Y1(2)*z(4)))-a(2)*((X1(4)*z(2))-(X1(2)*z(4))) +a(3)*((X1(4)*Y1(2))-(X1(2)*Y1(4))); a(1)^2+a(2)^2+a(3)^2-1; with a(1), a(2) and a(3) are the unknowns. thank you
Answers (4)
0
johnny_yammine

johnny_yammine

NA 8 0 20y
Thank you a lot for your help and especially to abdallah, i search for the algorithm and i think i get e clear explanation about it and also an algorithm. thank you
0
abdullah

abdullah

NA 111 0 20y
first you have to choose a way (algorithm) for solving the equations...... then put this algorithm as a method that take 3 parameters>>>> maybe the 4 arrays or 4 vectors ....Representing the 3 Equations and the Constants.... Equations in the form of....x+y+z= a ; where a in the constant there is a nice algorithm called Gaussian Elimination with Scaled Partial Pivoting.... Search for it .....if you can't find it just reply to me i will try to get it for you........ Good luck......
0
Mykonine

Mykonine

NA 520 0 20y
Sorry for the double post. I need to clear up my last statement. Solving for a system of degree two or higher gets very messy, very quickly, especially when you're trying to program it. Your best options in that case would be a brute force solution via graphing or to simply do it by hand.
0
Mykonine

Mykonine

NA 520 0 20y
If you mean a three-variable three equation linear system, make an augmented matrix, and solve it via matrix determinants or the Gauss-Jordan method, one of the two. Hard to explain here. Look around online for "augmented matrix" and you should be able to find plenty of info. If you mean systems of three unknowns where the degree of the equations exceeds 1, then I'd give up for now.
Next Recommended Forum