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.Sat, 10 Apr 2021 09:12:55 +0200Problem with plotting a 3d Bezier curvehttps://ask.sagemath.org/question/56590/problem-with-plotting-a-3d-bezier-curve/ I have a problem with plotting a Bezier spline in 3d.
In 2d this simply works:
p2d = [[(3.0,0.0),(3.0,0.13),(2.94,0.25),(2.8,0.35)],
[(2.7,0.44),(2.6,0.5),(2.5,0.5)],
[(2.36,0.5),(2.24,0.44),(2.14,0.35)],
[(2.05,0.25),(2.0,0.13),(2.0,6.1e-17)]]
bezier_path(p2d)
But when I want to plot it in 3d, this line
bezier_path(p2d).plot3d()
or
p3d = [[(3.0,0.0,0.0),(3.0,0.13,0.0),(2.94,0.25,0.0),(2.8,0.35,0.0)],
[(2.7,0.44,0.0),(2.6,0.5,0.0),(2.5,0.5,0.0)],
[(2.36,0.5,0.0),(2.24,0.44,0.0),(2.14,0.35,0.0)],
[(2.05,0.25,0.0),(2.0,0.13,0.0),(2.0,6.1e-17,0.0)]]
bezier3d(p3d)
both give me the following error: TypeError: unable to convert -(t - 1)^3 to an integer.
What am I doing wrong?RozaThSat, 10 Apr 2021 09:12:55 +0200https://ask.sagemath.org/question/56590/Why am I getting a type error when I attempt to take the projective closure of this intersection?https://ask.sagemath.org/question/56448/why-am-i-getting-a-type-error-when-i-attempt-to-take-the-projective-closure-of-this-intersection/I am attempting to take the projective closure of the intersection of the following affine polynomials (not the intersection of the closure!):
$$y^3-y-x^2= 0 $$
$$w^3-w+y^7-y^5-x^4y^3+x^4y = 0.$$
This affine intersection is a curve of dimension one. Unfortunately, I haven't been able to enter this lovely affine curve defined by this intersection into sage. When I attempt as follows:
A.<x,y,w> = AffineSpace(QQ, 3)
P.<u,v,t,s>=ProjectiveSpace(QQ,3)
C = Curve([y^3-y-x^2, w^3-w+y^7-y^5-x^4*y^3+x^4*y], A)
D=C.projective_closure(1,P)
I get an error at the definition of C due to the second polynomial:
TypeError: F (=[-x^4*y^3 + y^7 + x^4*y - y^5 + w^3 - w]) must be a list or tuple of polynomials of the coordinate ring of A (=Affine Space of dimension 3 over Finite Field of size 3)
I am so confused because this is absolutely in the coordinate ring of $A$. Why am I getting this type error? How can I enter this affine intersection into sage, so that I may take its closure?
_______________
As an aside, I can enter the intersection of the closure, which is not what I want, as follows:
x,y,z,w = GF(3)['x,y,z,w'].gens()
C = Curve([y^3-y*z^2-x^2*z, w^3*z^4-w*z^6+y^7-y^5*z^2-x^4*y^3+x^4*y*z^2]); C
The intersection of the closure has an extra irreducible component $[x: 0: w: 0]$,
masseygirlThu, 01 Apr 2021 05:08:59 +0200https://ask.sagemath.org/question/56448/Space-filling curve (Peano curve or Hilbert curve)https://ask.sagemath.org/question/53424/space-filling-curve-peano-curve-or-hilbert-curve/Is there a function to plot iterations of Peano curve or Hilbert curve in Sagemath?azerbajdzanSat, 12 Sep 2020 18:43:19 +0200https://ask.sagemath.org/question/53424/Tangent vector fieldhttps://ask.sagemath.org/question/53263/tangent-vector-field/Hello over there.
I'm trying to calculate the norm, or the norm squared, of a vector field tangent to a curve over a manifold. The examples on **Curves in Manifold** and **Vector Fields** from the documentation work fine, but when I try a tangent to a curve I get the error `ValueError: the two subsets do not belong to the same manifold`.
Here is my minimal example:
N = Manifold(2, 'N', latex_name=r'\mathcal{N}',structure='Lorentzian')
var('u v')
chart_N.<u,v> = N.chart()
R.<t> = RealLine()
beta = N.curve({chart_N: [t, sech(t)]}, (t,0, oo), latex_name=r'\beta')
vbeta = beta.tangent_vector_field()
g=N.metric(name='g', latex_name=r'g_{\mathcal{N}}')
g[0,0]=-1
g[1,1]=cosh(u)**2
Everything is fine until here. I got the error when I tried
g(vbeta,vbeta)
or
vbeta.norm(metric=g)
What I'm missing?
Thank you in advance.cav_rtWed, 02 Sep 2020 18:44:50 +0200https://ask.sagemath.org/question/53263/elliptic curve scalar multiplicationhttps://ask.sagemath.org/question/52572/elliptic-curve-scalar-multiplication/ anyone know how to implement sagemath for the following:
i work on algo 1 & 2 (kanayama 2014 - Implementation of an Elliptic Curve Scalar Multiplication Method Using Division Polynomials)leaMon, 20 Jul 2020 05:18:20 +0200https://ask.sagemath.org/question/52572/Get point coordinates of curve over number fieldhttps://ask.sagemath.org/question/51672/get-point-coordinates-of-curve-over-number-field/Suppose I have equation of curve `C`:
curve
# => y^2 + (x^2 + x)*y + x
curve.parent()
# => Univariate Polynomial Ring in y over Rational function field in x over Rational Field
and I know that there is a point with `x` value is a root of another equation (i.e. element of corresponding Number Field):
equation
# => x^3 + x^2 - 2*x - 9/2
equation.parent()
# => Univariate Polynomial Ring in x over Rational Field
is x-coordinate of some point of `C`.
How to properly get y-coordinate of `C` in `x`?
It is not as easy as it seems because of conversion problems.
My workaround is as following:
FF.<z> = NumberField(equation)
P.<x,y> = QQ[]
u = P(curve).subs(x=z)
P.<y> = FF[]
return z, P(u).roots()[0][0]
and it doesn't seem right.
Are there more elegant way of doing it?
P.S. `curve` is constructed as follows:
F = FunctionField(QQ, 'x')
x = F.gen()
R.<y> = F[]
curve = y^2 + (x^2 + x)*y + x;
But it was done in another place so I have no direct access to `x` and `y` from above code.petRUShkaMon, 01 Jun 2020 14:56:20 +0200https://ask.sagemath.org/question/51672/Can you specify an explicit curve by specifying its x,y points ?https://ask.sagemath.org/question/51146/can-you-specify-an-explicit-curve-by-specifying-its-xy-points/I was wondering if I can specify a curve by giving its x,y points:
(0,0),(0.5, 0.25),(0.6, 0.36),(2.0, 4.0)
and then do various other manipulation of this curve like, interpolation, derivative at some point, aread under the curve between two points (integral) etc?MoWed, 29 Apr 2020 16:38:12 +0200https://ask.sagemath.org/question/51146/Intersection of implicitely defined surfaceshttps://ask.sagemath.org/question/47944/intersection-of-implicitely-defined-surfaces/ Is there a general way to visualize the space curve defined by the intersection of 2 implicitely defined surfaces?
I know, this has been discussed here before with the following suggested solutions:
1. Visualize all equations in the same plot - this has the disadvantage that surfaces - even if opaque, distract attention and may obstruct the view on the intersection curves
2. Combine the defining equations into a system of euations and solve it, present the solutions as parametric plots - this doesn't work with complex surfaces where Sage cannot solve the system.
I know, some 3D objects have an intersection() method, but apparently not those generated by implicit_plot3d.
But maybe, someone has another solution?
IngoMon, 16 Sep 2019 22:36:53 +0200https://ask.sagemath.org/question/47944/fill between curve and linehttps://ask.sagemath.org/question/45848/fill-between-curve-and-line/Have the function 4-x^6, and the line y=x, how to fill only the area enclosed by the curve and the linegoldsilverbronzeWed, 20 Mar 2019 23:29:32 +0100https://ask.sagemath.org/question/45848/Map between projective curves defined in an extension fieldhttps://ask.sagemath.org/question/38263/map-between-projective-curves-defined-in-an-extension-field/For example, suppose I have the following 2 projective curves:
k = GF(13)
x,y,z = ProjectiveSpace(k, 2, 'x,y,z').gens()
E = Curve(2*x^2 + 8*y*z + 8*z^2)
W = Curve(x^2 + y*z + z^2)
I like to define a map from E to W that involves $\sqrt 2$ and $\sqrt 8$, which do not exist in k = GF(13), but do in an extension of k:
x = PolynomialRing(k,'x').gen()
K = GF(13**2, 'w', modulus=x^2-2)
w = K.gen()
So $w = \sqrt 2$ and $2w = \sqrt 8$. The map I like to define sends $(x:y:z)$ to $(wx:2wy:2wz)$.
In this particular example, it's obvious that $(wx:2wy:2wz) = (x:2y:2z)$; but it's just a simple example do demonstrate the problem.
Something like this doesn't work:
x,y,z = ProjectiveSpace(k, 2, 'x,y,z').gens() #or ProjectiveSpace(K, 2, 'x,y,z').gens()
E.Hom(W)([w*x, 2*w*y, 2*w*z])
Thank you.RoadFri, 14 Jul 2017 18:08:01 +0200https://ask.sagemath.org/question/38263/curve fitting coefficients.https://ask.sagemath.org/question/32057/curve-fitting-coefficients/get the model coefficients, but I can not use them to plot the graph. How to solve?
see the code:
dados = [(0, -0.183440428023042),
(0.200000000000000, -0.131101157495126),
(0.400000000000000, 0.0268875670852843),
(0.800000000000000, 0.110532679260319),
(1.00000000000000, 0.253944632998395),
(1.20000000000000, 0.257190123748649),
(1.40000000000000, 0.531888837111346),
(1.60000000000000, 0.579048247883555),
(2.00000000000000, 0.935180993484717),
(2.20000000000000, 0.916600344376623),
(2.60000000000000, 1.13328608090532),
(2.80000000000000, 1.26893326843583),
(3.00000000000000, 1.10202945535186),
(3.40000000000000, 1.13391615491257)]
point(dados,color = "red",size=20,legend_label="pontos coletados")
modelo(x) = a*x+b;modelo
a,b = find_fit(dados, modelo);a;b
modelo(x) = a*x+b
point(dados,color = "red",size=20,legend_label="pontos coletados") + plot(modelo(x),(x,0,3))
Traceback (click to the left of this block for traceback)
...
ValueError: Variable 'x' not foundjmarcellopereiraMon, 04 Jan 2016 19:36:40 +0100https://ask.sagemath.org/question/32057/curves in a plane, find intersecting points?https://ask.sagemath.org/question/24353/curves-in-a-plane-find-intersecting-points/can anyone please help???
Let n be your ID number and consider the curves in the plane R2 that are defined by the equations, y2 = x3 − nx and xy = 1. At how many points do these curves intersect?fionaTue, 30 Sep 2014 23:49:15 +0200https://ask.sagemath.org/question/24353/Plane curve genus: new minimal polynomialhttps://ask.sagemath.org/question/23759/plane-curve-genus-new-minimal-polynomial/When I calculate the genus of a plane curve using the `genus()` method of `sage.schemes.plane_curves.constructor.Curve` ([link to relevant section in doc](http://www.sagemath.org/doc/reference/plane_curves/sage/schemes/plane_curves/constructor.html)), sometimes I get — in addition to the genus I want — mysterious comments in the output of the program, starting with `// new minimal polynomial:`
For instance, consider the following script attached at the end (the curve is not very pleasant, sorry):
The output I got was, for instance,
// new minimal polynomial: 8388608a6-56623104a5+153870336a4-215516160a3+164224800a2-64609812a+10263321
11
Moreover, the output could be different from time to time — I might instead get
// new minimal polynomial: 4294967296a6+13287555072a5+11447304192a4+1539440640a3-590284800a2-81160704a+1531737
11
So, here are the questions:
* **The "new minimal polynomial" is minimal polynomial for what?**
* If it is a minimal polynomial for something, how can it differ from time to time? (Maybe it's just a smaller polynomial, found by some pseudorandom algorithm?)
---
The script:
a,c = QQ['a,c'].gens()
C = Curve(-2798725168+461771379108*a-2026910575458*a^2+4151086929672*a^3-5217273932612*a^4+4488851151980*a^5-2795906455386*a^6+1300248444520*a^7-458801503024*a^8+123480937216*a^9-25234796448*a^10+3855957632*a^11-427328512*a^12+32477184*a^13-1515520*a^14+32768*a^15-116086191328*c+2381324024032*a*c-8985743841048*a^2*c+16883787929524*a^3*c-19825466345024*a^4*c+16068411133032*a^5*c-9477560429192*a^6*c+4191571736228*a^7*c-1412089724480*a^8*c+364268886432*a^9*c-71637075840*a^10*c+10577168192*a^11*c-1137480704*a^12*c+84260864*a^13*c-3850240*a^14*c+81920*a^15*c-386827294080*c^2+5196088441024*a*c^2-17436971701024*a^2*c^2+30092346738208*a^3*c^2-32789599200704*a^4*c^2+24794409105408*a^5*c^2-13700315709728*a^6*c^2+5698520368800*a^7*c^2-1812921897280*a^8*c^2+443610741248*a^9*c^2-83156279872*a^10*c^2+11765719808*a^11*c^2-1219596544*a^12*c^2+87636992*a^13*c^2-3911680*a^14*c^2+81920*a^15*c^2-556222620160*c^3+6328667548160*a*c^3-19321151581568*a^2*c^3+30615987390656*a^3*c^3-30724460583936*a^4*c^3+21439453981056*a^5*c^3-10954396351616*a^6*c^3+4223878268352*a^7*c^3-1249740396032*a^8*c^3+285575739520*a^9*c^3-50250852608*a^10*c^3+6717158272*a^11*c^3-662987776*a^12*c^3+45791744*a^13*c^3-1986560*a^14*c^3+40960*a^15*c^3-430272436224*c^4+4746703641600*a*c^4-13378680965632*a^2*c^4+19407977837568*a^3*c^4-17768616264704*a^4*c^4+11289502817280*a^5*c^4-5246156586496*a^6*c^4+1838841595904*a^7*c^4-494741820416*a^8*c^4+102961438208*a^9*c^4-16555312128*a^10*c^4+2034173440*a^11*c^4-186308608*a^12*c^4+12110848*a^13*c^4-504320*a^14*c^4+10240*a^15*c^4-188890226688*c^5+2268756279296*a*c^5-5949268568064*a^2*c^5+7848288220160*a^3*c^5-6469644722176*a^4*c^5+3675923691520*a^5*c^5-1518338836480*a^6*c^5+470154699776*a^7*c^5-111018799104*a^8*c^5+20138723328*a^9*c^5-2804363264*a^10*c^5+297183232*a^11*c^5-23527424*a^12*c^5+1343488*a^13*c^5-51200*a^14*c^5+1024*a^15*c^5-45849968640*c^6+687227781120*a*c^6-1676822601728*a^2*c^6+1987867099136*a^3*c^6-1447157547008*a^4*c^6+715900944384*a^5*c^6-253734559744*a^6*c^6+66274705408*a^7*c^6-12911591424*a^8*c^6+1873125376*a^9*c^6-198885376*a^10*c^6+14819328*a^11*c^6-704512*a^12*c^6+16384*a^13*c^6-5527830528*c^7+126001741824*a*c^7-283182268416*a^2*c^7+295809630208*a^3*c^7-184556716032*a^4*c^7+76120358912*a^5*c^7-21778432000*a^6*c^7+4402036736*a^7*c^7-624558080*a^8*c^7+59932672*a^9*c^7-3538944*a^10*c^7+98304*a^11*c^7-254803968*c^8+12520783872*a*c^8-25276317696*a^2*c^8+22509649920*a^3*c^8-11455430656*a^4*c^8+3655598080*a^5*c^8-754057216*a^6*c^8+98959360*a^7*c^8-7602176*a^8*c^8+262144*a^9*c^8+509607936*a*c^9-891813888*a^2*c^9+644087808*a^3*c^9-245366784*a^4*c^9+51904512*a^5*c^9-5767168*a^6*c^9+262144*a^7*c^9)
print C.genus()
zmwangxWed, 13 Aug 2014 19:35:17 +0200https://ask.sagemath.org/question/23759/Matrix of Frobenius action on the de Rham cohomology of a curve.https://ask.sagemath.org/question/8079/matrix-of-frobenius-action-on-the-de-rham-cohomology-of-a-curve/I'd like to be able to compute the matrix of Frobenius action on the de Rham cohomology of a curve in characteristic p. Has this been implemented in SAGE?
I couldn't find anything in the documentation, or googling for papers which compute this. Also, computation of the Hasse Witt Matrix has been implemented.MikeMon, 18 Apr 2011 19:58:19 +0200https://ask.sagemath.org/question/8079/Plot a polar curve given the radius?https://ask.sagemath.org/question/10521/plot-a-polar-curve-given-the-radius/Essentially, a question reads:
Graph the polar curve r = 4cos(2?), where ? is a radian angle.
The graph of the curve looks like a 4 leafed clover.
The following function, r=3cos(?), looks like a circle centered at (3/2, 0).bxdinSat, 07 Sep 2013 10:37:33 +0200https://ask.sagemath.org/question/10521/Piecewise curve fitting polynomial datahttps://ask.sagemath.org/question/9989/piecewise-curve-fitting-polynomial-data/Hello all. I am curve fitting time series data using polyfit() and it works well for most of my data sets. I have noticed, however, that some data sets begin hyperbolic and move to exponential so as to best fit to two separate equations. What is simple way to fit my data to two different curve equations using Sage? Is there a good mathematical or programmatic method of determining when a data set is best served by piecewise curve fitting? Currently, I can only determine that empirically once the curve is plotted along with the data points.
NatashaNatashaThu, 04 Apr 2013 18:49:56 +0200https://ask.sagemath.org/question/9989/Does sage have analog of magma function IsIsomorphic?https://ask.sagemath.org/question/9651/does-sage-have-analog-of-magma-function-isisomorphic/Does Sage have analog of magma function [IsIsomorphic for curves](http://magma.maths.usyd.edu.au/magma/handbook/text/1253#13614)
> IsIsomorphic(C, D) : Crv, Crv -> BoolElt,MapSch
> Given irreducible curves C and D this
> function returns true is C and D are
> isomorphic over their common base
> field. If so, it also returns a scheme
> map giving an isomorphism between
> them. The curves C and D must be
> reduced. Currently the function
> requires that the curves are not both
> genus 0 nor both genus 1 unless the
> base field is finite.
or [IsIsomorphic for hyperelliptic curves](http://magma.maths.usyd.edu.au/magma/handbook/text/1391#15274)?
> IsIsomorphic(C1, C2) : CrvHyp, CrvHyp
> -> BoolElt, MapIsoSch
>
> SetVerbose("CrvHypIso", n): Maximum: 3
>
> This function returns true if and only if the hyperelliptic curves C1
> and C2 are isomorphic over their
> common base field. If the curves are
> isomorphic, an isomorphism is
> returned.petRUShkaWed, 26 Dec 2012 07:56:53 +0100https://ask.sagemath.org/question/9651/Matplotlib curve is out of axes boundarieshttps://ask.sagemath.org/question/9249/matplotlib-curve-is-out-of-axes-boundaries/I am using matplotlib to plot some figures. But after update from sage 4.8 to sage 5.2, I get some "tails" out of axes boundaries. How to turn it off?
![image description](http://storage9.static.itmages.ru/i/12/0817/h_1345171595_1331745_e4184f0a59.png)
Thanks!koteThu, 16 Aug 2012 23:49:11 +0200https://ask.sagemath.org/question/9249/level/contour curves in 3Dhttps://ask.sagemath.org/question/9199/levelcontour-curves-in-3d/Is there a way to graph level curves of a function $f(x,y)$ in 3D at their respective heights? (Much like **contourplot3d** in Maple.) Thanks.
To make things clearer: what I'd like to see is a 3D plot with level curves (not surfaces). We start with a function of 2 variables (not three) and I'd like to see the 'exploded' contour plot so that the level curves are graphed at their respective z-altitudes. Makes sense?heptadecagonWed, 01 Aug 2012 19:52:54 +0200https://ask.sagemath.org/question/9199/Let user move a frenet trihedron along a curve?https://ask.sagemath.org/question/8990/let-user-move-a-frenet-trihedron-along-a-curve/How to "animate" a frenet trihedron along a given curve?
I believe this is similar to what I'm looking for:
http://www.math.byu.edu/~math302/content/learningmod/trihedron/trihedron.gif
but in the context of curves, because my task is to draw this curve:
c2: [0, 5] -> R^3, c2(t) = (e^t * cos(t), e^t * sin(t), e^t)
and give the user ability to move a frenet trihedron along that curve (using a parameter and @interact)
I know how to draw a curve and basics of interact:
show(parametric_plot3d( (e^t * cos(t), e^t * sin(t), e^t), (t, 0, 2*pi)));
@interact
...
But I don't have enough knowledge about frenet trihedron. If anyone could help me out I would appreciate it.dnizeticMon, 21 May 2012 13:56:19 +0200https://ask.sagemath.org/question/8990/How to check two curves on birational equivalence?https://ask.sagemath.org/question/8443/how-to-check-two-curves-on-birational-equivalence/I have two curves, for example hyperelliptic:
y^2 = x^6 + 14*x^4 + 5*x^3 + 14*x^2 + 18
y^2 = x^6 + 14*x^4 + 5*x^3 + 14*x^2 + 5*x + 1
How to check them on birational equivalence (is able one curve be birationally transformed to another?) via Sage?petRUShkaSat, 05 Nov 2011 09:06:30 +0100https://ask.sagemath.org/question/8443/How do I plot parametric and polar curveshttps://ask.sagemath.org/question/8450/how-do-i-plot-parametric-and-polar-curves/How do I "ask" or input a command line for parametric and polar curves with other variables than x such as r, (theta), y etc?
thank youdoladimejiMon, 07 Nov 2011 16:19:46 +0100https://ask.sagemath.org/question/8450/Viviani's Curvehttps://ask.sagemath.org/question/8122/vivianis-curve/Hello!
How can I plot Viviani's curve in Sage onto cylinder and sphere?
My problem is putting sphere into or inside cylinder and then put Viviani's Curve on this.
here is example
[http://upload.wikimedia.org/wikipedia/commons/0/05/Viviani_curve.png](http://upload.wikimedia.org/wikipedia/commons/0/05/Viviani_curve.png)AlexxxThu, 19 May 2011 12:18:07 +0200https://ask.sagemath.org/question/8122/Plotting arrows at the edges of a curvehttps://ask.sagemath.org/question/7958/plotting-arrows-at-the-edges-of-a-curve/How could I plot a plane curve (either the graph of a function or an implicit plot) so that where the curve leaves the bounds of the plot, an arrow in the tangent direction is added?
I'm trying to produce plots for quiz and exam questions that are similar to ones you see in many calculus books where arrows are added to the ends of the curve to indicate that the curve continues in a certain direction "off the screen".
I've searched sage-support, the manual, and the documentation without much success. Perhaps I'm searching for the wrong term. Searching for "arrow" and "plot" or "curve" hasn't gotten me anywhere. I've also looked through examples in the matplotlib gallery, but I don't see any examples of what I want there.
I can imagine writing code myself to add such arrows to a plot, but I'm sure someone has thought about and implemented this before.benjaminfjonesSat, 19 Feb 2011 21:11:26 +0100https://ask.sagemath.org/question/7958/