commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <Luc.Maison...@free.fr>
Subject Re: [math] algorithm to establish value of parameter giving max value of equation
Date Thu, 29 May 2008 18:49:50 GMT
Adam Hardy a écrit :
> Adam Hardy on 29/05/08 11:18, wrote:
>> luc.maisonobe@free.fr on 29/05/08 10:24, wrote:
>>> In the previous message, I called twr what was really twrPrime, and I
>>> used a too slow method to compute it with a double loop. Here is a
>>> much simpler and faster way to compute this derivative:
>>>
>>> public class TwrDerivative implements UnivariateRealFunction {
>>>
>>>   private final double[] a;
>>>
>>>   public TwrDerivative(double[] pl, double[] b) {
>>>     a = new double[pl.length];
>>>     for (int i = 0; i < a.length; ++i) {
>>>       a[i] = pl[i] / b[i];
>>>     }
>>>   }
>>>
>>>   public double value(double f) {
>>>     double twr      = 1;
>>>     double twrPrime = 0;
>>>     for (int i = 0; i < a.length; ++i) {
>>>       double factor = 1 + a[i] * f;
>>>       twrPrime = twrPrime * factor + twr * a[i];
>>>       twr     *= factor;
>>>     }
>>>     return twrPrime;
>>>   }
>>>
>>> }
> 
> By the way, why do you call the gradient result 'prime'?

It is a reference to the ' character. It is a classical notation in
math. See the corresponding article in Mathworld:
http://mathworld.wolfram.com/Prime.html

This has nothing to do with prime numbers.

Luc

> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message