ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 04 Oct 2017 07:53:59 +0200convert parametric equations to a normal onehttps://ask.sagemath.org/question/39028/convert-parametric-equations-to-a-normal-one/I solved my problem into parametric equations as shown below:
x == 3/4*sqrt(2*m^2 + 2)*m/(m^2 + 1), y == 1/4*sqrt(2*m^2 + 2)/(m^2 + 1)
But I meet difficult on how to convert into a normal one, I want to get an equation with `x, y` only. For another general description: is there any function will help solve parametric equations into a normal one like solve: `x == cos(theta), y == sin(theta)` into `x ^ 2 + y ^ 2 == 1`. I learned how to solve it with my pen, but I want a solution with Sage code.
Thanks.lancasterWed, 04 Oct 2017 07:53:59 +0200https://ask.sagemath.org/question/39028/Parametric plot with piecewise inputhttps://ask.sagemath.org/question/35404/parametric-plot-with-piecewise-input/ I'm trying to plot a parametric function, which is defined piecewise. For some reason, the plot just jumps to the last piece of the parametric function and plots that.
Here's what I want to plot.
t = var('t')
r = 2
def f(x):
if 0 <=x <=r:
return (x, -r)
elif r<x<=r + pi*r:
return (cos(x-r), -(r + sin(x-r)))
elif r + pi*r < x <= 3*r + pi*r:
return (-x + 2*r + pi*r, r)
elif 3*r + pi*r < x <= 3*r + 2*pi*r:
return (cos(x - 3*r), -(r + sin(x-r)))
else:
return (x - 4*r - 2*pi*r, -r)
parametric_plot(f(t), (t, 0, 4*r + 2*pi*r))
It just returns a straight line of length 4*r + 2*pi*r with y coordinate -rjford1906Thu, 03 Nov 2016 20:33:56 +0100https://ask.sagemath.org/question/35404/Rendering a torus in Tachyonhttps://ask.sagemath.org/question/26442/rendering-a-torus-in-tachyon/I'm trying to figure out how to render a torus using Tachyon. The problem is that a solid torus requires a 2 variable parametric equation, and it seems Tachyon only likes to use single variable parametric equations. Is there a way around this? Jeff FordMon, 06 Apr 2015 01:57:06 +0200https://ask.sagemath.org/question/26442/Evenly space points along a parametric curve?https://ask.sagemath.org/question/8474/evenly-space-points-along-a-parametric-curve/Are there arc-length parametrization functions hidden somewhere in Sage? I have some 3D parametric curves (smooth) of length `L` along which I would like to put `n` dots at regular intervals. What I've been doing so far is using numerical integration to find the arc length parameter, and then using `find_root` to find the positions of the dots (spaced by arc length `L/n`).
This is pretty slow, and has the further limitation that I need to specify a region on which `find_root` should work. If the parametrization is really uneven, it's tough to develop a good initial estimate for where to look.
So, does anyone have other ideas for doing this? Thanks!
UPDATE: Here are some examples -- they're different fibers in the Hopf fibration, and are given by `r = (rx,ry,rz)`
Example 1:
rx(t) = -0.309*cos(t)*arccos(0.951*cos(-t - 1.57))/(sqrt(-0.904*cos(-t - 1.570)^2 + 1)*pi)
ry(t) = -0.309*sin(t)*arccos(0.951*cos(-t - 1.57))/(sqrt(-0.904*cos(-t - 1.57)^2 + 1)*pi)
rz(t) = 0.951*sin(-t - 1.57)*arccos(0.951*cos(-t - 1.57))/(sqrt(-0.904*cos(-t - 1.57)^2 + 1)*pi)]
Example 2:
rx(t) = -0.707*cos(t)*arccos(0.707*cos(-t - 1.57))/(sqrt(-0.5*cos(-t - 1.57)^2 + 1)*pi)
ry(t) = -0.707*sin(t)*arccos(0.707*cos(-t - 1.57))/(sqrt(-0.5*cos(-t - 1.57)^2 + 1)*pi)
rz(t) = 0.707*sin(-t - 1.57)*arccos(0.707*cos(-t - 1.57))/(sqrt(-0.5*cos(-t - 1.57)^2 + 1)*pi)
nilesMon, 14 Nov 2011 21:44:56 +0100https://ask.sagemath.org/question/8474/Multiple loops in an animation?https://ask.sagemath.org/question/9205/multiple-loops-in-an-animation/I want to use two loops to produce an animation of some gridlines changing gradient.
Essentially making all these lines:
t=var('t')
p1=Graphics()
p2=Graphics()
for i in range(-5,5,1):
p1 +=parametric_plot((t,i),(t,-5,5),color="red")
p2 +=parametric_plot((i,t),(t,-5,5),color="blue")
show(p1+p2)
Move like these lines all at once:
t=var('t')
p1=Graphics()
p2=Graphics()
v = []
for a in srange(-5,5,1):
p1 =parametric_plot((t,t*a),(t,-5,5),color="red")
p2 =parametric_plot((t*a,t),(t,-5,5),color="blue")
v.append(p1+p2)
j = animate (v, xmin=-2,ymin=-2,xmax=2,ymax=2,figsize=[2,2])
j.show()
How can I combine these two into one animation? Insaneg33kSat, 04 Aug 2012 12:53:38 +0200https://ask.sagemath.org/question/9205/Function value at parametric pathhttps://ask.sagemath.org/question/8897/function-value-at-parametric-path/Hi,
How can I get the value of a 2D function, say f(x,y)=x^3+y^3, along the path determined by a parametric function, say M(x(t)=cos(t),y(t)=sint(t))?
sagembFri, 20 Apr 2012 10:59:08 +0200https://ask.sagemath.org/question/8897/there are more variables than variables rangeshttps://ask.sagemath.org/question/8895/there-are-more-variables-than-variables-ranges/trying to solve a parametric plot problem but Sage won't let me graph function because it says I have more variables than variable ranges. Can someone help me fix this problem.johnt18Fri, 20 Apr 2012 06:40:51 +0200https://ask.sagemath.org/question/8895/wrong variable in solution of an inequalityhttps://ask.sagemath.org/question/8527/wrong-variable-in-solution-of-an-inequality/Hi everybody,
I am new to sage, trying to solve an inequality using sage, i.e:
`m,a,d,w,e,c=var('m,a,d,w,e,c')`
`x_br=1/2*(2*c*d - d*e - d*w)/(2*d*m - e + w)`
`solve(x_br<=d/2,m)`
But what I get is:
`[[w == -2*d*m + c], [d == 0], [max(-2*d*m + e, -d*m + c) < w, 0 <
d], [-2*d*m + e < w, w < -d*m + c, d < 0, -d*m + e < c],
[-d*m + c < w, w < -2*d*m + e, d < 0, c < -d*m + e], [w <
min(-d*m + c, -2*d*m + e), 0 < d]]`
It is solved based on `w` instead of `m`. I tried different variables but the result is always the same. What should I do to have solution based on `x`?
Thank you in advance.
ElmiSat, 03 Dec 2011 10:37:53 +0100https://ask.sagemath.org/question/8527/