Question

Let f(x) = 1 + x − (sin(x)/(x · (e^x) )). Propose a numerically sound algorithm...

Let f(x) = 1 + x − (sin(x)/(x · (e^x) )). Propose a numerically sound algorithm for evaluating f(x) for x ~ 0. Please provide all steps/details, including your thought process so I can follow along and learn, thanks!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

You can use what you already did and perform the long division. This would lead to

f(x)=1+x−sin(x)xex=2x−x23+O(x3)f(x)=1+x−sin⁡(x)xex=2x−x23+O(x3)

Using more terms for numerator would lead to

f(x)=2x−x23+x430−x590+O(x6)f(x)=2x−x23+x430−x590+O(x6)

To avoid the long division, as suggested by Antonio Vargas, the simplest is effectively to write

f(x)=1+x−sin(x)xe−x=1+x−(1−x26+x4120−x65040+O(x8))×f(x)=1+x−sin⁡(x)xe−x=1+x−(1−x26+x4120−x65040+O(x8))×

(1−x+x22−x36+x424−x5120+x6720+O(x7))(1−x+x22−x36+x424−x5120+x6720+O(x7))

and multiply.

For illustration purposes, I generated a table (values of xx and f(x)f(x) computed and approximated) (Fortran code using double precision). You could notice that some chaos appears with f(x)f(x) for x<10−10x<10−10 and that the results are definitely wrong when xx approaches 10−2010−20 which is the order of magnitude of machine accuracy.

1.00D-01 1.9666989048D-01 1.9666988889D-01
1.00D-02 1.9966666999D-02 1.9966666999D-02
1.00D-03 1.9996666667D-03 1.9996666667D-03
1.00D-04 1.9999666667D-04 1.9999666667D-04
1.00D-05 1.9999966667D-05 1.9999966667D-05
1.00D-06 1.9999996667D-06 1.9999996667D-06
1.00D-07 1.9999999667D-07 1.9999999667D-07
1.00D-08 1.9999999967D-08 1.9999999967D-08
1.00D-09 1.9999999997D-09 1.9999999997D-09
1.00D-10 2.0000000001D-10 2.0000000000D-10
1.00D-11 2.0000000029D-11 2.0000000000D-11
1.00D-12 1.9999999920D-12 2.0000000000D-12
1.00D-13 1.9999995583D-13 2.0000000000D-13
1.00D-14 2.0000006425D-14 2.0000000000D-14
1.00D-15 1.9999735375D-15 2.0000000000D-15
1.00D-16 1.9998109071D-16 2.0000000000D-16
1.00D-17 2.0003530082D-17 2.0000000000D-17
1.00D-18 1.8973538018D-18 2.0000000000D-18
1.00D-19 2.1684043450D-19 2.0000000000D-19
1.00D-20 0.0000000000D+00 2.0000000000D-20
1.00D-21 0.0000000000D+00 2.0000000000D-21
1.00D-22 0.0000000000D+00 2.0000000000D-22
1.00D-23 0.0000000000D+00 2.0000000000D-23
1.00D-24 0.0000000000D+00 2.0000000000D-24
1.00D-25 0.0000000000D+00 2.0000000000D-25

Add a comment
Know the answer?
Add Answer to:
Let f(x) = 1 + x − (sin(x)/(x · (e^x) )). Propose a numerically sound algorithm...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT