Questions tagged [arithmetic]

Questions on arithmetic operations in Mathematica.

Filter by
Sorted by
Tagged with
118 votes
1 answer

Why are numeric division and subtraction not handled better in Mathematica?

There is something that has been troubling me for a while. At least through version 10.0 the performance of a / b and a - b is ...
Mr.Wizard's user avatar
  • 269k
17 votes
1 answer

How to prevent reduction of a fraction into lowest terms?

I have a question about the concept of simplification. I want to explain it with an example. When I write the fraction $4/8$ in Mathematica, the output is 1/2. How ...
MATIRMAK's user avatar
  • 739
42 votes
2 answers

Is there a difference between Divide[a,b] and a/b?

In this comment it was asserted that Divide[a,b] and a/b are different, though the documentation indicates that they are the ...
Mark Adler's user avatar
  • 4,939
36 votes
8 answers

Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$

Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$. Looks like a question for pupils, right? In fact, if the available math symbols are limited to addition ($+$), ...
xzczd's user avatar
  • 62.9k
4 votes
3 answers

Permanently rounding numbers/values to a given number of significant figures

I am searching for a simple way of rounding and setting an input to a desired number of significant figures. There are a vast number of posts that discuss similar problems, but none address this issue....
George Papadopoulos's user avatar
2 votes
1 answer

Why does this whole number have a recurring value? [duplicate]

I have a math question which that may seem simple to some but not to me if you where to do the calculation 12.30 * 12 it would equal 147.60 but why is that when I show the answer to more then two ...
MrJoshFisher's user avatar
16 votes
1 answer

How does Plus work on machine precision Real arguments?

I thought Kahan's summation method would make a nice example for students to use to think about round-off error [W. Kahan, Pracniques: Further Remarks on Reducing Truncation Errors, Commun. ACM 8  (...
Michael E2's user avatar
  • 233k
18 votes
6 answers

Puzzle with Mathematica

Hello everyone, This is a puzzle I got from someone via social media. Basically, we need to fill up the boxes with the numbers 1-9 (no repetitions) that fit the multiplication and addition operations. ...
iFikr's user avatar
  • 347
29 votes
2 answers

Should 0 * 5ft be 0 or 0ft?

After playing with the new quantity system in Mathematica 9 for a while, I keep stumbling over this issue: 0 * Quantity[1, "Meters"] is not the same as ...
Niki Estner's user avatar
  • 35.9k
16 votes
8 answers

Product of elements of a list

Sum is for functions; Total is for a list. Product is for a function; what is the command ...
user avatar
15 votes
3 answers

Expressing a decimal as a fraction in lowest terms

How can I express a decimal such as 0.1845095405274387 as a fraction in its lowest terms?
emmett's user avatar
  • 359
13 votes
2 answers

Arithmetic operations on NumericArrays

Currently, NumericArrays are directly supported by the most important array-related functions, what makes them a very attractive data structure for implementing ...
Alexey Popkov's user avatar
7 votes
2 answers

How to do binary calculation?

For example, $a=0.10101$ in binary representation. Then how to calculate $a^2$ directly in mathematica? Is there any function turning binary into decimal? I only found its inverse...
Doris's user avatar
  • 172
1 vote
1 answer

Why I'm getting 9999s after decimal and how do I fix it? [duplicate]

Check the screen shot. Why I'm getting 999s? It is suppose to be 127,977.52 Thanks in advance, Quick solution: AccountingForm[58156.48 + 69821.04, 16] And thanks to Yves Klett
Kruz's user avatar
  • 13
9 votes
1 answer

Arbitrary-Precision Arithmetic behaves unexpectedly

I want to understand how small numerical errors propagate through a computation and may drastically change the final result. To this end, I consider a toy world in which every number is limited to ...
user19095's user avatar
  • 389
8 votes
4 answers

How to recover Pauli matrices properties in Mathematica?

I want to do a cross or dot product involving a vector of Pauli matrices $ \vec\sigma=(\sigma^1, \sigma^2, \sigma^3) $; for example, $ \vec\sigma\times\vec\sigma=2\mathrm i\vec\sigma $ and $ \vec\...
user3654016's user avatar
8 votes
3 answers

Improving Map Function on Lists

Dealing with spectral data (2D lists) where offsets (corresponding 1D list) must be removed from each individual spectrum. Looking for feedback on improvements over my current method. ...
OpticsMan's user avatar
  • 560
5 votes
1 answer

Why can't I remove Orderless from Plus?

I am making some random algebra equations, and I want to have the ordering be random too, such that if my random equation generator makes x+1, the output stays <...
VF1's user avatar
  • 4,642
4 votes
0 answers

Simple arithmetic with Irrationals fails [closed]

While solving a simple puzzle that asked for a few calculations in plane geometry, I ended up with this expression: $-\frac{55}{2}+\frac{\sqrt{27233}}{2}+\frac{1}{2}(55-\sqrt{27233})$ Or, in ...
Felix Kasza's user avatar
2 votes
1 answer

How to find the local minimum points in the multi-dimensional numerical data?

I am trying to get some local minima of an n-dimensional function (which only has numerical form). For two-dimensional function data, we can find the local minimum points from the contour plot easily. ...
Orders's user avatar
  • 1,227
-3 votes
1 answer

long division acurate answer on dividing long numbers [closed]

ok but first of all if i have the huge number to be divided what will i have to use for the division to be accurate long division or some other formula square root or 2 this is to calculate music ...
NARI MILANI's user avatar