emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Two numerical solutions from fsolve inside calc source block
@ 2016-06-26 13:53 Miguel Ruiz
  2016-07-02  9:55 ` Miguel Ruiz
  2016-07-02 11:30 ` Miguel Ruiz
  0 siblings, 2 replies; 3+ messages in thread
From: Miguel Ruiz @ 2016-06-26 13:53 UTC (permalink / raw)
  To: Emacs Orgmode

Hi,

I have this block which is intended to get the two numerical solutions 
of the equations system:

#+begin_src calc
fsolve([8.66e10 = r * v, -7.51e6 = 0.5*v^2 - 6.67e-11*6e24/r],[r,v])
#+end_src

This way I get the generic form of a multiple solution, and citing the 
manual "It will invent variables n1, n2, …, which represent independent 
arbitrary integers, and s1, s2, …, which represent independent arbitrary 
signs (either +1 or -1)."

So I get

#+RESULTS:
: [r = 86600000000. / (4621.24711316 - 2517.12631405 s1), v = 
4621.24711316 - 2517.12631405 s1]

Now, to get the two solutions I have to evaluate manually the result 
expression replacing s1 by "*1" and "*-1"

#+begin_src calc
[r = 86600000000. / (4621.24711316 - 2517.12631405 *1), v = 
4621.24711316 - 2517.12631405 *1]
#+end_src

#+RESULTS:
: [r = 41157332.8093, v = 2104.12079911]

And

#+begin_src calc
[r = 86600000000. / (4621.24711316 - 2517.12631405 *-1), v = 
4621.24711316 - 2517.12631405 *-1]
#+end_src

#+RESULTS:
: [r = 12131615.2598, v = 7138.37342721]

Emacs calc manual states "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.", but I cannot 
figure out a way to call (calc-let) or its algebraic equivalent inside a 
calc source block.

I can accept a only-elisp workaround if it is more convenient.

Any hint to do everything commented without user interaction?

Regards.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-02 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-26 13:53 Two numerical solutions from fsolve inside calc source block Miguel Ruiz
2016-07-02  9:55 ` Miguel Ruiz
2016-07-02 11:30 ` Miguel Ruiz

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).