454,722 Members | 1,381 Online Need help? Post your question and get tips & solutions from a community of 454,722 IT Pros & Developers. It's quick & easy.

# Equation

 P: n/a Hello people =) Has somebody a nice script, which can solve equations ? It would be super, if someone has an idea where I can get such a script / code in php. Thanks. Gretting! Jul 17 '05 #1
4 Replies

 P: n/a Sven Dzepina wrote:Hello people =)Has somebody a nice script, which can solve equations ? yes, I do now :-) It would be super, if someone has an idea where I can get such a script /code in php. Use mine Thanks. you're welcome :-))) x = ', solve(\$eq), '
'; \$eq = '(2 * x) + 4 = 10'; echo \$eq, ' ==> x = ', solve(\$eq), '
'; \$eq = '2 * x + 4 = 10'; echo \$eq, ' ==> x = ', solve(\$eq), '
'; \$eq = '4 + x / 10 = 2'; echo \$eq, ' ==> x = ', solve(\$eq), '
'; ?> -- I have a spam filter working. To mail me include "urkxvq" (with or without the quotes) in the subject line, or your mail will be ruthlessly discarded. Jul 17 '05 #2

 P: n/a Big Thanks Pedro! It's a great script =) An Equation Script which can handle more variables would be better ;) "Pedro" schrieb im Newsbeitrag news:d2********************************@4ax.com... Sven Dzepina wrote:Hello people =)Has somebody a nice script, which can solve equations ? yes, I do now :-)It would be super, if someone has an idea where I can get such a script /code in php. Use mineThanks. you're welcome :-))) x = ', solve(\$eq), '
'; \$eq = '(2 * x) + 4 = 10'; echo \$eq, ' ==> x = ', solve(\$eq), '
'; \$eq = '2 * x + 4 = 10'; echo \$eq, ' ==> x = ', solve(\$eq), '
'; \$eq = '4 + x / 10 = 2'; echo \$eq, ' ==> x = ', solve(\$eq), '
'; ?> -- I have a spam filter working. To mail me include "urkxvq" (with or without the quotes) in the subject line, or your mail will be ruthlessly discarded. Jul 17 '05 #3

 P: n/a Sven Dzepina wrote: Big Thanks Pedro! It's a great script =) LOL, thanks An Equation Script which can handle more variables would be better ;) Yes, I'm pretty sure it would. If you can guarantee the equations are normalized 3x - 6 = 0 instead of 4(x-1) = x+2 that makes making the solver script terribly easy for a) ax+b=0 b) ax^2+bx+c=0 c) ax+by+c=0 (and) dx+ey+f=0 d) ... Input only the constants ... not the whole equation; for the equation above you'd input only: a=3, and b=-6 and then solve (after checking for division by zero only): return -(\$b/\$a); or, for equation in type 2: return array((-\$b+sqrt(\$a*\$a-4*\$a*\$c))/(2*\$a), (-\$b-sqrt(\$a*\$a-4*\$a*\$c))/(2*\$a)); etc. ... ... Happy Coding :-) Jul 17 '05 #4

 P: n/a Hi Pedro, you must be a very intelligent human =) Gretting. "Pedro" schrieb im Newsbeitrag news:bm************@ID-203069.news.uni-berlin.de... Sven Dzepina wrote: Big Thanks Pedro! It's a great script =) LOL, thanks An Equation Script which can handle more variables would be better ;) Yes, I'm pretty sure it would. If you can guarantee the equations are normalized 3x - 6 = 0 instead of 4(x-1) = x+2 that makes making the solver script terribly easy for a) ax+b=0 b) ax^2+bx+c=0 c) ax+by+c=0 (and) dx+ey+f=0 d) ... Input only the constants ... not the whole equation; for the equation above you'd input only: a=3, and b=-6 and then solve (after checking for division by zero only): return -(\$b/\$a); or, for equation in type 2: return array((-\$b+sqrt(\$a*\$a-4*\$a*\$c))/(2*\$a), (-\$b-sqrt(\$a*\$a-4*\$a*\$c))/(2*\$a)); etc. ... ... Happy Coding :-) Jul 17 '05 #5

### This discussion thread is closed

Replies have been disabled for this discussion. 