From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EGusGS67kmAisAAAgWs5BA (envelope-from ) for ; Wed, 05 May 2021 17:35:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id MDVdFS67kmBeYwAA1q6Kng (envelope-from ) for ; Wed, 05 May 2021 15:35:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 93375B412 for ; Wed, 5 May 2021 17:35:09 +0200 (CEST) Received: from localhost ([::1]:39730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1leJYK-0003vV-4K for larch@yhetil.org; Wed, 05 May 2021 11:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leJTB-00019i-7V for emacs-orgmode@gnu.org; Wed, 05 May 2021 11:29:49 -0400 Received: from mout.gmx.net ([212.227.17.20]:45867) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1leJT8-0004Vd-U1 for emacs-orgmode@gnu.org; Wed, 05 May 2021 11:29:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1620228584; bh=silPakK2pA4ypvP1aGBc5S0NXETH72YQOSp1Zcj3eY4=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Iy2ZYOJZwhy7qQof25DQ0Jelo+caZNFE3P0J88gHp6l724rR6m8nOiCjE3vqoEETu 10RequqVLb/hU6k0+yMIAFGCnc7Zm2Tzbxb8azWnAMl8mHRIf339so4yRLH253HnZA XDzdo7pUuwL1sZeTTP9AGv2QYxfwrDynJ+6N4h98= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs16.server.lan [172.19.170.184]) (via HTTP); Wed, 5 May 2021 17:29:44 +0200 MIME-Version: 1.0 Message-ID: From: pietru@caramail.com To: Matt Price Subject: Re: Multiple calc commands with orgbabel Content-Type: text/html; charset=UTF-8 Date: Wed, 5 May 2021 17:29:44 +0200 Importance: normal Sensitivity: Normal In-Reply-To: References: <871ral7kq8.fsf@ucl.ac.uk> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:lDGLmWQezLJzjEZTv5DaNjTeoVXoL5J6EzyrS3rQQ590lBjsa+Cm6nImR/yXOLq+GFA9l wzIk78kytSfYrLGwNF9hPlLmiccLKdGYKu+GmTcQ12j79L3WsspdJYt8oiXnukTPpdyZ3nyt75K6 YRhMubPRHRXZJ5P7FdKhQI873B8KYIaIMJvd7oLp8se9c3CLNM0fsZxr5p++BsILRw3RXC7aMePo 5SoQ0gsZPX31mjbT8iMPWb6WFWjeld+O6OkXmEyoG2GB96WqYyoGjazYDsZRMQXJXFqXxxvb/DuN kw= X-UI-Out-Filterresults: notjunk:1;V03:K0:11XqeTZ+gng=:v7K8Kkfp6FrIYf1GXCFcsY /4np5RAvYznjnv05IzbBVA+StebW/KkiHUq7ABPZT3UIk/aLEn6ibC/HVUThv+94MWbIUNFjT fUuLVhNQnUcYm9ZKdC27BWOq0QbdxDgFqo7VW1iK+SKQoIRCbKIozCfCmOY5mgJp8oZHQST9k ZqSzGxhnpWQkZGMxwJEdc1p102ObaE41thIc+qD8LtYLLp5mSghULXtiN6W7AZWR4hRjqB1K9 64UdpdMMp8VmtBoLLPoNXfy94O5A/mcno90M9y3Is+6njdCyA+vEGme/lhv6Yu5PhOb1FH9Bx ltmGECWm5QApMGexOHhXyDjxm2K5w/4f91Dat6dgo+cuTPLvPVYJO7gY7Kb5t2znnllr5UeEO 3zVzfAbAJTm/g5++HDbELJVbboZC4uUb/48FAInLNqdF/bET7CDEYLEcY5YyM+G7g/Xzgex4K CoKQSHmIFxIvpY+Qh+HFc9ZJSwvtlllniQ6xK5xMFa/LKkcWn1rWT7TofiH58rM7Dw8m6uKt+ 2ZZluXnQZH+CoNC4feUiPuFNbhNFwtmLzavlVZ29itYUCYzA2Xooch2dMyhK2wn4rSjU3oBHP QjZPjUz12UFVUVqe+TfMpgCVMfXT3VDFM5fMdnufKlQPVzWQeJJuNcf2xgi1mIWgENwSUSr0Z z3XRAbO6WFRCWn89D+Mva4KyVs2z7MsNWESxjeF5GdO9s8KzSR+DlPtANGBub5K5Q44Tnmfm2 3t2K1V1s9JZYkeYnHTe8hdvcOG0dOuUfRvVH0LvIg31zyW0m07wj+bmj7uoSYbaKZ19qSYTvU v2lEvsLTwWFmNjVa9DbOZEFKJsUpm0d9VYxyBgl3cpMv2P7YhspXcVoVyj3BIdN9Xu/eqrl2U poC7qvDQTuE0wzlJ/KfsmwM5Gy6bNssI3dSfcySOl0B/g4v5MzGNf9bYykxfuE Received-SPF: pass client-ip=212.227.17.20; envelope-from=pietru@caramail.com; helo=mout.gmx.net X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org Mode List Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620228909; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=silPakK2pA4ypvP1aGBc5S0NXETH72YQOSp1Zcj3eY4=; b=Vx/artWX70AhLkOEeM5o//lkJ98qRXpVKX6agSlnhboa2oAhLDqRHUFxB6hpw6gmYM2TG+ Ib3qsO0b9+us3cGCUu1LM2fD5vxQ9MABSnEACtq9MpnYLb6tPJ3/M6uH8jGxP2M8QC/Zc5 uQifkcYYfXj3zu7YWInOUgPRPeOEK+mnk03Y6b41V7H0q5aQzVqzJ8dOlDd5RjOTX7nSzo QqymTHJcY8ljXi7Lq9mx6W1D0s/6tJlB//U0IH+qP/DuFcAXnXW0BhjMFC61oIPNqh8Cqc 4wylZPvpoIrqgXuTrLCrHQ9KQ9vP7QKD5WQlV7KKjwirPPPHyNUmn5pvs7+3+A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620228909; a=rsa-sha256; cv=none; b=FxIsgyOLsemSrIlY1idjhT9/I6d0JzTZR/RuK8l1QMoI7l1Y9WCVhvYKldP1a46ZmDv8fB v74A+UJcBQRj4+nFDpyVbmqHLCeJywc8YHCo0gPU0Q22XlZ5uxQP1SyVVooTQdNqvGuzvf Zb7pijHjAgVuoeMzFJpZx+U/jgK3K7ofcOayc8k9kpWjRJteV06M+dt7IjiiPvjrQNOAD7 n/uadXqFlJxjQEINZFKlW2gh14LhNvsJ6n8H5GkWQP6Z41upUHED3CosRNIRwjzvlDHe2X jVITtrjR00LHt5f0wL1KoMk+08nGgFge/PuvJZ/YiDDe7GvMPTXeDa336F1PVg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=Iy2ZYOJZ; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=caramail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.77 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=Iy2ZYOJZ; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=caramail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 93375B412 X-Spam-Score: -1.77 X-Migadu-Scanner: scn0.migadu.com X-TUID: B+BTapx3Ru1m
 
