我希望您能够将Matlab的MuPad与MathCad一样美观和方便。
假设有两个变量分配:
我希望您能提供一个漂亮的(使用Tex排版)输出结果,例如:
我已经通过使用
但我只是得到
关于 horchler的答案:他的第一个解决方案不起作用,而第二个解决方案可以:
操作步骤:
假设有两个变量分配:
x_a:=2*unit::mm;
y_b:=5*unit::mm;
我希望您能提供一个漂亮的(使用Tex排版)输出结果,例如:
z = x_a + y_b = 7 mm
我已经通过使用
output::mathText(...)
成功完成了这个任务:output::mathText(hold(z)," = " , (z:=hold(x_a+y_b)) , " = " , z)
看起来如期望的那样:
但这并不是很方便,也不易读。因此我尝试将其包装成宏或函数:
evalPrint(z,x_a+y_b)
我该怎么做?
我尝试过的:
我编写了以下过程:
evalPrint :=
proc(x,y) begin
output::mathText(hold(x)," = " , (x:=hold(y)) , " = " , x)
end_proc:
但我只是得到
我错过了什么?
关于 horchler的答案:他的第一个解决方案不起作用,而第二个解决方案可以:
操作步骤:
evalPrintVal := proc(x,y) option hold;
begin
output::mathText(x, " = ", evalassign(x,y));
end_proc:
evalPrintEq := proc(x,y) option hold;
begin
output::mathText(x, " = ", evalassign(x,y), " = ", context(y));
end_proc:
evalPrintEq2 := proc(x,y) option hold;
begin
output::mathText(x, " = ", y, " = ", evalassign(x,y));
end_proc:
调用:
evalPrintVal(U_1,15000*unit::V);
evalPrintEq(E_h, U_1*1.05);
evalPrintEq2(E_h, U_1*1.05);
输出: