0

I am new to python. I want to calculate M for the expression given in the code

from sympy import *
from sympy.plotting import plot_parametric
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D

a = 45

t = symbols('t')
for alpha in range(.5, 6, .1):
    M = a * sqrt(cos(2 * t) + sqrt(pow(alpha, 4) + pow(sin(2 * t), 2)))

x = M * cos(t)
y = M * sin(t)
plot_parametric(x, y, (t, 0, 2 * pi))

I tried to generate data for alpha^4 as

x=range(.5,6,.1)
k=[n**4 for n in x]

but that also of no good. Please help.

quamrana
  • 37,849
  • 12
  • 53
  • 71
  • 1
    Here a nice case of WRONG question post : your code does throw an error ( a `TypeError` error) and you don't even mention it nor paste the error. When asking something give the keys to us to understand the problem the fastest as possible. The hardest the problem is to get, the fewer people will stay and help you – azro Apr 11 '21 at 08:58
  • If you are using matplotlib, you may as well use `numpy.arange` or `numpy.linspace`. – 9769953 Apr 11 '21 at 09:13
  • On the duplicate page I posted a solution: https://stackoverflow.com/a/67053708/1089161 But if you don't care where the points are calculated when plotting then linspace with the desired number of points should work fine. But if you do want to control the spacing and know that *in theory* what you have said should work, then the method I gave there will work. – smichr Apr 12 '21 at 06:49

0 Answers0