MATLAB HELP - Maclaurin series

Click For Summary

Discussion Overview

The discussion revolves around assistance with MATLAB programming related to two specific problems: calculating the Maclaurin series expansion for cos(x) and estimating the second derivative of a polynomial function using centered difference approximation. The scope includes programming help, mathematical reasoning, and application of numerical methods.

Discussion Character

  • Homework-related
  • Mathematical reasoning
  • Technical explanation

Main Points Raised

  • One participant requests help with MATLAB programming for two assigned problems involving the Maclaurin series and centered difference approximation.
  • The Maclaurin series for cos(x) is presented, with a request to estimate cos(π/3) by adding terms and calculating errors.
  • Another participant suggests that it may not be necessary to use MATLAB for the first problem, proposing to calculate terms manually and compare results.
  • A participant inquires about specific difficulties with MATLAB commands and offers assistance if the original poster shares their .m file.
  • The original poster confirms they are required to use MATLAB and mentions having trouble with the second problem, sharing their .m file for feedback.

Areas of Agreement / Disagreement

Participants express differing views on the necessity of using MATLAB for the first problem, with some suggesting manual calculations are sufficient while others emphasize the requirement to use MATLAB. The discussion remains unresolved regarding the best approach to the problems.

Contextual Notes

Some participants may have varying levels of familiarity with MATLAB, which could affect their ability to assist effectively. The original poster's .m file may contain errors that are not explicitly identified in the discussion.

Who May Find This Useful

Students seeking help with MATLAB programming for numerical methods, particularly in the context of calculus and series expansions, may find this discussion beneficial.

figgy111
Messages
2
Reaction score
0
MATLAB HELP! -- Maclaurin series

Hi, i have absolutely no programming experience with MATLAB and really need it. We have been assigned 2 problems using MATLAB and a bunch of others that don't need matlab. I was wondering if someone could show me what to do for the two needed to be done in MATLAB (or send a .m file if you have one/could create one); the questions are:

The Maclaurin series expansion for cos (x) is:

cosx = 1 - (x^2)/2 + (x^4)/4! - (x^6)/6! + (x^8)/8! - ...

Starting with the simplest version, cosx = 1, add terms one at a time to estimate cos(pi/3). After each term is added, compute the true and approximate percent relative errors. Use your pocket calculator to determine the true value. Add terms until the absolute value of the approximate error estimate falls below an error criterion conforming to two significant figures.

The other question is:

Use a centered difference approximation of O(h^2) to estimate the second derivative of the function f(x) = 25x^3 - 6x^2 + 7x - 88. Perform the evaluation at x = 2 using step sizes of h = 0.25 and 0.125. Compare your estimates with the true value of the second derivative. Interpret your results on the basis of the remainder term of the taylor series expansion.

THANK YOU SO MUCH PLEASE HELP!
 
Physics news on Phys.org
figgy111 said:
Hi, i have absolutely no programming experience with MATLAB and really need it. We have been assigned 2 problems using MATLAB and a bunch of others that don't need matlab. I was wondering if someone could show me what to do for the two needed to be done in MATLAB (or send a .m file if you have one/could create one); the questions are:

The Maclaurin series expansion for cos (x) is:

cosx = 1 - (x^2)/2 + (x^4)/4! - (x^6)/6! + (x^8)/8! - ...

Starting with the simplest version, cosx = 1, add terms one at a time to estimate cos(pi/3). After each term is added, compute the true and approximate percent relative errors. Use your pocket calculator to determine the true value. Add terms until the absolute value of the approximate error estimate falls below an error criterion conforming to two significant figures.

The other question is:

Use a centered difference approximation of O(h^2) to estimate the second derivative of the function f(x) = 25x^3 - 6x^2 + 7x - 88. Perform the evaluation at x = 2 using step sizes of h = 0.25 and 0.125. Compare your estimates with the true value of the second derivative. Interpret your results on the basis of the remainder term of the taylor series expansion.

THANK YOU SO MUCH PLEASE HELP!
You don't need MatLab. You have just have to add the first few terms. You do this by replacing x by \pi/3 in the MacLaurin/Taylor series expansion and calculating the first few terms on a calculator. Calculate cos(\pi/3) on a calculator. Compare the two. If the difference is less than .005 then you have the answer to two significant figures. If not, keep adding more terms until you get the difference down to less than .005.

AM
 
and if you're required to use matlab, what are you having trouble with? Do you understand AM's logic? Do you need help with the commands for the .m file?

I took a MATLAB class and I still use the program once in a while, if you can aska specific question, or PASTE your .m file here, I'll see what I can help you with.
 
yes we are required to use matlab

i did the first one alright the second one i had some trouble with. here is my .m file for that one i know its a little of but let me know. thanks in advance
 

Attachments

  • p47.m
    p47.m
    422 bytes · Views: 1,591

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 14 ·
Replies
14
Views
4K