[MATH] What is the derivative of 0^x

2013-08-23 Thread Ajo Fod
Seems like the DerivativeCompiler returns NaN. IMHO it should return 0. Is this worthy of an issue? Thanks, -Ajo

Re: [MATH] What is the derivative of 0^x

2013-08-23 Thread Rodion Efremov
Hi! IMHO, 0^x should equal 0. But note please, that 0^0 is not define, so it should be NaN --- TIA, Rodion Ajo Fod писал 23.08.2013 05:17 PM: Seems like the DerivativeCompiler returns NaN. IMHO it should return 0. Is this worthy of an issue? Thanks, -Ajo ---

Re: [MATH] What is the derivative of 0^x

2013-08-23 Thread Gilles
On Fri, 23 Aug 2013 07:17:35 -0700, Ajo Fod wrote: Seems like the DerivativeCompiler returns NaN. IMHO it should return 0. What should be 0? And Why? Is this worthy of an issue? As is, no. Gilles Thanks, -Ajo - To

Re: [MATH] What is the derivative of 0^x

2013-08-23 Thread Ajo Fod
Try this and I'm happy to explain if necessary: public class Derivative { public static void main(final String[] args) { DerivativeStructure dsA = new DerivativeStructure(1, 1, 0, 1d); System.out.println("Derivative of constant^x wrt x"); for (int a = -3; a < 3; a++) {

Re: [MATH] What is the derivative of 0^x

2013-08-23 Thread Phil Steitz
Search the archives for discussion of 0^0. Phil On 8/23/13 7:17 AM, Ajo Fod wrote: > Seems like the DerivativeCompiler returns NaN. > > IMHO it should return 0. > > Is this worthy of an issue? > > Thanks, > -Ajo > - To unsubscr

Re: [MATH] What is the derivative of 0^x

2013-08-23 Thread Luc Maisonobe
Hi Ajo, Le 23/08/2013 17:48, Ajo Fod a écrit : > Try this and I'm happy to explain if necessary: > > public class Derivative { > > public static void main(final String[] args) { > DerivativeStructure dsA = new DerivativeStructure(1, 1, 0, 1d); > System.out.println("Derivative

Re: [MATH] What is the derivative of 0^x

