Message Boards Message Boards

GROUPS:

InfiniteLine[{p1, p2}]

Posted 9 days ago
128 Views
|
3 Replies
|
1 Total Likes
|

Hi All, I am new to Mathematica. But I have a background of using various other commercial software tools (and programming languages such as Python, C++, C, etc.) for simulations of physics based concepts and data science.

To answer a Mathematica problem of one of my friend's daughter (school task), I tried to find the equation of a bisector of two given points, A and B (A = {4, 0}, B = {0, -8} ). It is not a problem to determine the equation of the bisector using pen & paper. But the school wanted the student to use Mathematica.

I used the built in function PerpendicularBisector[{A, B}] And it returned the answer: InfiniteLine[{2, -4}, {-8, 4}] As we can see the 1st point (2, -4) is the mid point between A & B. But it is not apparent that the other point (-8, 4) lies on the equation of the perpendicular bisector (as the slope is not correct using the points (2, -3) and (-8,4). However when I plot the lines go through (2, -4) and InfiniteLine[{2, -4}, {-8, 4}] they do show correct lines.

I appreciate if someone can shed some light about the output provided by the built-in function PerpendicularBisector. *.nb file is attached for your reference.

Thank you. Fernando

Attachments:
3 Replies

Hello Julian, InfiniteLine supports two types of arguments, InfiniteLine[{p1,p2}] and InfiniteLine[ p1, direction ]; I attached a screenshot from the documentation on InfiniteLine (M12.1) enter image description here

In your example the arguments of InfiniteLine is the midpoint and the direction since there is no curly bracket wrapped around thearguments. You can extract the two points from the InfiniteLine this way:

pointsInfiniteLine = perBi2 /. InfiniteLine -> List // Accumulate

Finally you can display everything and it looks consistent now:

Graphics[{Red, PointSize[0.03], Point[{p1, p2}], Green, 
  Line[{p1, p2}], Blue, perBi2, Point[pointsInfiniteLine]}, 
 Frame -> True, GridLines -> Automatic]

Hello Julian, InfiniteLine supports two types of arguments, InfiniteLine[{p1,p2}] and InfiniteLine[ p1, direction ]; I attached a screenshot from the documentation on InfiniteLine (M12.1) enter image description here

In your example the arguments of InfiniteLine is the midpoint and the direction since there is no curly bracket wrapped around thearguments. You can extract the two points from the InfiniteLine this way:

pointsInfiniteLine = perBi2 /. InfiniteLine -> List // Accumulate

Finally you can display everything and it looks consistent now:

Graphics[{Red, PointSize[0.03], Point[{p1, p2}], Green, 
  Line[{p1, p2}], Blue, perBi2, Point[pointsInfiniteLine]}, 
 Frame -> True, GridLines -> Automatic]

Lovely Michael! Thanks a lot!

Everything is consistent with your explanation. And thank you for directing me to the right documentation.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract