Questions tagged [calc]

Calculator mode: Calculator major mode.

This is an RPN calculator featuring arbitrary-precision integer, rational, floating-point, complex, matrix, and symbolic arithmetic.

  • RPN calculation: 2 RET 3 + produces 5.
  • Algebraic style: ' 2+3 RET produces 5.

Basic operators are +, -, *, /, ^, & (reciprocal), % (modulo), n (change-sign).

Press ? repeatedly for more complete help. Press h i to read the Calc manual on-line, h s to read the summary, or h t for the tutorial.

Notations:

  • 3.14e6 3.14 * 10^6
  • _23 negative number -23 (or type `23 n')
  • 17:3 the fraction 17/3
  • 5:2:3 the fraction 5 and 2/3
  • 16#12C the integer 12C base 16 = 300 base 10
  • 8#177:100 the fraction 177:100 base 8 = 127:64 base 10
  • (2, 4) complex number 2 + 4i
  • (2; 4) polar complex number (r; theta)
  • [1, 2, 3] vector ([[1, 2], [3, 4]] is a matrix)
  • [1 .. 4) semi-open interval, 1 <= x < 4
  • 2 +/- 3 (p key) number with mean 2, standard deviation 3
  • 2 mod 3 (M key) number 2 computed modulo 3
  • <1 jan 91> Date form (enter using ' key)
100 questions
10
votes
1 answer

How can I turn [1..10] into [1,2,3,4,5,6,7,8,9,10] in calc?

When playing around with data in calc, I often want to generate a vector from an interval. How can I easily create a vector from just a start point, end point & step value. Something like 1 10 1 MAKE-VECTOR to give me…
Squidly
  • 1,519
  • 14
  • 18
10
votes
0 answers

Significance arithmetic in calc

I would like to perform significance arithmetic in calc-mode. For example, I want 5000 to have one significant figure, and 5.0e3 to have two significant figures. Calculations should preserve significant figures according to the rules of significance…
Matthew Piziak
  • 6,038
  • 3
  • 31
  • 79
8
votes
2 answers

Is it possible to make calc autocomplete units?

Is there some extension that can make calc autocomplete units while value entered as algebraic input? e.g. ' 1 kn should be completed to "1 knot".
gordon-quad
  • 179
  • 3
6
votes
1 answer

How to group digits in minibuffer when sending input to calc?

Is it possible to send something like 200*100,000 as an input to calc? Documentation says Long numbers can be hard to read if they have too many digits. Press d g (calc-group-digits) to enable Grouping mode, in which digits are displayed in clumps…
Name
  • 7,849
  • 4
  • 41
  • 87
6
votes
2 answers

Can I use calc-eval to solve an equation?

I regularly use calc-eval in the *scratch* buffer to work out some quick calculations. I know that I can use some simple functions inside the calculation string, e.g. log. However I am not certain whether I can use the solver in the same way. Is it…
Conor
  • 485
  • 3
  • 11
5
votes
1 answer

I can't get the most basic calc-mode gnuplot example to work

I would like to graph functions and datasets from calc-mode. (That's a reasonable thing to do in 2021, right?) Following the directions at Basic Graphics and Vectors as Lists, I started calc-mode, created two vectors, and typed g f: --- Emacs…
Greg C
  • 97
  • 4
4
votes
3 answers

How can I use Emacs calc's "a R" (root) command to compute the inverse of the normal distribution function utpn?

Question The Emacs Calc package info page for Probability Distribution Functions has this to say about the normal distribution function: The ‘utpn(x,m,s)’ function uses a normal (Gaussian) distribution with mean ‘m’ and standard deviation ‘s’. It…
4
votes
2 answers

calc: how to specify radix while yanking

I know I can yank into the stack in calc using C-y. However, it seems that calc automatically assumes that I'm yanking in a base-10 number. If I try to specify a radix (like 16# for hex) before yanking and then pressing C-y I get the error message…
mgalgs
  • 474
  • 4
  • 12
3
votes
1 answer

Define a function in Calc (Embedded)

In Calc Embedded Mode, you can define a variable with the := operator. You can then use it in an equation using the => operator and it will be automatically updated when you change the variable. See (calc) Assignments in Embedded…
Nova
  • 1,119
  • 10
  • 22
3
votes
2 answers

How can I sum (multiply ...) all elements on the calc stack?

Sometimes I just want to sum a bunch of numbers in calc. Right now I press + until the stack is empty. Is there a shorthand for this?
Arne
  • 409
  • 3
  • 12
3
votes
2 answers

Simplified embedded Calc

I got excited about Calc's power as an embedded mode. Define some variables in natural inline notation and then do operations on them. But the execution seems a bit messy: you got a separate key bindings when you're in CalcEmbed mode and mistakes…
mike3996
  • 463
  • 4
  • 15
3
votes
2 answers

Calculations à la Emacs Rocks -- with `multiple-cursors`

In this "Emacs Rocks" video relating to the library multiple-cursors ( https://github.com/magnars/multiple-cursors.el ), the author demonstrates a way of swiftly performing calculations, getting the result in the main window (not in the mini…
NVaughan
  • 1,481
  • 12
  • 27
3
votes
1 answer

How can I calc duration between two dates

I'd like to calculate duration time between two dates in calc. <2017-03-21 Mon 18:45> - <2017-03-20 Mon 18:45> = 24 hr How can I do it? I can insert a date to calc by typing ' <2017-03-20 18:45> at calc prompt. I can change the date format by…
Yasushi Shoji
  • 2,186
  • 16
  • 36
3
votes
1 answer

Calc won't fit any curve to any data, complains “Model expression is too complex”

Even if I copy the example from here: http://www.gnu.org/software/emacs/manual/html_node/calc/Linear-Fits.html#Linear-Fits this one: [ [ 1, 2, 3, 4, 5 ] [ 5, 7, 9, 11, 13 ] ] to be more specific, and then press a F 1 RET, all I get is the error…
wvxvw
  • 11,342
  • 2
  • 31
  • 56
2
votes
0 answers

Working with units in emacs calc - unable to achieve expected result

I would like to calculate the following quantity: sqrt{4kTR_S} expressed in nV / sqrt{Hz} (Incidentally, this site does not support math in the posts?) In the above expression, k is Boltzmann's constant (in Joule/Kelvin), T is in Kelvin, R_S is in…
Mike Anblips
  • 668
  • 6
  • 20
1
2 3