#範例4-1:極坐標系統(Polar coordinate system) #sympy沒有提供polar的網格與運算,只能用plot_parametric畫(x,y) #cmath + matplotlib模組,有提供ploar網格,可以直接畫極坐標圖 from sympy import * #(1).若用symbols+plot():則畫出正弦圖種類圖,不是圓 theda = symbols('theda') f = '5*cos(theda) + 5*sin(theda)' plot(f,(theda,0,pi)) #print('sin(pi/6)=', f.subs(theda,pi/6)) #(2).若用plot_parametric:則可畫出極坐標圖,是圓 theda = symbols('theda') #plot_parametric(x軸值, y軸值,(變數範圍,-5,5)) #用複數的概念,用plot_parametric(x, yi)畫圖 plot_parametric(cos(theda), sin(theda), (theda, -5, 5))