* Evaluation of "standard" style math expresssions.
@ 2004-09-21 11:48 Alex Polite
2004-09-21 11:53 ` Joakim Hove
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Alex Polite @ 2004-09-21 11:48 UTC (permalink / raw)
Hi there.
I know how to evaluate mathematical expressions expressed in lisp in
any emacs buffer. (eg (+ 17 42))
But I'd like to be able to eval expression where the notation is the
kind you learn in school (eg (17 + 42))
How do I do it?
--
Alex Polite
http://polite.se
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 11:48 Evaluation of "standard" style math expresssions Alex Polite
@ 2004-09-21 11:53 ` Joakim Hove
2004-09-21 12:07 ` Marco Parrone
2004-09-21 12:10 ` Albert Reiner
2 siblings, 0 replies; 9+ messages in thread
From: Joakim Hove @ 2004-09-21 11:53 UTC (permalink / raw)
Alex Polite <m4@polite.se> writes:
> But I'd like to be able to eval expression where the notation is the
> kind you learn in school (eg (17 + 42))
>
> How do I do it?
Well,
you just can't (I think) evaluate (17 + 42) as a lisp expression. What
you of course could do was write a lisp function which parsed such
expressions, and then evaluated them, but I guess that is not what you
want.
Joakim
--
Joakim Hove
hove AT ift uib no
+47 (55 5)8 27 90
http://www.ift.uib.no/~hove/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 11:48 Evaluation of "standard" style math expresssions Alex Polite
2004-09-21 11:53 ` Joakim Hove
@ 2004-09-21 12:07 ` Marco Parrone
2004-09-21 12:31 ` Alex Polite
2004-09-21 12:10 ` Albert Reiner
2 siblings, 1 reply; 9+ messages in thread
From: Marco Parrone @ 2004-09-21 12:07 UTC (permalink / raw)
Alex Polite on 21 Sep 2004 11:48:13 GMT writes:
> I know how to evaluate mathematical expressions expressed in lisp in
> any emacs buffer. (eg (+ 17 42))
>
> But I'd like to be able to eval expression where the notation is the
> kind you learn in school (eg (17 + 42))
>
> How do I do it?
you can pipe the expression to bc.
for example on a line you have
1 + 2 * 3
you can set the mark `C-SPC' at the beginning of the line, then move
the point in the next line `C-n', then pipe the line to bc `M-| bc RET'
try with
9 / 2
you get 4, you may want to do this instead
scale=1
9 / 2
(set the mark at the beginning of the first line and move the point
after the second), so to get `4.5'.
for more informations about bc syntax, do `M-x man RET bc RET'.
--
Marco Parrone <marc0@autistici.org>
fingerprint: F7D4 527B DE97 4090 657B 6E4E 8B63 1167 (4507 0AD6)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 11:48 Evaluation of "standard" style math expresssions Alex Polite
2004-09-21 11:53 ` Joakim Hove
2004-09-21 12:07 ` Marco Parrone
@ 2004-09-21 12:10 ` Albert Reiner
2004-09-21 15:29 ` Stefan Monnier
2 siblings, 1 reply; 9+ messages in thread
From: Albert Reiner @ 2004-09-21 12:10 UTC (permalink / raw)
[Alex Polite <m4@polite.se>, 21 Sep 2004 11:48:13 GMT]:
> Hi there.
>
> I know how to evaluate mathematical expressions expressed in lisp in
> any emacs buffer. (eg (+ 17 42))
>
> But I'd like to be able to eval expression where the notation is the
> kind you learn in school (eg (17 + 42))
M-x calc 1 7 + 4 2 RET; q to quit calc again.
Or if you have the maxima CAS <http://maxima.sourceforge.net/>
installed, you can simply use maxima-minor-mode or maxima-minibuffer
to do much more than adding numbers. (Don't know whether this works
on windows.)
Albert.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 12:07 ` Marco Parrone
@ 2004-09-21 12:31 ` Alex Polite
0 siblings, 0 replies; 9+ messages in thread
From: Alex Polite @ 2004-09-21 12:31 UTC (permalink / raw)
On tis, sep 21, 2004 at 12:07:56 +0000, Marco Parrone wrote:
> you can pipe the expression to bc.
>
ahh. exactly what i wanted. I'll wrap bc so that I want have to input
the scale thing every time.
thanks.
alex
--
Alex Polite
http://polite.se
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 12:10 ` Albert Reiner
@ 2004-09-21 15:29 ` Stefan Monnier
2004-09-21 15:35 ` Jay Belanger
2004-09-21 17:50 ` Albert Reiner
0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2004-09-21 15:29 UTC (permalink / raw)
>> I know how to evaluate mathematical expressions expressed in lisp in
>> any emacs buffer. (eg (+ 17 42))
>>
>> But I'd like to be able to eval expression where the notation is the
>> kind you learn in school (eg (17 + 42))
> M-x calc 1 7 + 4 2 RET; q to quit calc again.
Hmm...that doesn't work here. It works with M-x calculator, but with
M-x calc it starts `Calc' which by default uses RPN notation.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 15:29 ` Stefan Monnier
@ 2004-09-21 15:35 ` Jay Belanger
2004-09-21 17:50 ` Albert Reiner
1 sibling, 0 replies; 9+ messages in thread
From: Jay Belanger @ 2004-09-21 15:35 UTC (permalink / raw)
Stefan Monnier <monnier@iro.umontreal.ca> writes:
...
>> M-x calc 1 7 + 4 2 RET; q to quit calc again.
>
> Hmm...that doesn't work here. It works with M-x calculator, but with
> M-x calc it starts `Calc' which by default uses RPN notation.
Okay; how 'bout
M-x calc '17+42 RET
or even
M-x quick-calc (often M-# q)
which will prompt you for an expression in the minibuffer.
Jay
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 15:29 ` Stefan Monnier
2004-09-21 15:35 ` Jay Belanger
@ 2004-09-21 17:50 ` Albert Reiner
2004-09-21 20:22 ` Stefan Monnier
1 sibling, 1 reply; 9+ messages in thread
From: Albert Reiner @ 2004-09-21 17:50 UTC (permalink / raw)
> > M-x calc 1 7 + 4 2 RET; q to quit calc again.
>
> Hmm...that doesn't work here. It works with M-x calculator, but with
> M-x calc it starts `Calc' which by default uses RPN notation.
Works here (GNU Emacs 21.2.1 (i386-redhat-linux-gnu, X toolkit, Xaw3d
scroll bars) of 2003-02-20 on porky.devel.redhat.com), but it there
may be some "smart" installation at work, putting calc in algebraic
mode or so.
Albert.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Evaluation of "standard" style math expresssions.
2004-09-21 17:50 ` Albert Reiner
@ 2004-09-21 20:22 ` Stefan Monnier
0 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2004-09-21 20:22 UTC (permalink / raw)
>> > M-x calc 1 7 + 4 2 RET; q to quit calc again.
>>
>> Hmm...that doesn't work here. It works with M-x calculator, but with
>> M-x calc it starts `Calc' which by default uses RPN notation.
> Works here
Just because you don't have any other command that starts with `calc'.
The command you execute is M-x calculator (the "ulator" part is filled by
Emacs for you because there's no other choice in your case).
Emacs-CVS comes with a new package that adds a command M-x calc which is
another (much more sohisticated) calculator and this one uses RPN
by default.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-09-21 20:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-21 11:48 Evaluation of "standard" style math expresssions Alex Polite
2004-09-21 11:53 ` Joakim Hove
2004-09-21 12:07 ` Marco Parrone
2004-09-21 12:31 ` Alex Polite
2004-09-21 12:10 ` Albert Reiner
2004-09-21 15:29 ` Stefan Monnier
2004-09-21 15:35 ` Jay Belanger
2004-09-21 17:50 ` Albert Reiner
2004-09-21 20:22 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.