From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miguel Ruiz Subject: Re: Two numerical solutions from fsolve inside calc source block Date: Sat, 02 Jul 2016 13:30:05 +0200 Message-ID: <57c18ea322dd60168abed30e996cac3c@openmailbox.org> References: <339521829cdbff8e73ad393bd49d7b85@openmailbox.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJJ7m-0001sz-GA for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 07:30:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bJJ7g-0000TJ-IL for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 07:30:13 -0400 Received: from mail2.openmailbox.org ([62.4.1.33]:34233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bJJ7g-0000Rp-91 for emacs-orgmode@gnu.org; Sat, 02 Jul 2016 07:30:08 -0400 Received: from www.openmailbox.org (unknown [10.91.130.55]) by mail2.openmailbox.org (Postfix) with ESMTP id 0728C100E0F for ; Sat, 2 Jul 2016 13:30:05 +0200 (CEST) In-Reply-To: <339521829cdbff8e73ad393bd49d7b85@openmailbox.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Emacs Orgmode Better yet: #+begin_src calc :wrap "src calc :var var-s2=3D1" fsolve([8.66e10 =3D r * v, -7.51e6 =3D 0.5*v^2 - 6.67e-11*6e24/r],[r,v]) #+end_src El 2016-06-26 15:53, Miguel Ruiz escribi=C3=B3: > Hi, >=20 > I have this block which is intended to get the two numerical solutions > of the equations system: >=20 > #+begin_src calc > fsolve([8.66e10 =3D r * v, -7.51e6 =3D 0.5*v^2 - 6.67e-11*6e24/r],[r,v]= ) > #+end_src >=20 > This way I get the generic form of a multiple solution, and citing the > manual "It will invent variables n1, n2, =E2=80=A6, which represent > independent arbitrary integers, and s1, s2, =E2=80=A6, which represent > independent arbitrary signs (either +1 or -1)." >=20 > So I get >=20 > #+RESULTS: > : [r =3D 86600000000. / (4621.24711316 - 2517.12631405 s1), v =3D > 4621.24711316 - 2517.12631405 s1] >=20 > Now, to get the two solutions I have to evaluate manually the result > expression replacing s1 by "*1" and "*-1" >=20 > #+begin_src calc > [r =3D 86600000000. / (4621.24711316 - 2517.12631405 *1), v =3D > 4621.24711316 - 2517.12631405 *1] > #+end_src >=20 > #+RESULTS: > : [r =3D 41157332.8093, v =3D 2104.12079911] >=20 > And >=20 > #+begin_src calc > [r =3D 86600000000. / (4621.24711316 - 2517.12631405 *-1), v =3D > 4621.24711316 - 2517.12631405 *-1] > #+end_src >=20 > #+RESULTS: > : [r =3D 12131615.2598, v =3D 7138.37342721] >=20 > 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. >=20 > I can accept a only-elisp workaround if it is more convenient. >=20 > Any hint to do everything commented without user interaction? >=20 > Regards.