|» Metadata||» Status|
This package allows you to calculate the derivative of a mathematical expression.
Notice that expressions that are passed to it won't always be valid php syntax : "a^b" means "a raised to the power of b" for Math_Derivative and not the usual bitwise XOR.
That is important to know, especially if you plan to evaluate the expression returned using php's own eval().
Math_Derivative::getDerivative() will also work on literal expressions.
Some functions are already implemented, so you can use them in the input:
Definding your own functions
Use Math_Derivative::registerFunction((string)name, (string)derivative form) to define your own functions.
The derivative form handle two special keywords: d() which means "getting the derivative of" and arg: the single argument passed to the function.
For example, the derivative form of e() would be : "d(arg)*e(arg)".
Note: You can nest multiple d(), I haven't found any case that could use this though.
Warning: enclose "arg" in parenthesis to ensure operators' precedence when needed.
A cache management is already bundled to save intermediary results of the whole object, it provides a significant speed boost, especially when used with repetitive expressions. It is also allowed to save the cache and reuse it in another instance of the class.
You can also turn this cache system off.
Warning: Changing the dx, having caching enabled, will corrupt the cache. As a prevention method the entire cache will be flushed.
Some simplification rules are aplied during the processing. There is currently no post-processing simplification system.
|» Dependencies||» Links|
|» Timeline||» Changelog|