# Questions tagged [arithmetic]

Questions on arithmetic operations in Mathematica.

93 questions
Filter by
Sorted by
Tagged with
2k views

### 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 ...
1k views

### 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 ...
3k views

### 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 ($+$), ...
681 views

### 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 ...
5k views

### 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. ...
1k views

### 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 ...
3k views

### Product of elements of a list

Sum is for functions; Total is for a list. Product is for a function; what is the command ... 1k views

### How to enter a repeating decimal in Mathematica

I don't understand how to manipulate numbers with repeating decimal in Wolfram Mathematica language. For example 0.3... does not work as input and I don't see how ...
329 views

### 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  (...
11k views

### 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?
235 views

### 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 ...
173 views

### Trace of -{1} expression

I'm trying to understand Trace. Usually it doesn't repeat but it adds {-1,-1} for his simple expression after having a correct ...
856 views

### Why am I seeing what looks like a violation of operator precedence?

Why is it that when I evaluate 2*2.848529281693615+3*-0.5155083247776808 I get (* -2.93688 *) which is wrong. ...
232 views

### 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 ...
1k views

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\... 8 votes 3 answers 388 views ### 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. ... 8 votes 4 answers 1k views ### Countdown arithmetic solver In the numbers game in countdown, contestants are given 6 numbers with which they must reach a seventh number with basic arithmetic. The only operations allowed are addition, subtraction, ... 7 votes 2 answers 2k views ### 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... 7 votes 2 answers 237 views ### Is there a way to show the details of a numerical computation? I have recently started using Mathematica as a calculator while teaching (definitely overkill, but I try to use as few tools as possible). I would like my students to be able to trace simple numerical ... 7 votes 1 answer 177 views ### Running Mathematica in 'SpouseMode' In this previous question I looked into a deprecated capability of Mathematica from Version 2. Mathematica command that allows it to read my intentions Thanks to all for your answers. I note that ... 5 votes 14 answers 2k views ### Sum of Squares without multiplication I want to sum the squares for a given number N from 1 without using Multiplication. Is it possible? 5 votes 3 answers 533 views ### How to find a longest word path in dictionary? Cross post here A word path means the last character of the last word is same to the first character of the next word.And the path have no duplicated word.If I have$55$words,I can find it with this ... 5 votes 1 answer 246 views ### Does Mathematica simplify calculation when encounter zero? e.g. when Mathematica Calculating f[x0]=A[x0] B[x0], where A[x] & B[x] could be some complicated high dimensional function. Will Mathematica outcome 0 directly ... 5 votes 1 answer 414 views ### 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 <... 4 votes 3 answers 2k views ### 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.... 4 votes 2 answers 379 views ### Interchanging addition and multiplication Suppose I have an expression that employs addition and multiplication, but no subtraction or division: $$2 a + 5 b x^3 + c \;.$$ I would like to change this to $$(2 + a) (5 +b + x +x +x) c \;,$$ ... 4 votes 2 answers 200 views ### Multiplication non-deterministic? I have two vectors of 134 elements each ($mu$, and$gt$).$mu$contains Integers, and$gt$contains machine precision Reals. I execute the following simple expression multiple times without changing ... 4 votes 1 answer 401 views ### multiply two vectors, component by component [closed] Would like to take two vectors and multiply components at the same index.For example {a1, a2, a3} x {b1, b2, b3} to produce {a1 b1, a2 b2, a3 b3}. The following works, but are there some alternatives?... 4 votes 2 answers 2k views ### Floating point addition not associative Can anybody explain the following behavior? x = 0.2 + (0.3 + 0.1); y = (0.2 + 0.3) + 0.1; x == y (* -> True *) But actually the variables do not exactly ... 4 votes 1 answer 87 views ### Simplify expressions with modulo 2 (Boolean algebra) Suppose I have a (Boolean algebra) expression a = p1 x^2 + p2 x (x-1) + 3 p3 + 4 p4 x where p1, ..., ... 4 votes 2 answers 110 views ### Raise a table of pre-existing data to the power of of one of the variables NOTE: I have edited this question to give a table whose first elements don't count up from 0 to 5. I'm using a sample table ... 4 votes 3 answers 193 views ### A sudoku-like collection puzzle I have a puzzle. I'm given a collection of$n$lists, all of equal (but arbitrary) length$l$. These lists are made up of 0s and a few filled in numbers, like so: { {0, 2}, {0,0}, {6, 0}, {0,0} } ... 4 votes 1 answer 148 views ### Machine Epsilon is not equal to$MachineEpsilon [duplicate]

I try to wrap my head around machine precision calculations in Mathematica (11.2, Linux). I do not understand the following behavior: ...