{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lab 1.pdf - In[3:=*Julian Velandia 126 Lab 1*Problem 1*a...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
In[3]:= (* Julian Velandia 126 Lab 1 *) (* Problem 1 *) (* a *) s [ x _ , k _] : = Sum [(- 1 ) ^n * x^ ( 2 n + 1 ) / (( 2 n + 1 )!) , { n, 0, k }] In[4]:= s [ Pi, 11 ] Out[4]= π - π 3 6 + π 5 120 - π 7 5040 + π 9 362 880 - π 11 39 916 800 + π 13 6 227 020 800 - π 15 1 307 674 368 000 + π 17 355 687 428 096 000 - π 19 121 645 100 408 832 000 + π 21 51 090 942 171 709 440 000 - π 23 25 852 016 738 884 976 640 000 In[5]:= N [ s [ Pi, 11 ] , 10 ] Out[5]= - 1.706186195 × 10 - 13 (* b *) Plot [{ Sin [ x ] , s [ x, 0 ] , s [ x, 1 ] , s [ x, 2 ] , s [ x, 3 ] , s [ x, 4 ] , s [ x, 5 ]} , { x, - 4, 4 }] - 4 - 2 2 4 - 4 - 2 2 4 In[28]:= (* c *) R [ x _ , k _] : = Abs [ Sin [ x ] - s [ x, k ]] In[29]:= N [ R [ 4.10578, 34 ] , 10 ] Out[29]= 2.55351 × 10 - 15 (* d *) In[30]:= For [ k = 0, R [ 1.327, k ] ≥ 10^ (- 12 ) , k ++ , m = k + 1 ] ; m Out[30]= 7 (* Problem 2 *) (* a *) For [ k = 1, Sum [ 2 / n, { n, 1, k }] < 5, k ++ , m = k + 1 ] ; m 7 Printed by Wolfram Mathematica Student Edition
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}