Questions tagged [arithmetic]

Questions on arithmetic operations in Mathematica.

Filter by
Sorted by
Tagged with
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, ..., ...
Zhengyuan Yue's user avatar
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? ...
Anixx's user avatar
  • 3,473
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 ...
Anixx's user avatar
  • 3,473
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 ...
Alexey Popkov's user avatar
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 ...
BeTDa's user avatar
  • 480
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... ...
MikeY's user avatar
  • 7,113
-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 ...
NARI MILANI's user avatar
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 ...
imida k's user avatar
  • 4,037
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$.
user1868607's user avatar
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 ...
wannaintegrate's user avatar
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 ...
MiKK's user avatar
  • 563
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 ...
Peter Burbery's user avatar
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...
Tugrul Temel's user avatar
  • 5,305
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 ...
user81348's user avatar
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 ...
BeTDa's user avatar
  • 480
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 ...
MikeY's user avatar
  • 7,113
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 ...
Red Banana's user avatar
  • 5,121
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 ...
Simpleton Jack's user avatar
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 ...
Arjihad's user avatar
  • 1,134
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?
Abcderia's user avatar
  • 115
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 ...
jjagmath's user avatar
  • 412
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 ...
user13892's user avatar
  • 9,043
2 votes
2 answers
56 views

LocalTime arithmetic

In an attempt to calculate the time difference between two cities I enter: ...
JEM's user avatar
  • 1,147
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? ...
Yizhen Chen's user avatar
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 ...
Antimony51's user avatar
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. ...
mikemtnbikes's user avatar
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 ...
user57467's user avatar
  • 2,304
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. ...
OpticsMan's user avatar
  • 560
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 ...
OkkesDulgerci's user avatar
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 ...
jcora's user avatar
  • 103
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: ...
sreeraj t's user avatar
  • 303
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 ...
Radost's user avatar
  • 211
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 ...
kirma's user avatar
  • 18.6k
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 ...
MGK's user avatar
  • 565
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 <...
Javier Giménez Moya's user avatar
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?...
user6546's user avatar
  • 1,027
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 ...
Richard Burke-Ward's user avatar
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: ...
Robin Geyer's user avatar
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: ...
ylluminate's user avatar
-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! ...
D. Andrew's user avatar
  • 423
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} } ...
Nico A's user avatar
  • 3,604
1 vote
0 answers
50 views

Buggy IntervalUnion with Quantities?

IntervalUnion can give wrong output when used with Quantity: ...
alancalvitti's user avatar
2 votes
1 answer
175 views

Two-slot pure function [closed]

I come across this problem in many different forms when doing arithmetic in MMA and have until now just suffered along doing it the long way – having given up trying to figure it out myself – but now ...
BBirdsell's user avatar
  • 1,156
1 vote
3 answers
358 views

select, group and manipulate elements in list based on date ranges

Question from a beginner. I have data containing dates and values of the format: ...
flux's user avatar
  • 33
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: ...
tribbloid's user avatar
  • 167
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 \;, $$ ...
Joseph O'Rourke's user avatar
9 votes
2 answers
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. ...
An old man in the sea.'s user avatar
0 votes
1 answer
204 views

How can I make Mathematica agree that 0^0 = 1? [duplicate]

Occasionally I encounter messages like Power::indet: Indeterminate expression (0. + 0. I)^0 encountered. (or just 0^0). I believe I can safely declare these to be 1 for all of my purposes. Is ...
მამუკა ჯიბლაძე's user avatar
3 votes
1 answer
183 views

Generating prime factorizations from an integer's digits by inserting * and ^ into the digit sequence

Problem Given a positive integer, output all possible valid prime-factorization "statements" thereof created by inserting zero or more multiplication (*) symbols and zero or more power (^) symbols ...
Hans Havermann's user avatar
11 votes
1 answer
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 ...
iot's user avatar
  • 619