[ 
https://issues.apache.org/jira/browse/MATH-250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12683341#action_12683341
 ] 

Luc Maisonobe edited comment on MATH-250 at 3/18/09 11:34 PM:
--------------------------------------------------------------

This comment may be slightly out of scope, but aside from commons-math, we have 
a project in the commons sandbox which is dedicated to derivatives computations 
: Nabla [http://commons.apache.org/commons/sandbox/nabla/].
The project is not ready for production use and cannot handle some constructs 
properly yet like temporary variables or loops. But a straightforward 
implementation of your rational function like the following one is 
differentiated properly:

{code}
public class MyRationalFunction implements UnivariateDifferentiable {
            public double f(double t) {
                return Math.pow(1 - t, 2) / Math.pow(1 + t, 2) - 1;
            }
}
{code}

This would also work with embedded Math.sin, Math.exp ... 

There have been no work on Nabla since months as I was much busy with commons 
math. I expect to work on it again very soon.

      was (Author: luc):
    This comment may be slightly out of scope, but aside from commons-math, we 
have a project in the commons sandbox which is dedicated to derivatives 
computations : Nabla [http://commons.apache.org/commons/sandbox/nabla/].
The project is not ready for production use and cannot handle some constructs 
properly yet like temporary variables or loops. But a straightforward 
implementation of your rational function like the following one is 
differentiated properly:

public class MyRationalFunction implements UnivariateDifferentiable {
            public double f(double t) {
                return Math.pow(1 - t, 2) / Math.pow(1 + t, 2) - 1;
            }

This would also work with embedded Math.sin, Math.exp ... 

There have been no work on Nabla since months as I was much busy with commons 
math. I expect to work on it again very soon.
  
> Solver for rational and other equations
> ---------------------------------------
>
>                 Key: MATH-250
>                 URL: https://issues.apache.org/jira/browse/MATH-250
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 2.0
>            Reporter: Bernhard Grünewaldt
>            Priority: Minor
>             Fix For: 2.0
>
>
> In addition to the existing PolynomialFunction class a RationalFunction class 
> would be a good idea.
> http://en.wikipedia.org/wiki/Rational_function
> For package:
> http://commons.apache.org/math/userguide/analysis.html
> The goal should be to calculate derivates of functions like:
> f(x) = [ x + 2*x^3 ] / [ x -1]
> or 
> f(x) = [ e^x + 2*x ] / [ cos(x) ]
> Therefore it would be best to have classes for all the inner equations like 
> "e", "sin,cos,tan ...", "sqrt", a.s.o
> These inner equations would then be put together to an outer equation. 
> This outer equation can then be derived using the "chain rule", "product 
> rule" and all other rules for getting the derivative.
> One of this inner classes is the existing PolynomialFunction class from the 
> analysis package.
> For easy rational functions the outer equation is of the form:
> f(x) = PolynomialFunction / PolynomialFunction
> Now just use the rule to derive it:
> f(x) = g(x) / h(x)   =>  f'(x) = [h(x) * g'(x) - g(x) * h'(x) ] / [ h(x) ]^2
> Here we can use the inner derivate of the PolynomialFunction by calling 
> PolynomialFunction.derivative()
> That's the idea, now the topics that have to be discussed:
> 1. We should have a parser that can parse the "standard mathematical 
> notation" into a tree of function classes.
>     http://en.wikipedia.org/wiki/Mathematical_notation
> 2. A class for every type of function should be implemented with an interface 
> that has the common methods like:
>     add(Object o)
>     subtract(Object o)
>     multiply(Object o)
>     divide(Object o)
>     derivative(Object o)
>     a.s.o
> 3. We need to implement Excptions that are thrown for sqrt(-1) a.s.o
> 4. We need a mother class that implements all the complex derivation rules 
> like:
>     http://en.wikipedia.org/wiki/Chain_rule
>     http://en.wikipedia.org/wiki/Product_rule
>     a.s.o.
>     the sub classes the PolynomialFunction or the RationalFunction just 
> implement their derivation rules, but the mother class implements the complex 
> rules to derivate a complex structure of any type of equation by using the 
> inner derivation rules and the complex chain rules a.s.o

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to