solving equations
Rate this page : |
[ 0 votes]
|
Following are the steps to solve any two linear equations using javascript:1. Change the linear equations into array notation example: eq1 => 5x 4y = 33 eq2 => 6x 2y = 13 will be,//first equation var eq1 = new Array(3); eq1[0]=5; eq1[1]=4; eq1[2]=33;//second equation var eq2 = new Array(3); eq2[0]=6; eq2[1]=2; eq2[2]=13; 2. Add the 'solveEqns' and 'findDeter' functions in your code and call the above 'solveEqns' function and store the result in an array. var ans = new Array(2); ans=solveEqns(eq1,eq2);3. Show the x value and y value document.write("x= " ans[0] "
y= " ans[1]);