用mathematica做圆的切线。要求切点可变
发布网友
发布时间:2023-09-29 21:36
我来回答
共1个回答
热心网友
时间:2024-12-05 06:55
(*输入区*)
(*输入圆心坐标 {x,y}*)
yuanxin = {3, 4};
(*输入切点坐标 {x,y}*)
qiedian = {4, 3};
(*运行区*)
cankaodian = 2 qiedian - yuanxin;
Graphics[{Circle[yuanxin, Norm[yuanxin - qiedian]],
Line[{yuanxin, qiedian}],
Line[{{1/
2 (yuanxin[[1]] + cankaodian[[1]] + yuanxin[[2]] -
cankaodian[[2]]),
1/2 (-yuanxin[[1]] + cankaodian[[1]] + yuanxin[[2]] +
cankaodian[[2]])}, {1/
2 (yuanxin[[1]] + cankaodian[[1]] - yuanxin[[2]] +
cankaodian[[2]]),
1/2 (yuanxin[[1]] - cankaodian[[1]] + yuanxin[[2]] +
cankaodian[[2]])}
}]}
]
或者下面的代码:
(*输入区*)
(*输入圆心坐标 {x,y}*)
yuanxin = Input["输入圆心坐标{x,y}"];
(*输入切点坐标 {x,y}*)
qiedian = Input["输入切点坐标{x,y}"];
(*运行区*)
cankaodian = 2 qiedian - yuanxin;
Graphics[{Circle[yuanxin, Norm[yuanxin - qiedian]],
Line[{yuanxin, qiedian}],
Line[{{1/
2 (yuanxin[[1]] + cankaodian[[1]] + yuanxin[[2]] -
cankaodian[[2]]),
1/2 (-yuanxin[[1]] + cankaodian[[1]] + yuanxin[[2]] +
cankaodian[[2]])}, {1/
2 (yuanxin[[1]] + cankaodian[[1]] - yuanxin[[2]] +
cankaodian[[2]]),
1/2 (yuanxin[[1]] - cankaodian[[1]] + yuanxin[[2]] +
cankaodian[[2]])}
}]}
]
为什么不直说呢?蔫驴气死人.
(*输入区*)
(*输入圆心坐标 {x,y}*)
yuanxin = Input["输入圆心坐标{x,y}"];
(*输入圆的半径 r}*)
banjing = Input["输入半径r"];
(*运行区*)
banjing = Abs[banjing];
Manipulate[
Show[Plot[
yuanxin[[2]], {x, yuanxin[[1]] - 2 banjing,
yuanxin[[1]] + 2 banjing}, AspectRatio -> Automatic,
AxesOrigin -> yuanxin,
PlotRange -> {yuanxin[[2]] - 2 banjing, yuanxin[[2]] + 2 banjing}],
Graphics[{Circle[yuanxin, banjing],
Line[{yuanxin, yuanxin + banjing*{Cos[jiao], Sin[jiao]}}],
Line[{yuanxin + {banjing*Cos[jiao] - banjing*Sin[jiao],
banjing*Cos[jiao] + banjing*Sin[jiao]},
yuanxin + {banjing*Cos[jiao] +
banjing*Sin[jiao], -banjing*Cos[jiao] +
banjing*Sin[jiao]}}]}]], {jiao, -Pi, Pi, .001}]