2013-08-23 Thread Ajo Fod
Hello, This shows one way of interpreting the derivative for strictly +ve numbers. public static void main(final String[] args) { final double x = 1d; DerivativeStructure dsA = new DerivativeStructure(1, 1, 0, x); System.out.println("Derivative of |a|^x wrt x");

Re: [MATH] What is the derivative of 0^x

2013-08-24 Thread Luc Maisonobe
Le 23/08/2013 19:20, Ajo Fod a écrit : > Hello, Hi Ajo, > > This shows one way of interpreting the derivative for strictly +ve numbers. > > public static void main(final String[] args) { > final double x = 1d; > DerivativeStructure dsA = new DerivativeStructure(1, 1, 0, x);

Re: [MATH] What is the derivative of 0^x

2013-08-25 Thread Luc Maisonobe
Le 24/08/2013 11:24, Luc Maisonobe a écrit : > Le 23/08/2013 19:20, Ajo Fod a écrit : >> Hello, > > Hi Ajo, > >> >> This shows one way of interpreting the derivative for strictly +ve numbers. >> >> public static void main(final String[] args) { >> final double x = 1d; >> Deriv

Re: [MATH] What is the derivative of 0^x

2013-08-25 Thread Ajo Fod
Are you saying patched the code? Can you provide the link? -Ajo On Sun, Aug 25, 2013 at 1:20 PM, Luc Maisonobe wrote: > Le 24/08/2013 11:24, Luc Maisonobe a écrit : > > Le 23/08/2013 19:20, Ajo Fod a écrit : > >> Hello, > > > > Hi Ajo, > > > >> > >> This shows one way of interpreting the deriv

Re: [MATH] What is the derivative of 0^x

2013-08-26 Thread Luc Maisonobe
Ajo Fod a écrit : >Are you saying patched the code? Can you provide the link? I committed it in the development version. You just have to update your checked out copy from either the official Apache subversion repository or the git mirror we talked about in a previous thread. The new metho

Re: [MATH] What is the derivative of 0^x

2013-08-26 Thread Ajo Fod
With regards to what is happening in DsCompiler.pow(): IMHO, when a==0 and x>=0 the function is well behaved because log|a| -> Inf slower than a^x -> 0. I got to this by simulation. One could probably get to something more conclusive using L'Hopital rule : http://en.wikipedia.org/wiki/L%27H%C3%B4pi

Re: [MATH] What is the derivative of 0^x

2013-08-26 Thread Ajo Fod
On a side note. Given a derivative structure ds. Wouldn't it be nice to generate a constant derivative structure with something like: ds.getConstant(dobule value); Currently I"m doing something like: new DerivativeStructure(length, order, value); ... seesm more verbose than necessary when I have

Re: [MATH] What is the derivative of 0^x

2013-08-27 Thread Luc Maisonobe
Le 26/08/2013 17:23, Ajo Fod a écrit : > With regards to what is happening in DsCompiler.pow(): > IMHO, when a==0 and x>=0 the function is well behaved because log|a| -> Inf > slower than a^x -> 0. I got to this by simulation. > One could probably get to something more conclusive using L'Hopital ru

Re: [MATH] What is the derivative of 0^x

2013-08-27 Thread Luc Maisonobe
Le 26/08/2013 22:37, Ajo Fod a écrit : > On a side note. Given a derivative structure ds. Wouldn't it be nice to > generate a constant derivative structure with something like: > > ds.getConstant(dobule value); > Currently I"m doing something like: > new DerivativeStructure(length, order, value);

Re: [MATH] What is the derivative of 0^x

2013-08-27 Thread Ajo Fod
Thanks for the constant structure. No. The limit value when x->0+ is 1, not O. I agree with this. I was just going for the derivatives = 0. > The nth derivative of a^x can be computed analytically as ln(a)^n a^x, > so the initial slope at x=0 is simply ln(a), positive for a > 1, zero > for a =

Re: [MATH] What is the derivative of 0^x

2013-08-27 Thread Luc Maisonobe
Hi Ajo, Le 27/08/2013 16:44, Ajo Fod a écrit : > Thanks for the constant structure. > > No. The limit value when x->0+ is 1, not O. > > I agree with this. I was just going for the derivatives = 0. > > >> The nth derivative of a^x can be computed analytically as ln(a)^n a^x, >> so the initial s

Re: [MATH] What is the derivative of 0^x

2013-08-28 Thread Ajo Fod
To define things precisely: y = f(a,x) = |a|^x Can we agree that: df(a,x)/dx -> 0 when a->0 and x > 0 :[ NOTE: x > 0] If this is acceptable, we get this very useful property that df (a,x)/dx is defined and continuous for all a provided x>0 because we use the modulus of a in the function definitio

Re: [MATH] What is the derivative of 0^x

2013-08-28 Thread Luc Maisonobe
Hi Ajo, Le 28/08/2013 16:56, Ajo Fod a écrit : > To define things precisely: > y = f(a,x) = |a|^x > > Can we agree that: > df(a,x)/dx -> 0 when a->0 and x > 0 :[ NOTE: x > 0] Yes, of course, it is perfectly true. > > If this is acceptable, we get this very useful property that df (a,x)/dx is >

Re: [MATH] What is the derivative of 0^x

2013-08-28 Thread Ajo Fod
Its a=0 that bothers me. x > 0 in my case. In the code I use, the DerivativeStructure evaluates to NaN for a=0 when x > 0 . I think we agree that in this condition the derivative should evaluate to 0. Perhaps I wrote something to mislead you on this detail. -Ajo On Wed, Aug 28, 2013 at 10:36

Re: [MATH] What is the derivative of 0^x

2013-08-28 Thread Luc Maisonobe
Le 28/08/2013 19:59, Ajo Fod a écrit : > Its a=0 that bothers me. x > 0 in my case. Then everything should be OK with the current code, which reads: final double[] function = new double[1 + order]; if (a == 0) { if (operand[operandOffset] == 0) { functi

Re: [MATH] What is the derivative of 0^x

2013-08-28 Thread Ajo Fod
That works very well. I missed the default value of 0 earlier Thanks, -Ajo On Wed, Aug 28, 2013 at 11:05 AM, Luc Maisonobe wrote: > Le 28/08/2013 19:59, Ajo Fod a écrit : > > Its a=0 that bothers me. x > 0 in my case. > > Then everything should be OK with the current code, which reads: > >

Re: [MATH] What is the derivative of 0^x

2013-08-28 Thread Ajo Fod
BTW Luc. This derivatives structure is simply a godsent for big optimization problems. Cheers, -Ajo. On Wed, Aug 28, 2013 at 11:13 AM, Ajo Fod wrote: > That works very well. > > I missed the default value of 0 earlier > > Thanks, > -Ajo > > > On Wed, Aug 28, 2013 at 11:05 AM, Luc Maisonobe wro