Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code in C Problem #1-Taylor Series Convergence (C Program) For this program, let's calculate the Taylee series expansion foe the exponential functioe: e The

Please code in C image text in transcribed
image text in transcribed
Problem #1-Taylor Series Convergence (C Program) For this program, let's calculate the Taylee series expansion foe the exponential functioe: e The equation we will implement is: 2 34 This summation w converge toe. afer some number of sms have been added to the whole The sumber of terms will vary depending on the value of x. Note that every sem in the summation is positive, so the summation will converge to the actual valuc from belowis assumed to be>0 In general, if we wish to test two floating point nambers for equality, we can calcelale the absolute value of the difference between the sumbers and then detemine if that dfference is less than soese spsilon valuc Let's apply that technique to this problem. We'll test the growing sum apainst the standard e valuc (as calculated by the exp (x) function) until the difference between the two becomes lkss than some spsilon (to be defined shortly) At that point we'll consider that the series has converged on the comect valuc. In addition, we'll track the number of serms that mud be added to the sum to achieve convergence and report that value to the user Your programm should contain at least two functions CS1325-Intredection to Pregramming Paze: 2 main a standaed main function 2) unsigned long factorial (int aThis function will calculale n and return the result as an unsigned long Since we know that all factorials in this problem are positive, there is no need to you is to have a rcturn data type of unsigned long This is a requirement. are using a Mac system, make return data type unsigned int.) If you want to use other functions as well, say, for exmmple, the entire serics is calculated in a separate function, that would be okay. Your program should do the following ) Ask the user to enter an""value. This value should be a double tat i0 2) Have the peogram calculate es by using the Taylor Series given above and print the following table For x-0.3: pLEf 08000 3498588 343859.30000 34985S3450 349859 .349500 349 5-3498 The nunber of iterations required for covergence Forx-08S -22554093 2554093 2.225541 .080080 2.120000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions