bal.py

Created by vnap0v

Created on May 01, 2025

378 Bytes

This code tests the matplotlib library of the calculator. It plots ballistic trajectories for a series of different starting angles. It uses libraries math, numpy and matplotlib.pyplot. This code can run on CPython as well. Tested on the calculator using software version 23.2.6.


from math import *
from matplotlib.pyplot import *
import numpy as np
def bal(t,alpha,vo):
  x=t*vo*np.cos(alpha)
  y=t*vo*np.sin(alpha)-(t**2)*0.5*9.81
  return x,y
def drawcurves():
  tt=np.linspace(0,2.5,20)
  angles=np.linspace(5,85,8)
  for i in angles:
    a=radians(i)
    xx,yy=bal(tt,a,10)
    plot(xx,yy)
  grid()
  axis((-1,13,-2,6))
  show()

drawcurves()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.