Solving a linear Equation with multiple variables serversite for a webapp? Possible with php?

StackOverflow https://stackoverflow.com/questions/4547688

  •  13-10-2019
  •  | 
  •  

Question

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top