1 view (last 30 days)

Show older comments

Hello!

I need some help. I got this question that im trying to answer......Please let me know How you would do this problem. I am so lost.

Leibnitz (the other Calculus guy) proved that the following infinite alternating series converges (very slowly) to pi. You are going to investigate just how slowly.

Create a function named partsum, that calculates the sum of a given number of terms (i.e., the Nth partial sum)

In the function, create a vector of terms (sequence) that is then added to determine the sum. The function should take as input a scalar N (not a vector) and return two outputs, the sum and the vector of terms.

In my .m file I will need to call the function for the values N = 5, 50, 500, and 5000, and determine the error for each. Use the table function to report your results.

Your output to the console should look like this:

Terms Error

_____ ________

5 0.19809

50 0.019998

500 0.002

5000 0.0002

Please let me know ASAP

Thank you

Daniel

Walter Roberson
on 18 Jul 2021

You got a response within 8 minutes. A possibility of a complete solution before an exam finished has more value than no solution at all, correct?

People do post exam questions while they are in the middle of writing exams.

Well think whatever you want

I have answered more than 50000 Questions. I have seen a lot of homework questions posted, and this was definitely a homework question.

I have also seen a number of cases where someone swears that something is not a homework question, but then the next day someone else posts the exact same question, and when this is pointed out the second person says something like, "Oh yes, that other person is in the same class as I am."

Star Strider
on 18 Jul 2021

MATLAB is quite versatile with respect to prpblems like this, so it does not require explicit loops to create the terms of that series (although you can code the terms using loops if you so desire).

Since this is not a homework problem, one approach would be —

k = 7;

kv = 1:k;

parts = (-1).^(kv-1)./(2*kv-1)

Then use the appropriate function to calculate the sum of the series.

See the documentation section on Vectorization to understand how this example code works, and the reason it works.

.

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

Start Hunting!