Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.1 KB

25. Unit 2 - Lesson 12.md

File metadata and controls

37 lines (30 loc) · 1.1 KB

Trigonometric Functions

Q1.

from math import *

print("degrees 0 30 45 60 90")
print("sin",sin(radians(0)),sin(radians(30)),sin(radians(45)),sin(radians(60)),sin(radians(90)))
print("cos",cos(radians(0)),cos(radians(30)),cos(radians(45)),cos(radians(60)),cos(radians(90)))
print("tan",tan(radians(0)),tan(radians(30)),tan(radians(45)),tan(radians(60)),tan(radians(90)))

# write your code here

Mathematical Constants

Q1.

# Write a program to print Mathematical constants
import math

print("constant\tvalue\tdata type")

print("pi\t", math.pi, "\t",type(math.pi) ) # find type of math.pi using type function

print("e\t", math.e, "\t",type(math.e) )# find type of math.e

print("inf\t", "{:17}".format(math.inf), "\t",type(math.inf) ) # find type of math.inf

print("NaN\t", "{:17}".format(math.nan), "\t",type(math.nan) ) # find type of math.nan

Q2.

import math
print("constant\tvalue\tdata type")
print("pi\t",math.pi,"\t",type(math.pi))
print("e\t",math.e,"\t",type(math.e))
print("inf\t","{:17}".format(math.inf),"\t",type(math.inf))
print("NaN\t","{:17}".format(math.nan),"\t",type(math.nan))