Le vendredi 15 août 2014 à 11:28 +0200, Samuel Gougeon a écrit : > Hello Pierre, > > Le 15/08/2014 10:52, Pierre Vuillemin a écrit : > > Le jeudi 14 août 2014 à 19:46 +0200, Samuel Gougeon a écrit : > >> With Scilab 5.5.0 on Windows 7 x64: > >> -->z = 2*%i > >> z = > >> 2.i > >> -->disp([atan(z),%i/2*log((%i+z)/(%i-z))]) > >> > >> 1.5707963 + 0.5493061i 1.5707963 + 0.5493061i > > I am on a 64-bit linux environment (Debian Jessie, Scilab 5.5.0), the > > result would be OS-dependent? > It is possible. Some packages or/and some single functions -- including > maths ones -- depend on the OS. > > The relation > > > > log(ab) = log(a) + log(b) > > > > only stands for the multi-valued logarithm function (or modulo pi). With > > the principal value of the log, defined as > > > > log(z) = ln(|z|) + i * arg(z) > > > > where -pi<arg(z)<=pi, > Is this interval conventionnaly standard for the principal value, rather > than -pi <= arg(z) < pi ?
I have considered the same definitions as in (Section 4.1.2) Handbook of Mathematical Functions: With Formulas, Graphs, and Mathematical tables Milton Abramowitz,Irene A. Stegun or Branch Cuts for Complex Elementary Functions or Much Ado About Nothing's Sign Bit W. Kahan The same domain for the principal value is used by Wolfram, http://mathworld.wolfram.com/ComplexArgument.html by Matlab, http://www.mathworks.fr/fr/help/symbolic/mupad_ref/arg.html and seems to be used by Scilab as well https://help.scilab.org/docs/5.5.0/en_US/atan.html > > this is not true as soon as -pi<arg(a)+arg(b)<= > > pi. In particular, it is not true on the branch cut (- inf, 0]. > > For instance, > > > > log(-1) = j pi > > > > log(-1)+log(-1) = 2j pi != log(1) = 0 > It is, modulo 2.pi : i.2.pi [2.pi] ~ i.0 = 0 The relation is also violated for any complex in the upper left half plane, thus the modulo operation is not very well suited here. Something less ambiguous seems to use the "unwinding number" : The unwinding Number (R.M. Corless and D.J. Jeffrey) : http://www.apmaths.uwo.ca/~djeffrey/Offprints/editors.pdf which basically consists in adding 2Ki pi whenever required to make standard relations work everywhere in the complex plane. > > This is merely a problem of convention in the definitions, but this > > leads to differences in the value of the atan on its branch cuts. > Indeed. Both results that you get from atan and log on Linux are > correct, and equivalent. > Results from win7 are equal and agree with the standard interval (-pi, pi]. > > Samuel > I perfectly understand that each definition is equivalent "up to 2K i pi", yet from a numerical point of view, it seems to me that they cannot be considered as equivalent. But the thing that really intrigues me is why the built-in function of atan in Scilab does not lead to the same result (in the exact sense) as the formulation in the commentary of the code 'watan.f'. I will try to determine what is really called by Scilab. The OS atan would correspond. Thank you for your answers. :) Pierre > _______________________________________________ > users mailing list > users@lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users _______________________________________________ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users