0% found this document useful (0 votes)
52 views7 pages

Finalassignment

1. The document contains 12 math and coding problems assigned to a team. The problems include finding the LCM and GCD of integers, finding factors of large numbers, determining the number of co-prime integers between ranges, solving systems of linear equations, evaluating limits, and plotting various functions. 2. SageMath, a open-source mathematical software, is used to solve the problems through coding implementations of mathematical operations and functions. 3. The assigned problems cover a range of mathematical topics including number theory, calculus, linear algebra, and plotting functions to demonstrate proficiency with SageMath.

Uploaded by

Manas Salian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views7 pages

Finalassignment

1. The document contains 12 math and coding problems assigned to a team. The problems include finding the LCM and GCD of integers, finding factors of large numbers, determining the number of co-prime integers between ranges, solving systems of linear equations, evaluating limits, and plotting various functions. 2. SageMath, a open-source mathematical software, is used to solve the problems through coding implementations of mathematical operations and functions. 3. The assigned problems cover a range of mathematical topics including number theory, calculus, linear algebra, and plotting functions to demonstrate proficiency with SageMath.

Uploaded by

Manas Salian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

%md

# Assignment

Assignment
%md
# Team - 3

Team - 3
%md
### 1. Find the lcm of any two integers $a$ and $b$ and hence verify that
$lcm(a, b) × gcd(a, b) = a × b$

1. Find the lcm of any two integers a and b and hence


verify that lcm(a, b) × gcd(a, b) =a×b
%hide
%hide
a, b = 12, 30
lcm(a, b) * gcd(a, b) == a *b

True

%md
### 2. Let d be the gcd of three integers $a$, $b$, and $c$. Find
integers $p$, $q$,$r$ such that $d = pa + qb + rc$

2. Let d be the gcd of three integers a, b, and c. Find


integers p, q ,r such that d = pa + qb + rc
var('p,q,r')
d=gcd(gcd(a,b),c)
solve([d==p*a+q*b+r*c],[p,q,r])

(p, q, r)
[[p == -(c*r7 + b*r8 - 1)/a, q == r8, r == r7]]

%md
### 3. Find the factors of the sum of digits of $1275!$

3. Find the factors of the sum of digits of 1275!

f = factorial(1275)
s = sum(f.digits())
s.factor()

2^3 * 3^5 * 7

%md
### 4. Let $d = 6$. Find how many integers are there strictly between $n
= 60$ and $m = 600$ which are co-prime to $d$

= 6. Find how many integers are there strictly


4. Let d
between n = 60 and m = 600 which are co-prime to d

d=6
n = []
for i in range(60,601):
if gcd(d,i)==1:
n.append(i)
len(n)

180

%md
### 5. Find a positive integer $n$ such that the number of primes between
$2$ and $n$ is $10000$

5. Find a positive integer n such that the number of


primes between 2 and n is 10000
%md
###### The prime-counting function, denoted as $π(n)$, represents the
number of prime numbers less than or equal to n. According to the Prime
Number Theorem, we have: $π(n)∼n/log(n)$

The prime-counting function, denoted as π(n), represents the number of prime numbers
less than or equal to n. According to the Prime Number Theorem, we have: π(n) ∼
n/log(n)

def find_n(num_primes):
n = 2
count = 0
while count < num_primes:
n += 1
if is_prime(n):
count += 1
return n

num_primes = 10000
n = find_n(num_primes)
print(f"The smallest positive integer n such that there are {num_primes}
primes between 2 and n is {n}.")

The smallest positive integer n such that there are 10000 primes between
2 and n is 104743.

%md
### 6. Let $n = 562$. Find the number of integers $k$ between $1$ and $n$
which are co-prime to $n$. If this number is $k$, then $k$ is called the
Euler-phi function of $n$, denoted by φ(n). Verify this using the inbuilt
SageMath function ‘euler_phi(n)’

6. Let n = 562. Find the number of integers k between 1


and n which are co-prime to n. If this number is k, then k
is called the Euler-phi function of n, denoted by φ(n).
Verify this using the inbuilt SageMath function
‘euler_phi(n)’

n=562
c = []
for i in range(1,n+1):
if gcd(n,i)==1:
c.append(i)
k = len(c)
k == euler_phi(n)

True

%md
### 7. Define three linear equations in $x$,$y$,$z$ and Solve the same
using SageMath

7. Define three linear equations in x,y ,z and Solve the


same using SageMath

var('x,y')
solve([2*x+3*y-z==15,x-3*y+3*z==-4,4*x-3*y-z==19],[x,y,z])

(x, y)
[[x == 5, y == 1, z == -2]]

%md
### 8. Find the roots of the equation $x^{4}-14x^{3}+63x^{2}-112x+64=0$
using SageMath.

8. Find the roots of the equation x4 − 14x3 + 63x2 −


112x + 64 = 0 using SageMath.

f(x) = x^4-14*x^3+63*x^2-112*x+64==0
f.roots()

[(-1/2*sqrt(2) - 1/2*sqrt(-14*sqrt(2) + 19) + 7/2, 1), (-1/2*sqrt(2) +


1/2*sqrt(-14*sqrt(2) + 19) + 7/2, 1), (1/2*sqrt(2) - 1/2*sqrt(14*sqrt(2)
+ 19) + 7/2, 1), (1/2*sqrt(2) + 1/2*sqrt(14*sqrt(2) + 19) + 7/2, 1)]

%md
### 9. Draw the polar plot of the equations $r = sinθ + cosθ$ , $r = 2
sin θ$ in the interval $[0, 2π]$ using SageMath

9. Draw the polar plot of the equations r = sinθ + cosθ


,r = 2sinθ in the interval [0, 2π] using SageMath
var('theta')
p1 = polar_plot(sin(theta) + cos(theta), (theta, 0, 2*pi), color='red',
legend_label=r'$r = \sin(\theta) + \cos(\theta)$')
p2 = polar_plot(2*sin(theta), (theta, 0, 2*pi), color='blue',
legend_label=r'$r = 2\sin(\theta)$')
(p1 + p2).show()

theta

%md
### 10. Plot a 2D graph of the equation $f(x) = x tan(x)$ in using
SageMath

10. Plot a 2D graph of the equation f (x) = xtan(x) in


using SageMath

var('x')
f(x) = x * tan(x)
plot(f, xmin=-10, xmax=10, ymin=-10, ymax=10, figsize=[5,5])

x
%md
### 11. Use SageMath to find the value of$$\lim_{{x \to 0}} \frac{{\tan x
- x}}{{x^2 \tan x}}$$

11. Use SageMath to find the value of

tan x − x
lim
x→0 x2 tan x

f(x) = (tan(x)-x)/((x^2)*tan(x))
limit(f(x),x=0)

1/3

%md
### 12. Solve the following system of linear equation $2x + y + 4z = 12$,
$4x + 11y − z = 33$, $8x − 3y + 2z = 20$
12. Solve the following system of linear equation 2x +
y + 4z = 12, 4x + 11y − z = 33, 8x − 3y + 2z =
20
var('x,y,z')
solve([2*x + y + 4*z == 12,4*x + 11*y-z ==33,8*x-3*y + 2*z ==20],[x,y,z])

(x, y, z)
[[x == 3, y == 2, z == 1]]

You might also like