HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Python Programming
  2. /Python for Science and Maths
  3. /Trigonometry and Waves by Computer

Trigonometry and Waves by Computer

Python Programming · High School (11–12) · 2 courses, 21 worked problems, 40 practice questions

Sine and cosine describe anything that repeats, from a swinging pendulum to an alternating current. In Python, np.sin() and np.cos() work on whole arrays of angles in radians, so one line can draw a full wave. Changing the amplitude AAA, the frequency fff or the phase ϕ\phiϕ in y=Asin⁡(2πft+ϕ)y = A\sin(2\pi ft + \phi)y=Asin(2πft+ϕ) changes the shape, and a graph makes the change easy to see. Adding two waves in code shows interference and beats. You can also check identities such as sin⁡2θ+cos⁡2θ=1\sin^2\theta + \cos^2\theta = 1sin2θ+cos2θ=1 with numbers.

With practice you will be able to

  • Plot a sine wave and change its amplitude and frequency
  • Add two waves in code and see beats or interference
  • Convert between degrees and radians with NumPy

Lessons

  • Angles, the Unit Circle and Trigonometric GraphsWhy is sin(π) not exactly 0 in Python? Is sin(a + b) the same as sin a + sin b?High School (11–12)
  • Waves by Computer: Adding and FittingWhy do two close notes make beats? How can a fast wave look slow?High School (11–12)

Practice questions

Choose an answer, then check it. Each one shows a full explanation.

A sprinkler arm turns through 84 degrees. What does this print? import math; print(round(math.radians(84), 3))

An angle of 2.2 radians is changed to degrees. What does this print? import math; print(round(math.degrees(2.2), 1))

Which call gives the sine of an angle of 35 degrees?

A loop prints cosines of three angles. What does this print? import math; print(*[round(math.cos(math.radians(d))) for d in (0, 90, 180)])

Worked problems

Each one has a hint, the key idea and a full worked solution.

  • The minute hand of the clock tower in Rahim's town turns through 150° in 25 minutes…Easy
  • Maya prints the six ratios of the angles 0°, 15°, 30°, …, 90°…Easy
  • Ajay writes if math.sin(math.pi) == 0: and the program does not take the branch…Medium
  • A point is at an angle of 250° on the unit circle…Medium

Python labs

  • An angle toolkit
  • An identity checker
  • A wave and its speed
  • Fit a noisy sine

Related topics

  • Python for Science and Maths
  • NumPy Arrays
  • Graphs with matplotlib
  • Solving Equations
  • Calculus by Computer
  • Simulation and Randomness
  • Data Analysis with pandas
  • Chemistry by Computer
  • Biology by Computer

A program draws y = 6 * np.sin(4 * x - 1). What is the amplitude of the wave?

A list of angles in degrees. What does this print? import numpy as np; x = np.arange(0, 181, 30); print(len(x), x[-1])

Why is the tangent changed with t[np.abs(t) > 8] = np.nan before it is plotted?

A check of an identity on three angles. What does this print? import numpy as np; a = np.radians(np.array([10, 20, 30])); print(np.allclose(np.sin(a) ** 2 + np.cos(a) ** 2, 1))

Why compare np.sin(a) ** 2 + np.cos(a) ** 2 with 1 using np.allclose and not ==?

The true sine of a sum and the false rule, side by side. What does this print? import numpy as np; a, b = np.radians(25), np.radians(65); print(round(float(np.sin(a + b)), 2), round(float(np.sin(a) + np.sin(b)), 2))

All 40 practice questions on Trigonometry and Waves by Computer →

A program draws the wave y = 4 * np.sin(5 * x) for x from 0 to 2π…
Easy
  • The wave y = 2 sin(x - 0.8) is shifted to the right…Medium
  • Asha plots tan x for x from 0 to 4π. How many asymptotes does the graph have in that range? …Hard
  • Bhavna sets x = np.linspace(0, 360, 721) and plots np.sin(x), meaning to draw one turn in degrees…Medium
  • A student guesses three formulas for cos 2a: 2 cos² a - 1, 1 - 2 sin² a and 2 cos a…Medium
  • Chandra checks 1 + tan² a = 1/(cos² a) on the angles 0°, 15°, 30°, …, 345°…Medium
  • Dev tries the rule sin(a + b) = sin a + sin b with a = 20° and b = 50°…Easy
  • A wave on a rope has a wavelength of 1.5 m and a frequency of 4.0 Hz…Easy
  • All 21 worked problems on Trigonometry and Waves by Computer →