- I agree that
0*0.0+0.0 I gives 0.0+0.0 I
- I also expect that
0 * 0.0 + 10.0^-200 should give 0.0+0.0 I
- I also expect that
Arg[-10.^-200 + (0.)] = Pi and Arg[0.0+0.0 I] = 0.0
But that was not my point, Arg[0 *(-10.0^-200+0.0I)] should and has always evaluated to 0.0 but with Mathematica 13.3 it no longer does. In one case it goes to 0.0 and the other case it goes to Pi which is inconsistent and unexpected. I found the test case that things are unexpected and they changed from Mathematica 13.2 to 13.3
The examples below all go to values i expect => Arg[0 x.] goes to 0.0
In[347]:= (*define values*)
i = 50; n = 200.;
(*single number - evaluates to 0.0*)
Arg[0 (-10.^-n + (0.)) I]
(*manual list of numbers - all evaluate to 0.0 including negative Re*)
msk = {0, 0, 0, 0, 0};
comp = {(-0.0` 10.^-n + 0.0 I), -5.234654279824674565789` 10.^-n +
00. I, -4.32467641324676543243` 10.^-n + 0.0 I,
5.234654279824674565789` 10.^-n + 00. I,
4.32467641324676543243` 10.^-n + 0.0 I};
val = msk comp;
arg = Arg[val]
Thread[{msk, comp, val, arg}]
Out[348]= 0.
Out[352]= {0., 0., 0., 0., 0.}
Out[353]= {{0, 0. + 0. I, 0. + 0. I, 0.}, {0, -5.23465*10^-200 + 0. I,
0. + 0. I, 0.}, {0, -4.32468*10^-200 + 0. I, 0. + 0. I, 0.}, {0,
5.23465*10^-200 + 0. I, 0. + 0. I, 0.}, {0, 4.32468*10^-200 + 0. I,
0. + 0. I, 0.}}
But for generated lists they do not, values with small negative Re to to Pi even when multiplied with exact 0 and the actual value that goes into Arg is 0.0+0.0 I the outcome is always Pi. First output is 13.3 second output is 13.2. They are different
In[364]:= (*define values*)
i = 50; n = 200.;
(*generated list of number - everything with negative Re evaluates \
to Pi*)
msk = ConstantArray[0, i];
comp = RandomComplex[{-10.^-n, 10.^-n}, i];
val = msk comp;
arg = Arg[val];
Thread[{msk, comp, val, arg}]
(* proof dat all negative numbers in array evaluate to *)
a = UnitStep[-Sign[Re[comp]]]
b = Sign[Re[val]]
c = Unitize[arg]
a == c
Out[369]= {{0, -3.59355*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -8.71485*10^-201 + 0. I, 0. + 0. I, 3.14159}, {0,
4.51555*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 4.56213*10^-201 + 0. I,
0. + 0. I, 0.}, {0, -1.73914*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, 2.76678*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -7.29739*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -3.88282*10^-202 + 0. I, 0. + 0. I,
3.14159}, {0, -2.38636*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -7.88456*10^-201 + 0. I, 0. + 0. I, 3.14159}, {0,
8.5064*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 9.23848*10^-201 + 0. I,
0. + 0. I, 0.}, {0, -2.09942*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, 6.05198*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
7.35013*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -9.72399*10^-202 + 0. I,
0. + 0. I, 3.14159}, {0, -2.16232*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -1.72071*10^-201 + 0. I, 0. + 0. I, 3.14159}, {0,
2.56238*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -4.72392*10^-202 + 0. I,
0. + 0. I, 3.14159}, {0, 1.46317*10^-201 + 0. I, 0. + 0. I,
0.}, {0, 5.45542*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
6.98144*10^-202 + 0. I, 0. + 0. I, 0.}, {0, 7.52893*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 5.63282*10^-202 + 0. I, 0. + 0. I, 0.}, {0,
5.83295*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 8.2813*10^-201 + 0. I,
0. + 0. I, 0.}, {0, -9.01357*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -7.20074*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -6.65122*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -4.04739*10^-203 + 0. I, 0. + 0. I, 3.14159}, {0,
7.55101*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -5.3072*10^-201 + 0. I,
0. + 0. I, 3.14159}, {0, 5.01132*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
2.43361*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 9.98434*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 5.41462*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
2.51404*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -5.79749*10^-201 + 0. I,
0. + 0. I, 3.14159}, {0, 3.89775*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -2.98549*10^-201 + 0. I, 0. + 0. I, 3.14159}, {0,
5.02625*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 1.49796*10^-203 + 0. I,
0. + 0. I, 0.}, {0, 7.29538*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -4.74217*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -3.63903*10^-201 + 0. I, 0. + 0. I,
3.14159}, {0, -9.08686*10^-201 + 0. I, 0. + 0. I, 3.14159}, {0,
3.00761*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -6.14527*10^-201 + 0. I,
0. + 0. I, 3.14159}, {0, 6.85878*10^-201 + 0. I, 0. + 0. I, 0.}}
Out[370]= {1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, \
1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, \
0, 0, 1, 1, 1, 0, 1, 0}
Out[371]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0}
Out[372]= {1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, \
1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, \
0, 0, 1, 1, 1, 0, 1, 0}
Out[373]= True
Now look at the output from the same code in Mathematica 13.2
In[1]:= (*define values*)
i = 50; n = 200.;
(*generated list of number - everything with negative Re evaluates \
to Pi*)
msk = ConstantArray[0, i];
comp = RandomComplex[{-10.^-n, 10.^-n}, i];
val = msk comp;
arg = Arg[val];
Thread[{msk, comp, val, arg}]
(* proof dat all negative numbers in array evaluate to *)
a = UnitStep[-Sign[Re[comp]]]
b = Sign[Re[val]]
c = Unitize[arg]
a == c
Out[6]= {{0, 4.5418*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
5.69817*10^-202 + 0. I, 0. + 0. I, 0.}, {0, -8.08554*10^-202 + 0. I,
0. + 0. I, 0.}, {0, -2.50589*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
5.8806*10^-202 + 0. I, 0. + 0. I, 0.}, {0, 2.03054*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 2.31057*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
7.43712*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -1.32253*10^-201 + 0. I,
0. + 0. I, 0.}, {0, -4.77195*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
4.58221*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 8.59623*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 4.82584*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -8.78687*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -2.65764*10^-202 + 0. I, 0. + 0. I, 0.}, {0,
2.20168*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 2.74392*10^-202 + 0. I,
0. + 0. I, 0.}, {0, -7.233*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
6.18229*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -1.41438*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 2.30648*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
2.99944*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -9.78346*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 4.17352*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -5.85227*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -5.58142*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -3.90072*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -2.97276*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
7.29687*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -1.34306*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 5.24692*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
8.0529*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -2.38566*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 6.40825*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
6.80501*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -3.68792*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 3.56694*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
7.03833*10^-201 + 0. I, 0. + 0. I, 0.}, {0, 8.75828*10^-201 + 0. I,
0. + 0. I, 0.}, {0, -8.0177*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -4.44713*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -3.30227*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -9.00441*10^-201 + 0. I, 0. + 0. I,
0.}, {0, -1.33593*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
5.87783*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -9.87446*10^-202 + 0. I,
0. + 0. I, 0.}, {0, -9.15533*10^-201 + 0. I, 0. + 0. I, 0.}, {0,
5.32573*10^-201 + 0. I, 0. + 0. I, 0.}, {0, -6.20455*10^-201 + 0. I,
0. + 0. I, 0.}, {0, 6.24134*10^-201 + 0. I, 0. + 0. I, 0.}}
Out[7]= {0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, \
0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, \
1, 0, 1, 1, 0, 1, 0}
Out[8]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0}
Out[9]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0}
Out[10]= False
In my opinion the behavior of 13.2 is the correct and expected one and the output of 13.3 is unexpected.
|