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.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 22 Aug 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!