 CoCalc Public Files1 / 6 / Lab1_SageMath_Variables.ipynb
Authors: ANGEL MORE, Kristin McCully
Compute Environment: Ubuntu 20.04 (Default)
In :
#Exercise 1
3

3
In :
#Exercise 2
1775

1775
In :
#Exercise 3
2*2

4
In :
#Exercise 4
10/4

5/2
In :
#Exercise 5
1775/6

1775/6
In :
#Exercise 6
1775/6.0

295.833333333333
In :
#Exercise 7
(2.5^6)

244.140625000000
In :
#Exercise 8
mice = 3
mice

3
In :
#Exercise 9
prod = 7*94
prod

658
In :
#Exercise 10 - a is a variable that is assigned to the value 2*26. b is a variable that is assigned to the value 29*12. val is assigned to the value of a*b. the value of val is printed.

In :
#Exercise 11
a = 67*45
b = 93*442
ab = a + b
ab

44121
In :
#Exercise 12
k = 76.2 + 35.1
sqrt(k)

10.5498815159223
In :
#Exercise 13
bignum = mice^20
bignum

3486784401
In :
#Exercise 14 - the value of dalmation in the first line is asssigned to 100

In :
#Exercise 15 - the line dalmation=dalmation+1 will add 1 to orginal value of dalmation which is 100, so now the the value of dalmation is 101

In :
#Exercise 16
num = 5
num = num + 2
num

7
In :
#Exercise 17
sqrt(37.0)

6.08276253029822
In :
#Exercise 18
ln(27.5)

3.31418600467253
In :
#Exercise 19
sqrt(abs(625-810.0))

13.6014705087354
In :
#Exercise 20
sqrt(ln(5^8.7))

3.74193931513816
In :
#Exercise 21, part 1
number = 625-810.0
absolute = abs(number)
sqrt(absolute)

13.6014705087354
In :
#Exercise 21, part 2
number1 = 5^8.7
logof10 = ln(5^8.7)
sqrt(logof10)

3.74193931513816
In :
#Exercise 22
abs = -2

In :
#Exercise 23
ln(35.0)

3.55534806148941
In :
#Exercise 24
plot(sqrt(x), (x,0,1000)) In :
#Exercise 25
plot(abs(x),(x,-10,10)) In :
#Exercise 26
plot(5*x^4, (x,-2,2), color = "green") In :
#Exercise 27
plot(x, (x, -1, 1), color = "pink") + plot(x^50, (x, -1, 1), color = "purple") In [ ]:


In [ ]: