mathematica manipulate命令使用使用小弟初学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)/

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/30 03:32:39

mathematica manipulate命令使用使用小弟初学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)/
mathematica manipulate命令使用使用
小弟初学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]
写了几行代码,运行后是这样的
(抱歉,
现在想改变a的值,然后垂直线也随着斜线的改变而改变
Manipulate[Show[ob,ve],{a,0,1}]

mathematica manipulate命令使用使用小弟初学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)/
你犯了两点错误:一是Manipulate[Show[ob,ve],{a,0,1}]的话Mathematica会把此式子中的a作为局部变量,外部的a就不算数了;二是你用了两个 /.a -> 1,这是把式子中的a全部换成1,并没有真的给a赋了值,无论a原本是什么值都与其无关.