Computer Science Canada Numerical Methods |
Author: | castmitigation [ Wed Feb 04, 2009 1:25 am ] |
Post subject: | Numerical Methods |
Hi guys Im new on this forum, just looking for some help and ways to contribute on the forum, its the first time I sign up for a computer science forum actually. The thing is Im really lost in this question I just dont know what theyre asking me to do, it goes like When each of the following expressions is evaluated using floating-point arithmetic, poor results are obtained for a certain range of values of x. In each instance, identify this range and provide an alternate expression that can be used for such values of x. (1) e^x -1 (2) x - (sqrt)[x^2 -a] note: e meaning euler can i get some hint of how to start? This is a topic about Numerical Methods, propagation of errors in computers etc. thanks in advance |
Author: | Tony [ Wed Feb 04, 2009 1:59 am ] |
Post subject: | RE:Numerical Methods |
You should be familiar with the internal structure of floating points, and realize that they are designed to accommodate a very large domain of values at the expense of the precision. As such, when precision digits becomes important (such as for values very close to zero), the quality of result degrades. |
Author: | castmitigation [ Wed Feb 04, 2009 5:42 am ] |
Post subject: | Re: Numerical Methods |
yes, I know that, I know that there is a certain range when the values get close to 0 that can blow up the results since the input is being chopped or rounded, but I have no clue of how to offer an alternative for an specific equation so I can avoid the problem somehow. I thought there was some formula or something, but Im tired of googling, my notes dont say anything helpful, and the book Scientific Computing either, I'm struggling with this, 5:40 am still with the book in my hand trying to figure it out but nothing so far. |
Author: | Brightguy [ Wed Feb 04, 2009 2:15 pm ] |
Post subject: | Re: Numerical Methods |
You want to avoid subtracting two numbers which are approximately equal. When this happens, rewrite the expression in an equivalent form which avoids this. Looking at a Taylor series expansion can sometimes be helpful. Roughly, calculating e^x this way is good for positive x and bad for negative x. |