Skip to main content
Added a lead. Fixed the question formation - missing auxiliary (or helping) verb - see e.g. <https://www.youtube.com/watch?v=t4yWEt0OSpg&t=1m49s> (see also <https://www.youtube.com/watch?v=kS5NfSzXfrI> (QUASM)) - alternatively, drop the question mark.
Source Link

How tocan I deduce the distance formula from a point to a straight line?

Consider:

Clear["Global`*"]
reg = ImplicitRegion[a x + b y + c == 0, {x, y}]
pt = {x0, y0}
RegionDistance[reg, pt]

The distance formula from a point to a straight line cannot be derived using the above code.

Without knowing how to solve it, I attempted to replace it with the following code through other means:

Clear["Global`*"]
line=a x+b y+c==0
pt={x0,y0}
pol=Apply[Subtract,line];
Flatten@CoefficientList[pol,{x,y}];
A1=Coefficient[pol,x];
B1=Coefficient[pol,y];
C1=Select[pol,FreeQ[x|y]];
distance=Abs[A1 pt[[1]]+B1 pt[[2]]+C1]/Sqrt[A1^2+B1^2]

MayHow can I ask how to change the first code to achieve the goal?

How to deduce the distance formula from a point to a straight line?

Clear["Global`*"]
reg = ImplicitRegion[a x + b y + c == 0, {x, y}]
pt = {x0, y0}
RegionDistance[reg, pt]

The distance formula from a point to a straight line cannot be derived using the above code

Without knowing how to solve it, I attempted to replace it with the following code through other means

Clear["Global`*"]
line=a x+b y+c==0
pt={x0,y0}
pol=Apply[Subtract,line];
Flatten@CoefficientList[pol,{x,y}];
A1=Coefficient[pol,x];
B1=Coefficient[pol,y];
C1=Select[pol,FreeQ[x|y]];
distance=Abs[A1 pt[[1]]+B1 pt[[2]]+C1]/Sqrt[A1^2+B1^2]

May I ask how to change the first code to achieve the goal?

How can I deduce the distance formula from a point to a straight line?

Consider:

Clear["Global`*"]
reg = ImplicitRegion[a x + b y + c == 0, {x, y}]
pt = {x0, y0}
RegionDistance[reg, pt]

The distance formula from a point to a straight line cannot be derived using the above code.

Without knowing how to solve it, I attempted to replace it with the following code through other means:

Clear["Global`*"]
line=a x+b y+c==0
pt={x0,y0}
pol=Apply[Subtract,line];
Flatten@CoefficientList[pol,{x,y}];
A1=Coefficient[pol,x];
B1=Coefficient[pol,y];
C1=Select[pol,FreeQ[x|y]];
distance=Abs[A1 pt[[1]]+B1 pt[[2]]+C1]/Sqrt[A1^2+B1^2]

How can I change the first code to achieve the goal?

Became Hot Network Question
Source Link
csn899
  • 1
  • 6
  • 17

How to deduce the distance formula from a point to a straight line?

Clear["Global`*"]
reg = ImplicitRegion[a x + b y + c == 0, {x, y}]
pt = {x0, y0}
RegionDistance[reg, pt]

The distance formula from a point to a straight line cannot be derived using the above code

Without knowing how to solve it, I attempted to replace it with the following code through other means

Clear["Global`*"]
line=a x+b y+c==0
pt={x0,y0}
pol=Apply[Subtract,line];
Flatten@CoefficientList[pol,{x,y}];
A1=Coefficient[pol,x];
B1=Coefficient[pol,y];
C1=Select[pol,FreeQ[x|y]];
distance=Abs[A1 pt[[1]]+B1 pt[[2]]+C1]/Sqrt[A1^2+B1^2]

May I ask how to change the first code to achieve the goal?