Make this function continuous/numerically stable.

  • Thread starter Unrest
  • Start date
360
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 [Broken]
 
Last edited by a moderator:

AlephZero

Science Advisor
Homework Helper
6,953
291
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! + ...)
 
360
1
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".
 
360
1
AlephZero's expression is correct, and will work for small "A".
Oh yes, indeed. This should be a good solution.
 

Related Threads for: Make this function continuous/numerically stable.

  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
6
Views
1K
Replies
1
Views
625
  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
18
Views
1K
  • Last Post
Replies
6
Views
1K
  • Last Post
Replies
8
Views
2K
  • Last Post
Replies
3
Views
2K

Hot Threads

Top