@@ -858,7 +858,7 @@ defmodule Complex do
858858
859859 ### See also
860860
861- `ln /1`
861+ `log /1`
862862
863863 ### Examples
864864
@@ -893,38 +893,41 @@ defmodule Complex do
893893
894894 @ doc """
895895 Returns a new complex that is the complex natural log of the provided
896- complex number, $ln (z) = log_e(z)$.
896+ complex number, $log (z) = log_e(z)$.
897897
898898 ### See also
899899
900900 `exp/1`
901901
902902 ### Examples
903903
904- iex> Complex.ln (Complex.from_polar(2,:math.pi))
904+ iex> Complex.log (Complex.from_polar(2,:math.pi))
905905 %Complex{im: 3.141592653589793, re: 0.6931471805599453}
906906
907907 """
908- @ spec ln ( t | number | non_finite_number ) :: t | number | non_finite_number
909- def ln ( z )
910- def ln ( :infinity ) , do: :infinity
911- def ln ( :neg_infinity ) , do: new ( :infinity , :math . pi ( ) )
912- def ln ( :nan ) , do: :nan
913- def ln ( n ) when is_number ( n ) and n == 0 , do: :neg_infinity
914- def ln ( n ) when is_number ( n ) and n < 0 , do: :nan
915- def ln ( n ) when is_number ( n ) , do: :math . log ( n )
908+ @ spec log ( t | number | non_finite_number ) :: t | number | non_finite_number
909+ def log ( z )
910+ def log ( :infinity ) , do: :infinity
911+ def log ( :neg_infinity ) , do: new ( :infinity , :math . pi ( ) )
912+ def log ( :nan ) , do: :nan
913+ def log ( n ) when is_number ( n ) and n == 0 , do: :neg_infinity
914+ def log ( n ) when is_number ( n ) and n < 0 , do: :nan
915+ def log ( n ) when is_number ( n ) , do: :math . log ( n )
916916
917- def ln ( z = % Complex { } ) do
918- new ( ln ( abs ( z ) ) , atan2 ( z . im , z . re ) )
917+ def log ( z = % Complex { } ) do
918+ new ( log ( abs ( z ) ) , atan2 ( z . im , z . re ) )
919919 end
920920
921+ @ deprecated "Use log/1 instead"
922+ def ln ( x ) , do: log ( x )
923+
921924 @ doc """
922925 Returns a new complex that is the complex log base 10 of the provided
923926 complex number.
924927
925928 ### See also
926929
927- `ln /1`
930+ `log /1`
928931
929932 ### Examples
930933
@@ -936,15 +939,15 @@ defmodule Complex do
936939 def log10 ( z )
937940
938941 def log10 ( :infinity ) , do: :infinity
939- def log10 ( :neg_infinity ) , do: divide ( ln ( :neg_infinity ) , :math . log ( 10 ) )
942+ def log10 ( :neg_infinity ) , do: divide ( log ( :neg_infinity ) , :math . log ( 10 ) )
940943 def log10 ( :nan ) , do: :nan
941944 def log10 ( n ) when is_number ( n ) and n == 0 , do: :neg_infinity
942945 def log10 ( n ) when is_number ( n ) and n < 0 , do: :nan
943946
944947 def log10 ( n ) when is_number ( n ) , do: :math . log10 ( n )
945948
946949 def log10 ( z = % Complex { } ) do
947- divide ( ln ( z ) , new ( :math . log ( 10.0 ) , 0.0 ) )
950+ divide ( log ( z ) , new ( :math . log ( 10.0 ) , 0.0 ) )
948951 end
949952
950953 @ doc """
@@ -953,7 +956,7 @@ defmodule Complex do
953956
954957 ### See also
955958
956- `ln /1`, `log10/1`
959+ `log /1`, `log10/1`
957960
958961 ### Examples
959962
@@ -965,15 +968,15 @@ defmodule Complex do
965968 def log2 ( z )
966969
967970 def log2 ( :infinity ) , do: :infinity
968- def log2 ( :neg_infinity ) , do: divide ( ln ( :neg_infinity ) , :math . log ( 2 ) )
971+ def log2 ( :neg_infinity ) , do: divide ( log ( :neg_infinity ) , :math . log ( 2 ) )
969972 def log2 ( :nan ) , do: :nan
970973 def log2 ( n ) when is_number ( n ) and n == 0 , do: :neg_infinity
971974 def log2 ( n ) when is_number ( n ) and n < 0 , do: :nan
972975
973976 def log2 ( n ) when is_number ( n ) , do: :math . log2 ( n )
974977
975978 def log2 ( z = % Complex { } ) do
976- divide ( ln ( z ) , new ( :math . log ( 2.0 ) , 0.0 ) )
979+ divide ( log ( z ) , new ( :math . log ( 2.0 ) , 0.0 ) )
977980 end
978981
979982 @ doc """
@@ -982,7 +985,7 @@ defmodule Complex do
982985
983986 ### See also
984987
985- `ln /1`, `log10/1`
988+ `log /1`, `log10/1`
986989
987990 ### Examples
988991
@@ -1043,7 +1046,7 @@ defmodule Complex do
10431046 rho = abs ( x )
10441047 theta = phase ( x )
10451048 s = multiply ( pow ( rho , y . re ) , exp ( multiply ( negate ( y . im ) , theta ) ) )
1046- r = add ( multiply ( y . re , theta ) , multiply ( y . im , ln ( rho ) ) )
1049+ r = add ( multiply ( y . re , theta ) , multiply ( y . im , log ( rho ) ) )
10471050 new ( multiply ( s , cos ( r ) ) , multiply ( s , sin ( r ) ) )
10481051 end
10491052 end
@@ -1145,11 +1148,11 @@ defmodule Complex do
11451148
11461149 def asin ( z = % Complex { } ) do
11471150 i = new ( 0.0 , 1.0 )
1148- # result = -i*ln (i*z + sqrt(1.0-z*z))
1149- # result = -i*ln (t1 + sqrt(t2))
1151+ # result = -i*log (i*z + sqrt(1.0-z*z))
1152+ # result = -i*log (t1 + sqrt(t2))
11501153 t1 = multiply ( i , z )
11511154 t2 = subtract ( new ( 1.0 , 0.0 ) , multiply ( z , z ) )
1152- multiply ( negate ( i ) , ln ( add ( t1 , sqrt ( t2 ) ) ) )
1155+ multiply ( negate ( i ) , log ( add ( t1 , sqrt ( t2 ) ) ) )
11531156 end
11541157
11551158 @ doc """
@@ -1220,10 +1223,10 @@ defmodule Complex do
12201223 def acos ( z = % Complex { } ) do
12211224 i = new ( 0.0 , 1.0 )
12221225 one = new ( 1.0 , 0.0 )
1223- # result = -i*ln (z + sqrt(z*z-1.0))
1224- # result = -i*ln (z + sqrt(t1))
1226+ # result = -i*log (z + sqrt(z*z-1.0))
1227+ # result = -i*log (z + sqrt(t1))
12251228 t1 = subtract ( multiply ( z , z ) , one )
1226- multiply ( negate ( i ) , ln ( add ( z , sqrt ( t1 ) ) ) )
1229+ multiply ( negate ( i ) , log ( add ( z , sqrt ( t1 ) ) ) )
12271230 end
12281231
12291232 @ doc """
@@ -1276,11 +1279,11 @@ defmodule Complex do
12761279
12771280 def atan ( z = % Complex { } ) do
12781281 i = new ( 0.0 , 1.0 )
1279- # result = 0.5*i*(ln (1-i*z)-ln (1+i*z))
1282+ # result = 0.5*i*(log (1-i*z)-log (1+i*z))
12801283 t1 = multiply ( new ( 0.5 , 0.0 ) , i )
12811284 t2 = subtract ( new ( 1.0 , 0.0 ) , multiply ( i , z ) )
12821285 t3 = add ( new ( 1.0 , 0.0 ) , multiply ( i , z ) )
1283- multiply ( t1 , subtract ( ln ( t2 ) , ln ( t3 ) ) )
1286+ multiply ( t1 , subtract ( log ( t2 ) , log ( t3 ) ) )
12841287 end
12851288
12861289 @ doc """
@@ -1377,11 +1380,11 @@ defmodule Complex do
13771380
13781381 def acot ( z ) do
13791382 i = new ( 0.0 , 1.0 )
1380- # result = 0.5*i*(ln (1-i/z)-ln (1+i/z))
1383+ # result = 0.5*i*(log (1-i/z)-log (1+i/z))
13811384 t1 = multiply ( new ( 0.5 , 0.0 ) , i )
13821385 t2 = subtract ( new ( 1.0 , 0.0 ) , divide ( i , z ) )
13831386 t3 = add ( new ( 1.0 , 0.0 ) , divide ( i , z ) )
1384- multiply ( t1 , subtract ( ln ( t2 ) , ln ( t3 ) ) )
1387+ multiply ( t1 , subtract ( log ( t2 ) , log ( t3 ) ) )
13851388 end
13861389
13871390 @ doc """
@@ -1433,15 +1436,15 @@ defmodule Complex do
14331436
14341437 def asec ( z = % Complex { } ) do
14351438 i = new ( 0.0 , 1.0 )
1436- # result = -i*ln (i*sqrt(1-1/(z*z))+1/z)
1437- # result = -i*ln (i*sqrt(1-t2)+t1)
1439+ # result = -i*log (i*sqrt(1-1/(z*z))+1/z)
1440+ # result = -i*log (i*sqrt(1-t2)+t1)
14381441 t1 = divide ( 1 , z )
14391442 t2 = square ( t1 )
1440- # result = -i*ln (i*sqrt(t3)+t1)
1441- # result = -i*ln (t4+t1)
1443+ # result = -i*log (i*sqrt(t3)+t1)
1444+ # result = -i*log (t4+t1)
14421445 t3 = subtract ( 1 , t2 )
14431446 t4 = multiply ( i , sqrt ( t3 ) )
1444- multiply ( negate ( i ) , ln ( add ( t4 , t1 ) ) )
1447+ multiply ( negate ( i ) , log ( add ( t4 , t1 ) ) )
14451448 end
14461449
14471450 @ doc """
@@ -1491,15 +1494,15 @@ defmodule Complex do
14911494 def acsc ( z = % Complex { } ) do
14921495 i = new ( 0.0 , 1.0 )
14931496 one = new ( 1.0 , 0.0 )
1494- # result = -i*ln (sqrt(1-1/(z*z))+i/z)
1495- # result = -i*ln (sqrt(1-t2)+t1)
1497+ # result = -i*log (sqrt(1-1/(z*z))+i/z)
1498+ # result = -i*log (sqrt(1-t2)+t1)
14961499 t1 = divide ( i , z )
14971500 t2 = divide ( one , multiply ( z , z ) )
1498- # result = -i*ln (sqrt(t3)+t1)
1499- # result = -i*ln (t4+t1)
1501+ # result = -i*log (sqrt(t3)+t1)
1502+ # result = -i*log (t4+t1)
15001503 t3 = subtract ( one , t2 )
15011504 t4 = sqrt ( t3 )
1502- multiply ( negate ( i ) , ln ( add ( t4 , t1 ) ) )
1505+ multiply ( negate ( i ) , log ( add ( t4 , t1 ) ) )
15031506 end
15041507
15051508 @ doc """
@@ -1565,12 +1568,12 @@ defmodule Complex do
15651568 def asinh ( :nan ) , do: :nan
15661569
15671570 def asinh ( z ) do
1568- # result = ln (z+sqrt(z*z+1))
1569- # result = ln (z+sqrt(t1))
1570- # result = ln (t2)
1571+ # result = log (z+sqrt(z*z+1))
1572+ # result = log (z+sqrt(t1))
1573+ # result = log (t2)
15711574 t1 = add ( multiply ( z , z ) , 1 )
15721575 t2 = add ( z , sqrt ( t1 ) )
1573- ln ( t2 )
1576+ log ( t2 )
15741577 end
15751578
15761579 @ doc """
@@ -1633,12 +1636,12 @@ defmodule Complex do
16331636 def acosh ( :nan ) , do: :nan
16341637
16351638 def acosh ( z ) do
1636- # result = ln (z+sqrt(z*z-1))
1637- # result = ln (z+sqrt(t1))
1638- # result = ln (t2)
1639+ # result = log (z+sqrt(z*z-1))
1640+ # result = log (z+sqrt(t1))
1641+ # result = log (t2)
16391642 t1 = subtract ( multiply ( z , z ) , 1 )
16401643 t2 = add ( z , sqrt ( t1 ) )
1641- ln ( t2 )
1644+ log ( t2 )
16421645 end
16431646
16441647 @ doc """
@@ -1695,13 +1698,13 @@ defmodule Complex do
16951698 def atanh ( z ) do
16961699 one = new ( 1.0 , 0.0 )
16971700 p5 = new ( 0.5 , 0.0 )
1698- # result = 0.5*(ln ((1+z)/(1-z)))
1699- # result = 0.5*(ln (t2/t1))
1700- # result = 0.5*(ln (t3))
1701+ # result = 0.5*(log ((1+z)/(1-z)))
1702+ # result = 0.5*(log (t2/t1))
1703+ # result = 0.5*(log (t3))
17011704 t1 = subtract ( one , z )
17021705 t2 = add ( one , z )
17031706 t3 = divide ( t2 , t1 )
1704- multiply ( p5 , ln ( t3 ) )
1707+ multiply ( p5 , log ( t3 ) )
17051708 end
17061709
17071710 @ doc """
@@ -1742,13 +1745,13 @@ defmodule Complex do
17421745 """
17431746 @ spec asech ( t | number | non_finite_number ) :: t | number | non_finite_number
17441747 def asech ( z ) do
1745- # result = ln (1/z+sqrt(1/z+1)*sqrt(1/z-1))
1746- # result = ln (t1+sqrt(t1+1)*sqrt(t1-1))
1747- # result = ln (t1+t2*t3)
1748+ # result = log (1/z+sqrt(1/z+1)*sqrt(1/z-1))
1749+ # result = log (t1+sqrt(t1+1)*sqrt(t1-1))
1750+ # result = log (t1+t2*t3)
17481751 t1 = divide ( 1 , z )
17491752 t2 = sqrt ( add ( t1 , 1 ) )
17501753 t3 = sqrt ( subtract ( t1 , 1 ) )
1751- ln ( add ( t1 , multiply ( t2 , t3 ) ) )
1754+ log ( add ( t1 , multiply ( t2 , t3 ) ) )
17521755 end
17531756
17541757 @ doc """
@@ -1787,13 +1790,13 @@ defmodule Complex do
17871790 """
17881791 @ spec acsch ( t | number | non_finite_number ) :: t | number | non_finite_number
17891792 def acsch ( z ) do
1790- # result = ln (1/z+sqrt(1/(z*z)+1))
1791- # result = ln (t1+sqrt(t2+1))
1792- # result = ln (t1+t3)
1793+ # result = log (1/z+sqrt(1/(z*z)+1))
1794+ # result = log (t1+sqrt(t2+1))
1795+ # result = log (t1+t3)
17931796 t1 = divide ( 1 , z )
17941797 t2 = divide ( 1 , multiply ( z , z ) )
17951798 t3 = sqrt ( add ( t2 , 1 ) )
1796- ln ( add ( t1 , t3 ) )
1799+ log ( add ( t1 , t3 ) )
17971800 end
17981801
17991802 @ doc """
@@ -1834,13 +1837,13 @@ defmodule Complex do
18341837 """
18351838 @ spec acoth ( t | number | non_finite_number ) :: t | number | non_finite_number
18361839 def acoth ( z ) do
1837- # result = 0.5*(ln (1+1/z)-ln (1-1/z))
1838- # result = 0.5*(ln (1+t1)-ln (1-t1))
1839- # result = 0.5*(ln (t2)-ln (t3))
1840+ # result = 0.5*(log (1+1/z)-log (1-1/z))
1841+ # result = 0.5*(log (1+t1)-log (1-t1))
1842+ # result = 0.5*(log (t2)-log (t3))
18401843 t1 = divide ( 1 , z )
18411844 t2 = add ( 1 , t1 )
18421845 t3 = subtract ( 1 , t1 )
1843- multiply ( 0.5 , subtract ( ln ( t2 ) , ln ( t3 ) ) )
1846+ multiply ( 0.5 , subtract ( log ( t2 ) , log ( t3 ) ) )
18441847 end
18451848
18461849 @ doc ~S"""
0 commit comments