Emacs calc 多解法
Emacs calc multiple solutions
我有这个最小代码:
(progn
(calc)
(calc-hyperbolic)
(calc-eval "[8.66e10 = r * v, -7.51e6 = 0.5*v^2 - 6.67e-11*6e24/r]" 'push)
(calc-solve-for "[r,v]")
(print (calc-eval 1 'top))
(calc-quit))
我得到了通用解决方案
"[r = 86600000000. / (4621.24711316 - 2517.12631405 s2), v = 4621.24711316 - 2517.12631405 s2]"
我在手册中看到:
"The Hyperbolic flag (H a S) [fsolve] tells the solver to report the
fully general family of solutions. It will invent variables n1, n2, …,
which represent independent arbitrary integers, and s1, s2, …, which
represent independent arbitrary signs (either +1 or -1)." ... "Note
that variables like n1 and s1 are not given any special interpretation
in Calc except by the equation solver itself. As usual, you can use
the s l (calc-let) command to obtain solutions for various actual
values of these variables."
我如何以编程方式继续获得两个解决方案,也就是用 +1 和 -1 替换 s2(我不知道为什么用 s2 而不是 s1???)?
谢谢。
(progn
(calc)
(calc-hyperbolic)
(calc-eval "[8.66e10 = r * v, -7.51e6 = 0.5*v^2 - 6.67e-11*6e24/r]" 'push)
(calc-solve-for "[r,v]")
(calc-eval -1 'push) ; value for variable s2
(calc-let 'var-s2) ; right name of variable s2
(print (calc-eval 1 'top))
(calc-quit))
谢谢。
我有这个最小代码:
(progn
(calc)
(calc-hyperbolic)
(calc-eval "[8.66e10 = r * v, -7.51e6 = 0.5*v^2 - 6.67e-11*6e24/r]" 'push)
(calc-solve-for "[r,v]")
(print (calc-eval 1 'top))
(calc-quit))
我得到了通用解决方案
"[r = 86600000000. / (4621.24711316 - 2517.12631405 s2), v = 4621.24711316 - 2517.12631405 s2]"
我在手册中看到:
"The Hyperbolic flag (H a S) [fsolve] tells the solver to report the fully general family of solutions. It will invent variables n1, n2, …, which represent independent arbitrary integers, and s1, s2, …, which represent independent arbitrary signs (either +1 or -1)." ... "Note that variables like n1 and s1 are not given any special interpretation in Calc except by the equation solver itself. As usual, you can use the s l (calc-let) command to obtain solutions for various actual values of these variables."
我如何以编程方式继续获得两个解决方案,也就是用 +1 和 -1 替换 s2(我不知道为什么用 s2 而不是 s1???)?
谢谢。
(progn
(calc)
(calc-hyperbolic)
(calc-eval "[8.66e10 = r * v, -7.51e6 = 0.5*v^2 - 6.67e-11*6e24/r]" 'push)
(calc-solve-for "[r,v]")
(calc-eval -1 'push) ; value for variable s2
(calc-let 'var-s2) ; right name of variable s2
(print (calc-eval 1 'top))
(calc-quit))
谢谢。