Questions tagged [arithmetic]

Questions on arithmetic operations in Mathematica.

Filter by
Sorted by
Tagged with
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 ...
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, ..., ...
16 votes
3 answers
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 ...
13 votes
2 answers
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 ...
0 votes
1 answer
53 views

How can I redefine multiplication this way?

I want the product of matrix objects to be evaluated to the matrix object of dot products of the arguments, but only if the matrices commute. Why this does not work? ...
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....
3 votes
1 answer
200 views

How can I redefine multiplication?

For instance, I want 0 Infinity = 0 I tried this: Unprotect[Times];Times[Infinity,0]=0;Times[0,Infinity]=0;Protect[Times]; But ...
1 vote
2 answers
175 views

Express rational and infinite expressions in Mathematica [closed]

I have several doubts about notation. I would appreciate any clarifications. a) I can express, for example, a periodic or semi-periodic number without writing it in its rational form. Can such ...
3 votes
0 answers
73 views

Problem with Mathematica Relationship Building

When I enter the following to get Mathematica to open my pod door I get Could someone try and replicate this? Also, my name is not Dave and I throw my own error... ...
-3 votes
1 answer
106 views

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 ...
1 vote
1 answer
269 views

The square of Abs of a complex number

We all know that 4^2 + 22^2 = 500 Is there a natural way to generates 500 from the complex number ...
0 votes
0 answers
53 views

Ordinal arithmetic

How can I compute with ordinals in mathematica? For instance, I'd like to query $2+\omega > 1 + 2 \omega$.
2 votes
3 answers
594 views

Rounding Real number

I have real numbers in array, I want to round (or truncate) these numbers to 2-digit after decimal point, then I want to write values to Excel File For example if I have ...
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 ...
1 vote
0 answers
24 views

Mathematica 12.1: Evaluation result does not show decimals [duplicate]

It surprises me that Mathematica does not show decimals after evaluating the following calculations: 500000+5.05 Result: 500005. Expecting: 500005.05 ...
2 votes
1 answer
128 views

How does Leafcount work? [closed]

I am curious about how LeafCount works because when I count the number of leaves in my solution to a Wolfram Challenge, I get a much smaller result than those listed on the leaderboard for Multiples ...
2 votes
2 answers
212 views

How to calculate percentage change using Dataset[]

With the following code, I can calculate percentage changes in selected indicators over time. The code is not efficient nor practical to integrate it into Manipulate...
36 votes
8 answers
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 ($+$), ...
0 votes
1 answer
607 views

How to multiply a vector by a scalar?

I'm plotting a simple 2D graph derived from 4 3D vectors: ...
42 votes
2 answers
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 ...
0 votes
2 answers
282 views

How to generate multiplication tables up to nxn?

I'm doing a simple multiplication table and I have this that I'm having a hard time with. I imagine that there must be a shorter way to do it, what I can't get is that it paints black the first column ...
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 ...
2 votes
1 answer
81 views

Can we change Mathematica's original number system for arithmetic mod p or other arithmetic systems?

It seems Mathematica has a standard arithmetic system that resembles real numbers. Can we change Mathematica's original number system for arithmetic mod p so that whenever we write expressions, it sum ...
3 votes
1 answer
161 views

Solving calculation puzzle [closed]

I recently got asked how to achieve a result of 100 only using the numbers {1,7,7,7,7} (the number 1 can be used only once and ...
17 votes
1 answer
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 ...
1 vote
0 answers
66 views

Explanation on why this gives overflow?

If you have a phrase like $10^{0.00057 \cdot 10^{42}}$ that gives "overflow", what is the reason? Is it because, well, something about the size of this whole thing?
2 votes
0 answers
67 views

Should I redefine 0^0 [duplicate]

I've found some times, while playing with combinatorics, that Mathematica can't calculate some functions because $0^0$ is not defined as $1$. (I know that some people think that $0^0$ should be left ...
3 votes
2 answers
117 views

Can I make RandomInstance use exact arithmetic?

When using RandomInstance on a GeometricScene the answer loses precision when root objects are encountered. Is there a way to ...
2 votes
2 answers
56 views

LocalTime arithmetic

In an attempt to calculate the time difference between two cities I enter: ...
0 votes
0 answers
81 views

Why does Log[Abs[#]] return a complex number?

For a nonzero number $x$, $\log|x|$ should be a real number. Why does the following NestList contain non-real numbers when no numbers involved are close to zero? Is it a bug? ...
8 votes
4 answers
1k views

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\...
2 votes
1 answer
173 views

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 ...
3 votes
3 answers
149 views

Why does the Mathematica give different numerical results?

Why do the two inputs give different values? in:=(-y)^a /. a -> 2.99 /. y -> -2 out:=7.94474 and ...
3 votes
2 answers
81 views

Advice for making addition and multiplication tables for my kid

I'm working with my 6 year old on understanding and mastering addition. As a result, I want to be able to make some custom addition (and eventually multiplication) tables for her to fill out. ...
3 votes
2 answers
252 views

Applying Mod on list of list with outcomes +1, -1, other

I have a list lis = {{7, 8}, {17, 9}, {11, 10}, {12,10}} I want to apply Mod to each pair with output +1,-1 or ...
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. ...
3 votes
1 answer
111 views

Why Divide does not give the same answer? [closed]

I saw a question on Facebook $8\div2 (2 + 2)=?$ Consider these inputs. Divide[8, 2 (2 + 2)] 1 $8\div2 (2 + 2)$ using esc+div+esc 16 Why the results are ...
0 votes
2 answers
142 views

Mathematica doesn't evaluate/simplify arithmetic expression in its output [closed]

I have two matrices, A := {{1, 2, -4}, {2, -2, -2}, {-4, -2, 1}} and ...
0 votes
1 answer
88 views

Generating columns in table and header for exported data file automatically

I have a code that goes like this: ...
4 votes
0 answers
80 views

Force computation on IEEE float/double

I'm checking two different procedures that will eventually be used with regular floating point arithmetic. I need to estimate numerical error arising from floating point arithmetic. Is there a way to ...
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?...
3 votes
1 answer
124 views

Forcing divisions to be a machine-precision floating point divisions instead of multiplication by inverse

I want to imitate machine-precision, de facto IEEE division on Mathematica. On my quick trials I find this surprisingly hard to accomplish, since Mma rewrites a / b ...
2 votes
1 answer
207 views

How to form subgraphs from a connected graph

I have a connected graph with 72 nodes and its binary adjacency matrix. I need to find all possible connected subgraphs with exactly 6 nodes, i.e., I need to find all connected subgraphs and each ...
0 votes
3 answers
75 views

Roots of an algebraic expresion [duplicate]

If in WolframAlpha I put (-8)^(2/3) then it outputs the main root and 3 roots solution too (to the end in a polar graphic). How can I get the 3 root solution of <...
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
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: ...
2 votes
1 answer
108 views

How do I emulate Excel's Series AutoFill function?

I have a series of data that I would like to extrapolate out another 20 times. The data in question is: ...
1 vote
0 answers
50 views

Buggy IntervalUnion with Quantities?

IntervalUnion can give wrong output when used with Quantity: ...
-1 votes
1 answer
106 views

Could this Be a Bug in V.11.1.1.0 [duplicate]

Here is an elementary third root calculation of -8 (or any negative real number) with and without parentheses, but Mathematica seems to be given different answers! ...
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} } ...