Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

I'm trying to make the code below work by modifying it so that e^-x will work, essentially I'm trying to modify it so that e^-x is 1/e^x I'm really not sure how to do that..Here is my code.. function [result] = eTaylor(x, n) % approximate e^x % using first n non-zero terms of the Taylor series % e^x = 1 + x + x^2/(2!) + x^3/(3!) + ...... result = 0.0; term = 1.0; for i = 1::1:n result = result + term; term = term*x/i; end

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!