Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Quelques notebooks SAGE / Python. Équations différentielles ou calcul multivariable.

Project: Calcul Libre
Views: 1413
Image: ubuntu2004
Kernel: SageMath 9.2

See the family of figures at the end of section 10.3

We show how to make a figure containing several curves, but not on the same axis systems.

We plot several members of the family of curves r=1+csinθr = 1+c\sin \theta and we arrange the curves in an array.

var('t') C=[2.5, 1.7, 1, 0.7, 0.5, 0.2, 0, -0.2, -0.5, -0.8, -1, -2] # The list containing the values for c Curves = [polar_plot(1+c*sin(t),0,t,2*pi) for c in C] Array = graphics_array(((Curves[0],Curves[1], Curves[2], Curves[3]), (Curves[4],Curves[5], Curves[6], Curves[7]), (Curves[8],Curves[9], Curves[10], Curves[11]))) Array.show(figsize = 8)
Image in a Jupyter notebook

Thge result is pretty good, but some improvements can be done:

  • For instance one may want to put a legend telling what is the value of cc corresponding to each figure,

  • The font size of the axes are slightly big.

The two improvements are obtained by running a loop through all the elements in the list Curves. See what is the effect of changing the loc value

var('t') C=[2.5, 1.7, 1, 0.7, 0.5, 0.2, 0, -0.2, -0.5, -0.8, -1, -2] # The values for c Curves = [polar_plot(1+c*sin(t),0,t,2*pi, legend_label = '%s'%c.n(digits=2)) for c in C] for g in Curves: g.set_legend_options(font_size = 8, loc = 7) g.fontsize(8) Array = graphics_array(((Curves[0],Curves[2], Curves[2], Curves[3]), (Curves[4],Curves[5], Curves[6], Curves[7]), (Curves[8],Curves[9], Curves[10], Curves[11]))) Array.show(figsize = 9)
Image in a Jupyter notebook