Re: New package proposal: Math_Calculus
| From: | Johannes Schlueter | Date: | Fri, 16 May 2003 09:58:40 +0000 |
| Subject: | Re: New package proposal: Math_Calculus | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16348@lists.php.net to get a copy of this message | ||
On Friday 16 May 2003 11:24, you wrote:
> could you please enlighten, at least, me.
I'll try ;-)
> I remember deriving and integration from university, but really have
> to say that your code seems only to be for a very special purpose.
> I can not tell the class: please derive this function f(x) = x^2 + x,
> with x=<some value>. Actually that's what i expected.
For doing this you're code would look like
function some_math($x) {
return $x*$x + $x // Your formula translated to PHP code
}
// create object with the function defined above
$calculus = new Calculus('some_math');
// Calculate the derivation at <some value>
echo $calculus->derivate(<some value>);
This would print the value of the derivation at <some value>, at university
you would have derivated first symbolic
f(x) = x^2 + x
=> f'(x) = 2x + 1
and then calculated f'(x) for your value: f'(<some value) = 2*<some value> but
doing this symbolic calculations is a bit harder than just looking for the
numeric value of the derivation at a given point, what my class does - it
just calculetes the value of f'(x) at the given position not the complete
f'(x) function.
By using a PHP function for implemnting the formula I can use nearly every
function you might want to derivate or integrate.
I hope this helpes otherwise I would need to fetch my math books and a
dictionary to copy the definitions here (ok, you're German, so I wouldn't
need the dicitonary *g*), but I hope I don't need to do this :-)
> (Actually i really hate that i dont need all the stuff from university
> anymore)
I heared this sentence quite often - maybe I should stop going to university
;-)
johannes