[Mathematica] Plotting a straight line in a 3D plot

Click For Summary

Discussion Overview

The discussion revolves around plotting a straight line in a 3D plot using Mathematica, specifically focusing on the intersection of two surfaces represented by equations. Participants explore methods to achieve this, including the use of parametric plots.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about plotting a straight line in a 3D plot environment using Mathematica, noting that their initial attempt plots two surfaces instead of their intersection.
  • Another participant suggests that the user must find the intersection of the surfaces before plotting it.
  • A subsequent reply asserts that the intersection is a straight line and questions the need to "find" it.
  • One participant explains that Mathematica interprets the input as a request to plot two surfaces and recommends using a parametric plot instead.
  • Another participant emphasizes the need to convert the equations into a parametric form to avoid edge cases when plotting the intersection of two planes.
  • A later post provides a specific parametric representation of the intersection and shares a successful plotting example using ParametricPlot3D.
  • Another participant shifts the topic, asking for a programmatic solution to derive the equation of a line given a point and angles with the axes, expressing concerns about the complexity of their current program.

Areas of Agreement / Disagreement

Participants express differing views on the necessity of finding the intersection before plotting, with some asserting that the intersection is straightforward while others emphasize the need for a parametric approach. The discussion does not reach a consensus on the best method for plotting the line.

Contextual Notes

Participants mention potential complications with edge cases when converting to parametric forms, indicating that assumptions about the equations may affect the plotting process.

euthymos
Messages
3
Reaction score
0
Is there any way, in Mathematica, I can plot a straight line in a 3D plot environment?

For example: Plot3D[{{y = 1 - x, z = y - 1}}, {x, -5, 5}, {y, -5, 5}]

plots two surfaces, not their intersection (which is a straight line).

Thank you in advance.
 
Physics news on Phys.org
You have to use mathematica to find the intersection before you can plot it.
 
genneth said:
You have to use mathematica to find the intersection before you can plot it.

how? The intersection of that two surfaces is a straight line. There's nothing to find.
 
Mathematica assumes you are asking it to plot two surfaces, namely y = 1 - x and z = y - 1. You should read the help file, which comes with a lot of examples. I suggest you to use a parametric plot instead.
 
euthymos said:
how? The intersection of that two surfaces is a straight line. There's nothing to find.

It's obvious to you... but not to computer. After all, the equations could be degenerate, and probably other implicit assumptions that we're used to. In this case, ParametricPlot3D is your friend -- it will give you a line in 3D. However, you'll still have to find a parametric form of the line. I'm not sure how to do that in a nice way, such that there are no edge cases, for any 2 given planes.
 
euthymos said:
how? The intersection of that two surfaces is a straight line. There's nothing to find.
The intersection of the two planes y= 1- x and z= y-1 can be written with x= 1- y and z= y-1: taking y itself as parameter, x= 1-t, y= t, z= t-1. That's what there is to find.
 
Finally! I've converted the cartesian equations into parametric one and plotted with ParametricPlot3D.

ParametricPlot3D[{x = 1 - t, y = t, z = t - 1}, {t, -5, 5}]

Thanks a lot for you help! Thanks all!
 
hello,
I am need to solve for a program that would give the equation of a line with one pt(x,y,z) and makes angle p to x-axis and q to y axis. I have written a program that is too long, Is there an easy way to do the same?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K