Skip to main content

Questions tagged [arithmetic]

Questions on arithmetic operations in Mathematica.

Filter by
Sorted by
Tagged with
4 votes
4 answers
224 views

Lines of intersections in a parabola

To test the parabolic sieve, my intention was for the graph to show the coordinates of two points on the parabola and the value of the intersection on the y-axis. A table with this information would ...
Rubens Vilhena Fonseca's user avatar
3 votes
2 answers
677 views

Recycle buying soda problem

there is a question: " If a bottle of soda costs \$1 and you can exchange two empty bottles for one soda, how many sodas can you drink with \$20 " ...
我心永恒's user avatar
  • 1,572
3 votes
2 answers
127 views

How can I enforce the use of Subtract and Divide?

It has been noted before, here and here, that when you enter a/b or a-b, Mathematica does not convert these to ...
Felipe's user avatar
  • 669
4 votes
5 answers
497 views

How to check if multiplication requires carries?

For some purposes I need to know if there are there any carries in the multiplication of two numbers, especially in base-2. How can we do this in Mathematica? Thanks to all, very interesting answers! ...
lesobrod's user avatar
  • 1,894
4 votes
1 answer
152 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
66 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,692
3 votes
1 answer
213 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,692
14 votes
2 answers
316 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
181 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
  • 490
3 votes
0 answers
74 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,193
-3 votes
1 answer
112 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
402 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,325
0 votes
0 answers
63 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
249 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
25 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
164 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
253 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
  • 6,263
2 votes
3 answers
744 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
340 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
  • 490
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,193
2 votes
1 answer
88 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,441
17 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
166 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 ...
Arji's user avatar
  • 1,134
1 vote
0 answers
76 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
68 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
  • 411
3 votes
2 answers
122 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,651
2 votes
2 answers
66 views

LocalTime arithmetic

In an attempt to calculate the time difference between two cities I enter: ...
JEM's user avatar
  • 1,185
0 votes
0 answers
95 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
161 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
88 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
284 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,788
8 votes
3 answers
392 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
  • 576
3 votes
1 answer
115 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
215 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
96 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
5 votes
0 answers
88 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
  • 221
3 votes
1 answer
145 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
  • 19.1k
2 votes
1 answer
212 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
77 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
488 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,079
4 votes
2 answers
129 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
157 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
110 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
107 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
204 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,644
1 vote
0 answers
51 views

Buggy IntervalUnion with Quantities?

IntervalUnion can give wrong output when used with Quantity: ...
alancalvitti's user avatar
  • 15.2k
2 votes
1 answer
181 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,226
1 vote
3 answers
375 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
728 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
399 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