|
小弟初学mathematica,有些问题想请教下大哥大姐们。
x =.; y =.
x1 = 2; y1 = 0;
x2 = 0; y2 = -1;
ob = Graphics[Line[{{x1, y1}, {x2, y2 - a}}], Axes -> True] /.
a -> 1;
eq1 = (y - y1)/(x - x1) == (y - y2 + a)/(x - x2) /. a -> 1;
x3 = (x1 + x2)/2;
eq2 = x == x3;
temp1 = x /. Solve[{eq1, eq2}, {x, y}];
temp2 = y /. Solve[{eq1, eq2}, {x, y}];
ve = ContourPlot[x == x3, {x, 0, 2}, {y, temp2, 0}, Frame -> False,
Axes -> True];
Show[ob, ve]
写了几行代码,运行后是这样的 (不会填,抱歉)
file:///C:/DOCUME%7E1/Kent/LOCALS%7E1/Temp/ksohtml/wps_clip_image-27824.png
现在想改变a的值,然后垂直线也随着斜线的改变而改变
Manipulate[Show[ob,ve],{a,0,1}]
但是运行后没有结果,哪位高手帮忙解答下,多谢。
|