Solving a linear Equation with multiple variables serversite for a webapp? Possible with php?
I have a gerneral question on php. Hope its ok to ask here.
How would you solve a linear Equation with multiple variables in the web? maybe using Gaussian elimination or ... ? Is it possible with php and recommendable?
1500 + 100 w = 10,000 s
3000 + 1000 s 开发者_开发技巧 = 3000 w
5000 + 2000 s + 100 w + 30 r = 150 r
=> s = 0,16 | w = 1,05 | r = 45,21
It doesn't really matter whether you're doing it on the web or not, it's the same sort of thing. Gaussian elimination (possibly with some pivoting) is what comes to mind, having been the first unit of my numerical analysis course.
I assume PHP has at least one-dimensional arrays and floating-point numbers, so it should work. Obviously, C or Fortran would give you better performance, if that's an issue.
See Looking for actively maintained matrix math library for php
精彩评论