Tags:Python

Plotting Expressions and Solving Equations Numerically in Python

Author: David Manuel
In this video, it is showin how to plot an expression in Python. Then to use the plot to help obtian numerical approximations of solutions. 

Transcript 05

Exercises

Python Code:
from sympy import *

matplotlib notebook

theta=symbols('theta')
LHS=50*tan(theta)-13.61/(cos(theta))**2
plot(LHS,(theta,0,1.5),ylim=[-20,20])
angle1=nsolve(LHS,theta,0.3)
angle2=nsolve(LHS,theta,1.3)
print('The angle needed is',angle1*180/pi.evalf(),'or',angle2*180/pi.evalf(),'degrees')

Open Python Notebook File