Matlab code for Maclaurin series expansion using cos(x) =1 and iterating adding a term at a time until I have an estimate for Cos(pi/3)?
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
What is a good way to write the Maclaurin series expansion for cos(x), beginning with cos(x)=1 and adding terms one at a time to estimate cos(pi/3)? I want to also return the estimate at each iteration.
0 Commenti
Risposte (2)
James Tursa
il 18 Set 2013
Google Maclaurin expansion of cosx
Go to the first link
Scroll to the bottom of the page.
Look at the pattern for successive terms and code that up.
0 Commenti
Nikhil
il 3 Ott 2024
syms x
myfun=cos(x);
x0=0;
N=6;
y0=subs(myfun,x0);
y=y0
forn=1:N
derivative=diff(myfun,n);
y=((x-xx0)^n/factorial(n)*subs(derivative,x0));
0 Commenti
Vedere anche
Categorie
Scopri di più su Code Generation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!