How to approximate e^x with while loop
显示 更早的评论
Hello all. I'm working on a homework problem for my Numerical Methods for Engineers class, but am stuck and am hoping for some assistance. We were assigned this problem for practice only and are encouraged to work together and use our resources to solve it, so any assistance you can offer would be great. The problem is below:
Example 3.2 Error Estimates for Iterative Methods Starting with e^x=1, add terms to estimate e^0.5 numerically to 3 significant figures. The true value for e^0.5 = 1.648721… Also compute the approximate and true percent errors at each step.
So I know I'm supposed to use the Taylor Series for e^x to approximate the value: e^x = 1 + x + x^n/n!
I also know that I'd like to build vectors for both percent errors as well as the approximate values.
I've attached my current script for you to view; keep in mind it's rough as I'm just trying to get the script to work correctly before I fine-tune it. I've also attached a screen shot from the text depicting what the correct values should be.
Any guidance to help me build on what I already have would be great.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!