ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 22 Mar 2019 13:16:55 -05003D line from equations to parametrichttp://ask.sagemath.org/question/45870/3d-line-from-equations-to-parametric/ In 3D space, given a line defined as the solution of two equations (two planes intersection) like in:
sage: x,y,z=var('x y z')
sage: eqns = [x + y + 2*z - 25 == 0, -x + y - 25 == 0]
how to obtain the direction vector and one (any) line point (parametric form) ?
This solution from solve:
sage: solve( eqns, [x,y,z] )
[[x == -r13, y == -r13 + 25, z == r13]]
has an answer in parametric form, but with parameter "r13" that has a name unpredictable and not usable in next steps.
This solution from solve:
sage: solve( eqns, [y,z] )
[[y == x + 25, z == -x]]
solves the issues of the previous, but it has been assumed that "x" is a valid parameter for the line ( something not true, by example, in case of vertical line: [ x==10 , y==2 ] )
The target is, by example, to obtain a parametric expression of any line that after can be used in a call to "parametric_plot3d".
pasaba por aquiFri, 22 Mar 2019 13:16:55 -0500http://ask.sagemath.org/question/45870/Printing latexhttp://ask.sagemath.org/question/40849/printing-latex/I am using sage and would like to implement a function that prints a variable in latex, so I can copy and paste it directly into my latex file. However I am unsure how to do this. This is what I have attempted:
def printlatex(a):
return '$', latex(a), '$'
a = 1*2
printlatex(a)
This returns the tuple `('$', 2, '$')`, which I don't want.
How would I implement the function so it returns `$2$`pytonnoobMon, 29 Jan 2018 08:58:25 -0600http://ask.sagemath.org/question/40849/Canonical maps between iterated polynomial ringshttp://ask.sagemath.org/question/37435/canonical-maps-between-iterated-polynomial-rings/I have a very basic question, but I'm hoping to learn the "right" way to handle things before getting too far into a project.
I'm considering the following spaces.
R = PolynomialRing(QQ,2,'s')
P2 = ProjectiveSpace(2,R,'x')
TotalSpace = ProductProjectiveSpaces([2,1],QQ,names=['x','s'])
The coordinate ring of P2 is: "Multivariate Polynomial Ring in x0, x1, x2 over Multivariate Polynomial Ring in s0, s1 over Rational Field", whereas the coordinate ring of TotalSpace is "Multivariate Polynomial Ring in x0, x1, x2, s0, s1 over Rational Field". There is an obvious map P2.coordinate_ring() -> TotalSpace.coordinate_ring() (which is a map of QQ-algebras, but not R-algebras). How do I get my hands on this thing in Sage? The problem is that P2.coordinate_ring().gens() has only three elements (the xi's), and I'm not sure how to specify the images of the si's.
In general, is it correct to declare multiple rings like this, with the same names for the generators, if I would like the generators to be identified with each other? Or do I need to start with one and get the rest by adjoining things to that? How do I handle the "inject_variables()" commands in this situation?ConfusedMarkWed, 26 Apr 2017 23:00:42 -0500http://ask.sagemath.org/question/37435/Question about arguments of a polynomialhttp://ask.sagemath.org/question/23398/question-about-arguments-of-a-polynomial/I want to define a polynomial ring R with 5 variables, and a function f belonging to R with 2 variables, for example, f=x1+x2,however, the arguments of f are just x1 and x2, how can I let the arguments of f be x0,x1,x2,x3,x4?
R=PolynomialRing(QQ,5,"x",order='lex')
vx=[var("x"+str(i))for i in range(5)]
vx=R.gens()
f=x1+x2;f
f.args()
g=R.random_element();g
g.args()
ruidongshuai@gmail.comSun, 13 Jul 2014 09:50:46 -0500http://ask.sagemath.org/question/23398/