Make this function continuous/numerically stable.

  • Thread starter Thread starter Unrest
  • Start date Start date
  • Tags Tags
    Function Stable
Unrest
Messages
360
Reaction score
1
Hello. I have a function which doesn't work near A=0. I want to change it to something that a computer can evaluate for any value of A.

y = [exp(Ax) - 1] / [exp(A)-1]

As you can see below, it approaches y=x when A->0.

I was wondering about multiplying the numerator and denominator by something.

[PLAIN]http://dl.dropbox.com/u/21857463/FunctionPlot.png
 
Last edited by a moderator:
Physics news on Phys.org
When A is close to 0, you could evaluate it as a power series instead of using the built-in exp() function.

y = x(1 + Ax/2! + (Ax)^2/3! + ...)/(1 + A/2! + A^2/3! + ...)
 
AlephZero said:
y = x(1 + Ax/2! + (Ax)^2/3! + ...)/(1 + A/2! + A^2/3! + ...)

I think that won't work any better because the denominator still approaches 0 as A approaches 0. (you omitted the -1).

I think if I can find the limit of this as A->B, I can replace the function with the limit function instead. But I don't know any way to find limits except factorizing or dividing by powers of x, neither of which work here.
 
(you omitted the -1)

No he didn't. Look at it again, carefully. He already subtracted the ones (numerator and denominator), factored, and then divided out "A".

AlephZero's expression is correct, and will work for small "A".
 
TheoMcCloskey said:
AlephZero's expression is correct, and will work for small "A".

Oh yes, indeed. This should be a good solution.
 

Similar threads

Replies
11
Views
3K
Replies
8
Views
2K
Replies
17
Views
3K
Replies
3
Views
4K
Replies
6
Views
2K
Replies
3
Views
3K
Back
Top