Mathematica Lab #11

11/8/2015
Section A
Doug Bingle
Mathematica Lab #11
#1
Compute the sum of the reciprocals of 3,5,7,9,...,63.
In[59]:=
Clear[lista, lista1]
In[60]:=
lista = Range[3, 63, 2]
Out[60]=
In[61]:=
Out[61]=
In[62]:=
{3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63}
lista1 = 1  lista
1 1 1
 , , ,
3 5 7
1 1
,
,
31 33
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
9 11 13 15 17 19 21 23 25 27 29
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
,
,
,
,
,
,
,
,
,
,
,
,
,
,

35 37 39 41 43 45 47 49 51 53 55 57 59 61 63
Total[lista1]
31 674 468 729 962 723 297 623 231
Out[62]=
18 472 920 064 106 597 929 865 025
#2
Compute 1/(1+1/(1+1/(1+(1/2))))
In[63]:=
first = 1  second
5
Out[63]=
In[64]:=
8
second = 1 + 1  third
8
Out[64]=
In[65]:=
5
third = 1 + 1  fourth
5
Out[65]=
In[66]:=
3
fourth = 1 + 1  2
3
Out[66]=
2
Printed by Wolfram Mathematica Student Edition
Page 1 of 6
11/8/2015
In[67]:=
Section A
Doug Bingle
first
5
Out[67]=
8
#3
Obtain a 50 signifigant digit approximation to the square root of Pi.
In[98]:=
Out[98]=
N√ (Pi), 50
1.7724538509055160272981674833411451827975494561224
#4
What is the 1000th prime?
In[69]:=
Out[69]=
Prime[1000]
7919
#5
Sketch the graphs of y=sin[x], y=sin[2x], and y=sin[3x], 0 ≤ x ≤ 2π, on one set of axes.
In[70]:=
Plot[{Sin[x], Sin[2 x], Sin[3 x]}, {x, 0, 2 π}]
1.0
0.5
Out[70]=
1
2
3
4
5
-0.5
-1.0
#6
What is the prime factorization of 2,381,400?
In[100]:=
Clear[x]
Printed by Wolfram Mathematica Student Edition
Page 2 of 6
6
11/8/2015
In[101]:=
Out[101]=
In[102]:=
Out[102]=
Section A
Doug Bingle
x = FactorInteger[2 381 400]
2
3
5
7
3
5
2
2
List[x]
( {2, 3} {3, 5} {5, 2} {7, 2} )
#7
Find two ways to find an approximate value for x for which 2x =100.
Method 1
In[72]:=
Clear[x]
In[73]:=
NSolve[2 ^ x ⩵ 100, x, Reals]
Out[73]=
{{x → 6.64386}}
Method 2
In[74]:=
Out[74]=
N[Log[2, 100]]
6.64386
#8
What is the 115 Fibonacci number? The 1115 Fibonacci number?
In[75]:=
Out[75]=
In[76]:=
Out[76]=
Fibonacci[115]
483 162 952 612 010 163 284 885
Fibonacci[1115]
46 960 625 891 577 894 920 915 085 010 622 289 470 462 518 359 149 677 075 881 383 631 822 660 890 718 642 869 603 
700 018 836 567 361 824 279 444 479 341 088 310 462 978 732 670 769 895 389 845 153 583 927 059 046 832 024 176 024 
794 070 671 098 298 816 588 315 827 802 770 672 734 166 457 585 412 100 971 385
#9
What are the greatest common divisor and least common multiple of 5,355 and 40,425?
Printed by Wolfram Mathematica Student Edition
Page 3 of 6
11/8/2015
In[77]:=
Out[77]=
In[78]:=
Out[78]=
Section A
Doug Bingle
GCD[5355, 40 425]
105
LCM[5355, 40 425]
2 061 675
#10
Find two ways to compute the sum of the squares of the first 20 consecutive integers.
Method 1
In[79]:=
Clear[x]
In[80]:=
Sum[x ^ 2, {x, 1, 20}]
Out[80]=
2870
Method 2
In[81]:=
Clear[x]
In[82]:=
 x^2
20
x=1
Out[82]=
2870
#11
Compute the sum of the reciprocals of 15,17,19,21,...,51.
In[83]:=
Clear[lista, lista1]
In[84]:=
lista = Range[15, 51, 2]
Out[84]=
In[85]:=
Out[85]=
In[86]:=
{15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51}
lista1 = 1  lista

1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
,
1
,
1
,
1
,
1
,
1
15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51
Total[lista1]
63 501 391 475 806 044 193
Out[86]=
1
96 845 140 757 687 397 075
Printed by Wolfram Mathematica Student Edition
Page 4 of 6

11/8/2015
Section A
Doug Bingle
#12
1
Compute the value of ( 1 +
1
2
+
1
3
1
2
+ 4 ) +( 1 +
2
2
+
2
3
Method 1
In[87]:=
Out[87]=
1
1
25
+
1
2
+
1
3
+
1
4
+
2
1
+
2
2
+
2
3
+
2
4
+
3
1
+
3
2
+
3
3
+
3
4
2
Method 2
In[88]:=
Out[88]=
In[89]:=
Out[89]=
In[90]:=
Out[90]=
In[91]:=
Out[91]=
list1 = Range[1, 3, 1]
{1, 2, 3}
list2 = Range1  2, 3  2, 1  2
1
3
 , 1, 
2
2
list3 = Range1  3, 3  3, 1  3
1 2
 , , 1
3 3
list4 = Range1  4, 3  4, 1  4
1 1 3
 , , 
4 2 4
In[92]:=
Clear[a, b, c, d, e]
In[93]:=
a = Total[list1]
b = Total[list2]
c = Total[list3]
d = Total[list4]
Out[93]=
6
Out[94]=
3
Out[95]=
2
3
Out[96]=
2
Printed by Wolfram Mathematica Student Edition
2
3
+ 4 )+( 1 +
Page 5 of 6
3
2
+
3
3
3
+ 4)
11/8/2015
In[97]:=
Section A
e = a+b+c+d
25
Out[97]=
2
Printed by Wolfram Mathematica Student Edition
Page 6 of 6
Doug Bingle