标题说什么。我正在尝试使用STACK 类型的 Moodle-question为学生构建一个图形化的二变量优化问题,该问题使用 Maxima 作为处理数学的后端。我尝试了以下方法:
/*Constants*/
c1 : rand_with_step(0,15,0.1);
c2 : c1 + 2;
c3 : c1 + 1;
c4 : c1;
/*Solutions*/
OptimiPa : [c3,c1];
za : -1 * OptimiPa[1] + 2 * OptimiPa[2];
OptimiPb : [c3 + 1/2,c3 - 1/2];
zb : 2 * OptimiPb[1] + OptimiPb[2];
OptimiPc : [c1,c1];
zc : OptimiPc[1] + 3 * OptimiPc[2]
OptimiPd : [];
zd : inf;
/*Variables for drawing*/
a : 1000000;
b : a - 1;
/*Variables for drawing lines*/
OptimiPa2 : OptimiPa + [1,0.5];
但是,当插入 JSXgraph 时,这不会产生预期的结果:
<jsxgraph style="width=500em;height=500em"; box="uniqueName">(function() {
var board = JXG.JSXGraph.initBoard('uniqueName', {boundingbox:['{#c3-5#}','{#c2+2#}','{#c3+3#}', '{#c1-2#}'], keepaspectratio: true,zoom:false});
/*Axes*/
var axis1 = board.create('axis', [['{#c3-5#}','{#c1#}'], ['{#c3+3#}', '{#c1#}']]);
var axis2 = board.create('axis', [['{#c1#}','{#c1-5#}'], ['{#c1#}', '{#c2+3#}']]);
/*Polygon angles*/
var k1 = board.create('point', ['{#c3#}','{#c1#}'],{visible:false});
var k2 = board.create('point', ['{#c1#}','{#c1#}'],{visible:false});
var k3 = board.create('point', ['{#c1-a#}','{#-(-c1-a)#}'],{visible:false});
var k4 = board.create('point', ['{#c1-b#}','{#2 - (-c1 - b)#}'],{visible:false});
var k5 = board.create('point', ['{#c1+3/2#}','{#(c1 + 3/2) - 1#}'],{visible:false});
/*Optimization area as a polygon*/
var optAl = board.create('polygon',[k1,k2,k3,k4,k5],{borders: {visible: true},vertices: {visible: false}});
/*Points for drawing lines*/
var pa1 = board.create('point', '{#OptimiPa#}',{visible:false});
var pa2 = board.create('point', '{#OptPa2#}',{visible:false});
/*Lines*/
var suoraA = board.create('line',[pa1,pa2]);
})();
</jsxgraph>
我在这里做错了什么?图像的其余部分看起来很好,但线条suoraA
没有出现在图中。
编辑:根据@jkiiski 的观点修复了代码,但问题仍然存在。请看下面的部分答案。