Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C programming ( as a beginner ) , write an algorithm in the main ( ) that generates N first elements of a series

In C programming(as a beginner), write an algorithm in the main() that generates N first
elements of a series sn(x)=-(x)nn.
This series represents the Taylor series : ln(1-x)~~-n=1N=6(x)nn.
Evaluate this series in for() loop for x=0.5, and n=1,2,dots,6. Calculate and print the subsequent
element values in a terminal. Hint: the first three elements are -x,-x2n,-x3n.
Modify the main () such that the user can insert through a keyboard value of m. Allocate
dynamically two 1-dimensional arrays (VecA and VecB) that contain m=10 elements of
double type.
Write a separate function funFill() that will fill a dynamically allocated vector VecA from
point 2 with the first 10 elements of a series defined in point 1(n=1,2,3,dots,10). Print in the
terminal values of each element in VecA
Write a separate function funLn() that will fill a dynamically allocated vector VecB from point
2 with the sum of the first m elements of a series defined in point 1(i.e. for n=1 sum of the
first element, for n=2 sum of first two elements, for n=3 the sum of first three elements,etc.)
Print in the terminal values of each element in VecB; n must be implemented as an input
argument.
Modify the funLn() such that the last element of VecB is also returned into the main () using
a pointer.
Plot the value of the last element of VecB for x=0.5 in for() loop for n=1,dots20. Plot the
absolute value of the difference between the value of the last element of VecB and function
ln(1-x). Save this data in a separate txt file in three columns: n- first column, last element of
VecB - second column, the absolute value of the difference between last element of VecB
and ln(1-x)- third column.
image text in transcribed

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

More Books

Students also viewed these Databases questions