Ask Your Question

Revision history [back]

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".

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".