So i'm struggling with these parametric equations in Sympy.
() = cos() − sin() and () = sin() + cos()
with ∈ ℝ∖{0}.
import matplotlib.pyplot as plt
import sympy as sp
from IPython.display import display
sp.init_printing()
%matplotlib inline
This is what I have to define them:
f = sp.Function('f')
g = sp.Function('g')
f = sp.cos(th) - sp.sin(a*th)
g = sp.sin(th) + sp.cos(a*th)
I don't know how to define a
with the domain ℝ∖{0}
and it gives me trouble when I want to solve the equation
()+()=0
The solution should be:
=[3/4,3/4,/2(−1),/(+1)]
Next I want to plot the parametric equations when a=2, a=4, a=6 and a=8
. I want to have a different color for every value of a
. The most efficient way will probably be with a for
-loop.
I also need to use lambdify
to have a list of values but I'm fairly new to this so it's a bit vague.
This is what I already have:
fig, ax = plt.subplots(1, figsize=(12, 12))
theta_range = np.linspace(0, 2*np.pi, 750)
colors = ['blue', 'green', 'orange', 'cyan']
a = [2, 4, 6, 8]
for index in range(0, 4):
# I guess I need to use lambdify here but I don't see how
plt.show()
Thank you in advance!