Interaction with a graphics
This code is very efficient.
> p1=plot(.3/x, (x, .38,
> 2),thickness=2,ticks=[[], []])
> p2=plot(.4/x, (x, .5, 2),thickness=1,
> linestyle="--") p3=plot(0.6-.305*x,
> (x, 0, 1.96),thickness=2,color='red')
> t1=text("$\overline{U}^1(x)$", (2,
> .3), fontsize=12, color="black")
> t2=text("$\overline{U}^\star(x)$", (2,
> .1), fontsize=12, color="black")
> t3=text("$x^\star$", (1, -.05),
> fontsize=12, color="black")
> t4=text("$y^\star$", (-0.05,.3),
> fontsize=12, color="black")
> t5=text("$R/p_x$", (2, -.05),
> fontsize=12, color="black")
> t6=text("$R/p_y$", (-0.075, .6),
> fontsize=12, color="black")
> c1=circle((1,.3), .015, fill=True,
> edgecolor='green', facecolor='green')
> l1=line(([1,0],[1,0.2975],[0,0.2975]),
> linestyle="--",color='red')
> g=p1+p2+p3+t1+t2+t3+t4+t5+t6+l1+c1
> g.axes_labels(['$x$','$y$'])
> g.set_legend_options(font_size=6)
> g
up to the fact that I cannot use \frac {R}{p_x} in the plot.
It does exactly what I expect. I use the last version of sagemath on Windows. I want to interact it on the parameters $R$, $p_x$, $p_y$, to plot the contours $U$ and with the help of sliders change the curve until it become tangent to the line. I do not know why all my tentative to use interact with a less complex graphics fails. Need help. Thank you.
PS Need help does'nt signifie to do the work for me but to help me to start. I want to become expert in Sagemath
You can use
\frac{R}{x_p}
in the plot: you simply need to enter it as a raw string, via the prefix 'r' in front of the quotes. This guarantees that the backslash of\frac
is correctly interpreted as part of a LaTeX command:Equivalently, you can use a double backslash: