I've tried a few formats and ideas, but the syntax is kind of confusing. Help is appreciated, danke.
How would one write the parametric function r=e ^cos(θ) −2cos(4θ)+sin ^5 ( θ/12) in Python?
784 Views Asked by KarlMarxsDog At
4
There are 4 best solutions below
1
On
A very straightforward, but naive approach would be to just use the math library, which is a standard library in python.
import math
def r(theta):
return math.pow(math.e, math.cos(theta)) - 2 * math.cos(4*theta) + math.pow(math.sin(theta/12), 5)
better results are possible with libraries for scientific computing, like numpy or other members of the scipy ecosystem.


