Page 1 of 1

Mathematical Limits in PHP

Posted: Mon Apr 04, 2011 4:15 pm
by TheCandyMan
How would one go about doing this?

How would you handle limits that approach infinity?
e.g. The limit as x goes to 0 of (1/x)

Re: Mathematical Limits in PHP

Posted: Mon Apr 04, 2011 7:35 pm
by Christopher
Not sure exactly what your question is? Obviously you cannot divide by zero so you need to put an if() around the calculation and give an appropriate value if the denominator is zero. You can use the math functions to increase the precision, if that is what you need:

http://us.php.net/manual/en/refs.math.php

Re: Mathematical Limits in PHP

Posted: Tue Apr 05, 2011 12:22 pm
by kaisellgren
If you need to check whether a value is finite, use this http://www.php.net/manual/en/function.is-finite.php

Re: Mathematical Limits in PHP

Posted: Tue Apr 05, 2011 1:08 pm
by Weirdan
Computer Algebra Systems (CAS) (and it seems what original poster was asking about) are usually outside what people do in PHP... so your best bet is to find an application that can do what you want and invoke it via shell_exec() and friends.