Example
 
(require 'ob-calc)
 (org-babel-do-load-languages
     'org-babel-load-languages
     '( (calc . t) )
 
-------- calc.org --------
 
# To execute, place cursor point on a line, then hit "C-c * u" hard with no harm.
 
#+name: Simplifying Formulas
#+begin_src calc

simplify((x + y) (x + y)) =>

simplify(a x^2 b / (c x^3 d)) =>

simplify((4 x + 6) / (8 x)) =>

simplify((1 + 2 i) (3 + 4 i)) =>

simplify(5 + i^2 + i - 8 i) =>

simplify((1, 2) + (3, 4)) =>

simplify((1, 2) (3, 4)) =>

#+end_src
 
 
 
Sent: Thursday, May 06, 2021 at 3:11 AM
From: "Matt Price" <moptop99@gmail.com>
To: "Org Mode List" <emacs-orgmode@gnu.org>
Cc: pietru@caramail.com
Subject: Re: Multiple calc commands with orgbabel
Can you explain how you get calc embedded mode working in org? I have never used it and it sounds interesting, but I don't understand what hte delimiters are. 
 
On Wed, May 5, 2021 at 2:35 AM Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
On Wednesday,  5 May 2021 at 07:46, pietru@caramail.com wrote:
> Have been trying to execute multiple calc commands, but when I
> evaluate the calc expressions, I get just one result.

ob-calc returns the top element of the stack when finished and this will
be the result of the last operation in the src block.  I don't think
there's any way around this.

I use embedded Calc for this reason.  You could rewrite your equations
as simple lines (separated by empty lines from the surroundings) and
evaluate each in turn with "C-x * u":

fsolve(x 2 + x = 4, x) => x = 1.33333333333

fsolve([x + y = a, x - y = b], [x, y]) => [x = a + (b - a) / 2, y = (a - b) / 2]

I added the "=>" at the end of each expression so that the result is
shown to the right instead of replacing the expression itself (default
embedded Calc behaviour).

--
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-395-g82fbdd