00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef HAVE_CONFIG_H
00025 #include <config.h>
00026 #endif
00027
00028 #include <cctype>
00029 #include <cfloat>
00030
00031 #include "lo-ieee.h"
00032 #include "lo-specfun.h"
00033 #include "lo-mappers.h"
00034
00035 #include "defun.h"
00036 #include "error.h"
00037 #include "variables.h"
00038
00039 DEFUN (abs, args, ,
00040 "-*- texinfo -*-\n\
00041 @deftypefn {Mapping Function} {} abs (@var{z})\n\
00042 Compute the magnitude of @var{z}, defined as\n\
00043 @tex\n\
00044 $|z| = \\sqrt{x^2 + y^2}$.\n\
00045 @end tex\n\
00046 @ifnottex\n\
00047 |@var{z}| = @code{sqrt (x^2 + y^2)}.\n\
00048 @end ifnottex\n\
00049 \n\
00050 For example:\n\
00051 \n\
00052 @example\n\
00053 @group\n\
00054 abs (3 + 4i)\n\
00055 @result{} 5\n\
00056 @end group\n\
00057 @end example\n\
00058 @end deftypefn")
00059 {
00060 octave_value retval;
00061 if (args.length () == 1)
00062 retval = args(0).abs ();
00063 else
00064 print_usage ();
00065
00066 return retval;
00067 }
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 DEFUN (acos, args, ,
00087 "-*- texinfo -*-\n\
00088 @deftypefn {Mapping Function} {} acos (@var{x})\n\
00089 Compute the inverse cosine in radians for each element of @var{x}.\n\
00090 @seealso{cos, acosd}\n\
00091 @end deftypefn")
00092 {
00093 octave_value retval;
00094 if (args.length () == 1)
00095 retval = args(0).acos ();
00096 else
00097 print_usage ();
00098
00099 return retval;
00100 }
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 DEFUN (acosh, args, ,
00122 "-*- texinfo -*-\n\
00123 @deftypefn {Mapping Function} {} acosh (@var{x})\n\
00124 Compute the inverse hyperbolic cosine for each element of @var{x}.\n\
00125 @seealso{cosh}\n\
00126 @end deftypefn")
00127 {
00128 octave_value retval;
00129 if (args.length () == 1)
00130 retval = args(0).acosh ();
00131 else
00132 print_usage ();
00133
00134 return retval;
00135 }
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 DEFUN (angle, args, ,
00153 "-*- texinfo -*-\n\
00154 @deftypefn {Mapping Function} {} angle (@var{z})\n\
00155 See arg.\n\
00156 @end deftypefn")
00157 {
00158 octave_value retval;
00159 if (args.length () == 1)
00160 retval = args(0).arg ();
00161 else
00162 print_usage ();
00163
00164 return retval;
00165 }
00166
00167 DEFUN (arg, args, ,
00168 "-*- texinfo -*-\n\
00169 @deftypefn {Mapping Function} {} arg (@var{z})\n\
00170 @deftypefnx {Mapping Function} {} angle (@var{z})\n\
00171 Compute the argument of @var{z}, defined as,\n\
00172 @tex\n\
00173 $\\theta = atan2 (y, x),$\n\
00174 @end tex\n\
00175 @ifnottex\n\
00176 @var{theta} = @code{atan2 (@var{y}, @var{x})},\n\
00177 @end ifnottex\n\
00178 in radians.\n\
00179 \n\
00180 For example:\n\
00181 \n\
00182 @example\n\
00183 @group\n\
00184 arg (3 + 4i)\n\
00185 @result{} 0.92730\n\
00186 @end group\n\
00187 @end example\n\
00188 @end deftypefn")
00189 {
00190 octave_value retval;
00191 if (args.length () == 1)
00192 retval = args(0).arg ();
00193 else
00194 print_usage ();
00195
00196 return retval;
00197 }
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 DEFUN (asin, args, ,
00223 "-*- texinfo -*-\n\
00224 @deftypefn {Mapping Function} {} asin (@var{x})\n\
00225 Compute the inverse sine in radians for each element of @var{x}.\n\
00226 @seealso{sin, asind}\n\
00227 @end deftypefn")
00228 {
00229 octave_value retval;
00230 if (args.length () == 1)
00231 retval = args(0).asin ();
00232 else
00233 print_usage ();
00234
00235 return retval;
00236 }
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250 DEFUN (asinh, args, ,
00251 "-*- texinfo -*-\n\
00252 @deftypefn {Mapping Function} {} asinh (@var{x})\n\
00253 Compute the inverse hyperbolic sine for each element of @var{x}.\n\
00254 @seealso{sinh}\n\
00255 @end deftypefn")
00256 {
00257 octave_value retval;
00258 if (args.length () == 1)
00259 retval = args(0).asinh ();
00260 else
00261 print_usage ();
00262
00263 return retval;
00264 }
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281 DEFUN (atan, args, ,
00282 "-*- texinfo -*-\n\
00283 @deftypefn {Mapping Function} {} atan (@var{x})\n\
00284 Compute the inverse tangent in radians for each element of @var{x}.\n\
00285 @seealso{tan, atand}\n\
00286 @end deftypefn")
00287 {
00288 octave_value retval;
00289 if (args.length () == 1)
00290 retval = args(0).atan ();
00291 else
00292 print_usage ();
00293
00294 return retval;
00295 }
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316 DEFUN (atanh, args, ,
00317 "-*- texinfo -*-\n\
00318 @deftypefn {Mapping Function} {} atanh (@var{x})\n\
00319 Compute the inverse hyperbolic tangent for each element of @var{x}.\n\
00320 @seealso{tanh}\n\
00321 @end deftypefn")
00322 {
00323 octave_value retval;
00324 if (args.length () == 1)
00325 retval = args(0).atanh ();
00326 else
00327 print_usage ();
00328
00329 return retval;
00330 }
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347 DEFUN (cbrt, args, ,
00348 "-*- texinfo -*-\n\
00349 @deftypefn {Mapping Function} {} cbrt (@var{x})\n\
00350 Compute the real cube root of each element of @var{x}.\n\
00351 Unlike @code{@var{x}^(1/3)}, the result will be negative if @var{x} is\n\
00352 negative.\n\
00353 @seealso{nthroot}\n\
00354 @end deftypefn")
00355 {
00356 octave_value retval;
00357 if (args.length () == 1)
00358 retval = args(0).cbrt ();
00359 else
00360 print_usage ();
00361
00362 return retval;
00363 }
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379 DEFUN (ceil, args, ,
00380 "-*- texinfo -*-\n\
00381 @deftypefn {Mapping Function} {} ceil (@var{x})\n\
00382 Return the smallest integer not less than @var{x}. This is equivalent to\n\
00383 rounding towards positive infinity. If @var{x} is\n\
00384 complex, return @code{ceil (real (@var{x})) + ceil (imag (@var{x})) * I}.\n\
00385 \n\
00386 @example\n\
00387 @group\n\
00388 ceil ([-2.7, 2.7])\n\
00389 @result{} -2 3\n\
00390 @end group\n\
00391 @end example\n\
00392 @seealso{floor, round, fix}\n\
00393 @end deftypefn")
00394 {
00395 octave_value retval;
00396 if (args.length () == 1)
00397 retval = args(0).ceil ();
00398 else
00399 print_usage ();
00400
00401 return retval;
00402 }
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421 DEFUN (conj, args, ,
00422 "-*- texinfo -*-\n\
00423 @deftypefn {Mapping Function} {} conj (@var{z})\n\
00424 Return the complex conjugate of @var{z}, defined as\n\
00425 @tex\n\
00426 $\\bar{z} = x - iy$.\n\
00427 @end tex\n\
00428 @ifnottex\n\
00429 @code{conj (@var{z})} = @var{x} - @var{i}@var{y}.\n\
00430 @end ifnottex\n\
00431 @seealso{real, imag}\n\
00432 @end deftypefn")
00433 {
00434 octave_value retval;
00435 if (args.length () == 1)
00436 retval = args(0).conj ();
00437 else
00438 print_usage ();
00439
00440 return retval;
00441 }
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460 DEFUN (cos, args, ,
00461 "-*- texinfo -*-\n\
00462 @deftypefn {Mapping Function} {} cos (@var{x})\n\
00463 Compute the cosine for each element of @var{x} in radians.\n\
00464 @seealso{acos, cosd, cosh}\n\
00465 @end deftypefn")
00466 {
00467 octave_value retval;
00468 if (args.length () == 1)
00469 retval = args(0).cos ();
00470 else
00471 print_usage ();
00472
00473 return retval;
00474 }
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497 DEFUN (cosh, args, ,
00498 "-*- texinfo -*-\n\
00499 @deftypefn {Mapping Function} {} cosh (@var{x})\n\
00500 Compute the hyperbolic cosine for each element of @var{x}.\n\
00501 @seealso{acosh, sinh, tanh}\n\
00502 @end deftypefn")
00503 {
00504 octave_value retval;
00505 if (args.length () == 1)
00506 retval = args(0).cosh ();
00507 else
00508 print_usage ();
00509
00510 return retval;
00511 }
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528 DEFUN (erf, args, ,
00529 "-*- texinfo -*-\n\
00530 @deftypefn {Mapping Function} {} erf (@var{z})\n\
00531 Compute the error function,\n\
00532 @tex\n\
00533 $$\n\
00534 {\\rm erf} (z) = {2 \\over \\sqrt{\\pi}}\\int_0^z e^{-t^2} dt\n\
00535 $$\n\
00536 @end tex\n\
00537 @ifnottex\n\
00538 \n\
00539 @example\n\
00540 @group\n\
00541 @c spacing appears odd here, but is correct after Makeinfo\n\
00542 z\n\
00543 /\n\
00544 erf (z) = (2/sqrt (pi)) | e^(-t^2) dt\n\
00545 /\n\
00546 t=0\n\
00547 @end group\n\
00548 @end example\n\
00549 \n\
00550 @end ifnottex\n\
00551 @seealso{erfc, erfcx, erfinv}\n\
00552 @end deftypefn")
00553 {
00554 octave_value retval;
00555 if (args.length () == 1)
00556 retval = args(0).erf ();
00557 else
00558 print_usage ();
00559
00560 return retval;
00561 }
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592 DEFUN (erfinv, args, ,
00593 "-*- texinfo -*-\n\
00594 @deftypefn {Mapping Function} {} erfinv (@var{x})\n\
00595 Compute the inverse error function, i.e., @var{y} such that\n\
00596 \n\
00597 @example\n\
00598 erf (@var{y}) == @var{x}\n\
00599 @end example\n\
00600 @seealso{erf, erfc, erfcx}\n\
00601 @end deftypefn")
00602 {
00603 octave_value retval;
00604 if (args.length () == 1)
00605 retval = args(0).erfinv ();
00606 else
00607 print_usage ();
00608
00609 return retval;
00610 }
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630 DEFUN (erfc, args, ,
00631 "-*- texinfo -*-\n\
00632 @deftypefn {Mapping Function} {} erfc (@var{z})\n\
00633 Compute the complementary error function,\n\
00634 @tex\n\
00635 $1 - {\\rm erf} (z)$.\n\
00636 @end tex\n\
00637 @ifnottex\n\
00638 @w{@code{1 - erf (@var{z})}}.\n\
00639 @end ifnottex\n\
00640 @seealso{erfcx, erf, erfinv}\n\
00641 @end deftypefn")
00642 {
00643 octave_value retval;
00644 if (args.length () == 1)
00645 retval = args(0).erfc ();
00646 else
00647 print_usage ();
00648
00649 return retval;
00650 }
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661 DEFUN (erfcx, args, ,
00662 "-*- texinfo -*-\n\
00663 @deftypefn {Mapping Function} {} erfcx (@var{z})\n\
00664 Compute the scaled complementary error function,\n\
00665 @tex\n\
00666 $$\n\
00667 e^{z^2} {\\rm erfc} (z) \\equiv e^{z^2} (1 - {\\rm erf} (z))\n\
00668 $$\n\
00669 @end tex\n\
00670 @ifnottex\n\
00671 \n\
00672 @example\n\
00673 exp (z^2) * erfc (x)\n\
00674 @end example\n\
00675 \n\
00676 @end ifnottex\n\
00677 @seealso{erfc, erf, erfinv}\n\
00678 @end deftypefn")
00679 {
00680 octave_value retval;
00681 if (args.length () == 1)
00682 retval = args(0).erfcx ();
00683 else
00684 print_usage ();
00685
00686 return retval;
00687 }
00688
00689
00690
00691
00692
00693
00694
00695
00696 DEFUN (exp, args, ,
00697 "-*- texinfo -*-\n\
00698 @deftypefn {Mapping Function} {} exp (@var{x})\n\
00699 Compute\n\
00700 @tex\n\
00701 $e^{x}$\n\
00702 @end tex\n\
00703 @ifnottex\n\
00704 @code{e^x}\n\
00705 @end ifnottex\n\
00706 for each element of @var{x}. To compute the matrix\n\
00707 exponential, see @ref{Linear Algebra}.\n\
00708 @seealso{log}\n\
00709 @end deftypefn")
00710 {
00711 octave_value retval;
00712 if (args.length () == 1)
00713 retval = args(0).exp ();
00714 else
00715 print_usage ();
00716
00717 return retval;
00718 }
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733 DEFUN (expm1, args, ,
00734 "-*- texinfo -*-\n\
00735 @deftypefn {Mapping Function} {} expm1 (@var{x})\n\
00736 Compute\n\
00737 @tex\n\
00738 $ e^{x} - 1 $\n\
00739 @end tex\n\
00740 @ifnottex\n\
00741 @code{exp (@var{x}) - 1}\n\
00742 @end ifnottex\n\
00743 accurately in the neighborhood of zero.\n\
00744 @seealso{exp}\n\
00745 @end deftypefn")
00746 {
00747 octave_value retval;
00748 if (args.length () == 1)
00749 retval = args(0).expm1 ();
00750 else
00751 print_usage ();
00752
00753 return retval;
00754 }
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766 DEFUN (isfinite, args, ,
00767 "-*- texinfo -*-\n\
00768 @deftypefn {Mapping Function} {} isfinite (@var{x})\n\
00769 @deftypefnx {Mapping Function} {} finite (@var{x})\n\
00770 Return a logical array which is true where the elements of @var{x} are\n\
00771 finite values and false where they are not.\n\
00772 For example:\n\
00773 \n\
00774 @example\n\
00775 @group\n\
00776 finite ([13, Inf, NA, NaN])\n\
00777 @result{} [ 1, 0, 0, 0 ]\n\
00778 @end group\n\
00779 @end example\n\
00780 @seealso{isinf, isnan, isna}\n\
00781 @end deftypefn")
00782 {
00783 octave_value retval;
00784 if (args.length () == 1)
00785 retval = args(0).finite ();
00786 else
00787 print_usage ();
00788
00789 return retval;
00790 }
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805 DEFUN (fix, args, ,
00806 "-*- texinfo -*-\n\
00807 @deftypefn {Mapping Function} {} fix (@var{x})\n\
00808 Truncate fractional portion of @var{x} and return the integer portion. This\n\
00809 is equivalent to rounding towards zero. If @var{x} is complex, return\n\
00810 @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\
00811 \n\
00812 @example\n\
00813 @group\n\
00814 fix ([-2.7, 2.7])\n\
00815 @result{} -2 2\n\
00816 @end group\n\
00817 @end example\n\
00818 @seealso{ceil, floor, round}\n\
00819 @end deftypefn")
00820 {
00821 octave_value retval;
00822 if (args.length () == 1)
00823 retval = args(0).fix ();
00824 else
00825 print_usage ();
00826
00827 return retval;
00828 }
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840 DEFUN (floor, args, ,
00841 "-*- texinfo -*-\n\
00842 @deftypefn {Mapping Function} {} floor (@var{x})\n\
00843 Return the largest integer not greater than @var{x}. This is equivalent to\n\
00844 rounding towards negative infinity. If @var{x} is\n\
00845 complex, return @code{floor (real (@var{x})) + floor (imag (@var{x})) * I}.\n\
00846 \n\
00847 @example\n\
00848 @group\n\
00849 floor ([-2.7, 2.7])\n\
00850 @result{} -3 2\n\
00851 @end group\n\
00852 @end example\n\
00853 @seealso{ceil, round, fix}\n\
00854 @end deftypefn")
00855 {
00856 octave_value retval;
00857 if (args.length () == 1)
00858 retval = args(0).floor ();
00859 else
00860 print_usage ();
00861
00862 return retval;
00863 }
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875 DEFUN (gamma, args, ,
00876 "-*- texinfo -*-\n\
00877 @deftypefn {Mapping Function} {} gamma (@var{z})\n\
00878 Compute the Gamma function,\n\
00879 @tex\n\
00880 $$\n\
00881 \\Gamma (z) = \\int_0^\\infty t^{z-1} e^{-t} dt.\n\
00882 $$\n\
00883 @end tex\n\
00884 @ifnottex\n\
00885 \n\
00886 @example\n\
00887 @group\n\
00888 @c spacing appears odd here, but is correct after Makeinfo\n\
00889 infinity\n\
00890 /\n\
00891 gamma (z) = | t^(z-1) exp (-t) dt.\n\
00892 /\n\
00893 t=0\n\
00894 @end group\n\
00895 @end example\n\
00896 \n\
00897 @end ifnottex\n\
00898 @seealso{gammainc, lgamma}\n\
00899 @end deftypefn")
00900 {
00901 octave_value retval;
00902 if (args.length () == 1)
00903 retval = args(0).gamma ();
00904 else
00905 print_usage ();
00906
00907 return retval;
00908 }
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939 DEFUN (imag, args, ,
00940 "-*- texinfo -*-\n\
00941 @deftypefn {Mapping Function} {} imag (@var{z})\n\
00942 Return the imaginary part of @var{z} as a real number.\n\
00943 @seealso{real, conj}\n\
00944 @end deftypefn")
00945 {
00946 octave_value retval;
00947 if (args.length () == 1)
00948 retval = args(0).imag ();
00949 else
00950 print_usage ();
00951
00952 return retval;
00953 }
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970 DEFUNX ("isalnum", Fisalnum, args, ,
00971 "-*- texinfo -*-\n\
00972 @deftypefn {Mapping Function} {} isalnum (@var{s})\n\
00973 Return a logical array which is true where the elements of @var{s} are\n\
00974 letters or digits and false where they are not. This is equivalent to\n\
00975 (@code{isalpha (@var{s}) | isdigit (@var{s})}).\n\
00976 @seealso{isalpha, isdigit, ispunct, isspace, iscntrl}\n\
00977 @end deftypefn")
00978 {
00979 octave_value retval;
00980 if (args.length () == 1)
00981 retval = args(0).xisalnum ();
00982 else
00983 print_usage ();
00984
00985 return retval;
00986 }
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001 DEFUNX ("isalpha", Fisalpha, args, ,
01002 "-*- texinfo -*-\n\
01003 @deftypefn {Mapping Function} {} isalpha (@var{s})\n\
01004 Return a logical array which is true where the elements of @var{s} are\n\
01005 letters and false where they are not. This is equivalent to\n\
01006 (@code{islower (@var{s}) | isupper (@var{s})}).\n\
01007 @seealso{isdigit, ispunct, isspace, iscntrl, isalnum, islower, isupper}\n\
01008 @end deftypefn")
01009 {
01010 octave_value retval;
01011 if (args.length () == 1)
01012 retval = args(0).xisalpha ();
01013 else
01014 print_usage ();
01015
01016 return retval;
01017 }
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031 DEFUNX ("isascii", Fisascii, args, ,
01032 "-*- texinfo -*-\n\
01033 @deftypefn {Mapping Function} {} isascii (@var{s})\n\
01034 Return a logical array which is true where the elements of @var{s} are\n\
01035 ASCII characters (in the range 0 to 127 decimal) and false where they are\n\
01036 not.\n\
01037 @end deftypefn")
01038 {
01039 octave_value retval;
01040 if (args.length () == 1)
01041 retval = args(0).xisascii ();
01042 else
01043 print_usage ();
01044
01045 return retval;
01046 }
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058 DEFUNX ("iscntrl", Fiscntrl, args, ,
01059 "-*- texinfo -*-\n\
01060 @deftypefn {Mapping Function} {} iscntrl (@var{s})\n\
01061 Return a logical array which is true where the elements of @var{s} are\n\
01062 control characters and false where they are not.\n\
01063 @seealso{ispunct, isspace, isalpha, isdigit}\n\
01064 @end deftypefn")
01065 {
01066 octave_value retval;
01067 if (args.length () == 1)
01068 retval = args(0).xiscntrl ();
01069 else
01070 print_usage ();
01071
01072 return retval;
01073 }
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087 DEFUNX ("isdigit", Fisdigit, args, ,
01088 "-*- texinfo -*-\n\
01089 @deftypefn {Mapping Function} {} isdigit (@var{s})\n\
01090 Return a logical array which is true where the elements of @var{s} are\n\
01091 decimal digits (0-9) and false where they are not.\n\
01092 @seealso{isxdigit, isalpha, isletter, ispunct, isspace, iscntrl}\n\
01093 @end deftypefn")
01094 {
01095 octave_value retval;
01096 if (args.length () == 1)
01097 retval = args(0).xisdigit ();
01098 else
01099 print_usage ();
01100
01101 return retval;
01102 }
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114
01115 DEFUN (isinf, args, ,
01116 "-*- texinfo -*-\n\
01117 @deftypefn {Mapping Function} {} isinf (@var{x})\n\
01118 Return a logical array which is true where the elements of @var{x} are\n\
01119 are infinite and false where they are not.\n\
01120 For example:\n\
01121 \n\
01122 @example\n\
01123 @group\n\
01124 isinf ([13, Inf, NA, NaN])\n\
01125 @result{} [ 0, 1, 0, 0 ]\n\
01126 @end group\n\
01127 @end example\n\
01128 @seealso{isfinite, isnan, isna}\n\
01129 @end deftypefn")
01130 {
01131 octave_value retval;
01132 if (args.length () == 1)
01133 retval = args(0).isinf ();
01134 else
01135 print_usage ();
01136
01137 return retval;
01138 }
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150
01151
01152
01153
01154
01155
01156
01157 DEFUNX ("isgraph", Fisgraph, args, ,
01158 "-*- texinfo -*-\n\
01159 @deftypefn {Mapping Function} {} isgraph (@var{s})\n\
01160 Return a logical array which is true where the elements of @var{s} are\n\
01161 printable characters (but not the space character) and false where they are\n\
01162 not.\n\
01163 @seealso{isprint}\n\
01164 @end deftypefn")
01165 {
01166 octave_value retval;
01167 if (args.length () == 1)
01168 retval = args(0).xisgraph ();
01169 else
01170 print_usage ();
01171
01172 return retval;
01173 }
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186 DEFUNX ("islower", Fislower, args, ,
01187 "-*- texinfo -*-\n\
01188 @deftypefn {Mapping Function} {} islower (@var{s})\n\
01189 Return a logical array which is true where the elements of @var{s} are\n\
01190 lowercase letters and false where they are not.\n\
01191 @seealso{isupper, isalpha, isletter, isalnum}\n\
01192 @end deftypefn")
01193 {
01194 octave_value retval;
01195 if (args.length () == 1)
01196 retval = args(0).xislower ();
01197 else
01198 print_usage ();
01199
01200 return retval;
01201 }
01202
01203
01204
01205
01206
01207
01208
01209
01210
01211
01212
01213
01214 DEFUN (isna, args, ,
01215 "-*- texinfo -*-\n\
01216 @deftypefn {Mapping Function} {} isna (@var{x})\n\
01217 Return a logical array which is true where the elements of @var{x} are\n\
01218 NA (missing) values and false where they are not.\n\
01219 For example:\n\
01220 \n\
01221 @example\n\
01222 @group\n\
01223 isna ([13, Inf, NA, NaN])\n\
01224 @result{} [ 0, 0, 1, 0 ]\n\
01225 @end group\n\
01226 @end example\n\
01227 @seealso{isnan, isinf, isfinite}\n\
01228 @end deftypefn")
01229 {
01230 octave_value retval;
01231 if (args.length () == 1)
01232 retval = args(0).isna ();
01233 else
01234 print_usage ();
01235
01236 return retval;
01237 }
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256 DEFUN (isnan, args, ,
01257 "-*- texinfo -*-\n\
01258 @deftypefn {Mapping Function} {} isnan (@var{x})\n\
01259 Return a logical array which is true where the elements of @var{x} are\n\
01260 NaN values and false where they are not.\n\
01261 NA values are also considered NaN values. For example:\n\
01262 \n\
01263 @example\n\
01264 @group\n\
01265 isnan ([13, Inf, NA, NaN])\n\
01266 @result{} [ 0, 0, 1, 1 ]\n\
01267 @end group\n\
01268 @end example\n\
01269 @seealso{isna, isinf, isfinite}\n\
01270 @end deftypefn")
01271 {
01272 octave_value retval;
01273 if (args.length () == 1)
01274 retval = args(0).isnan ();
01275 else
01276 print_usage ();
01277
01278 return retval;
01279 }
01280
01281
01282
01283
01284
01285
01286
01287
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298 DEFUNX ("isprint", Fisprint, args, ,
01299 "-*- texinfo -*-\n\
01300 @deftypefn {Mapping Function} {} isprint (@var{s})\n\
01301 Return a logical array which is true where the elements of @var{s} are\n\
01302 printable characters (including the space character) and false where they\n\
01303 are not.\n\
01304 @seealso{isgraph}\n\
01305 @end deftypefn")
01306 {
01307 octave_value retval;
01308 if (args.length () == 1)
01309 retval = args(0).xisprint ();
01310 else
01311 print_usage ();
01312
01313 return retval;
01314 }
01315
01316
01317
01318
01319
01320
01321
01322
01323
01324
01325
01326
01327 DEFUNX ("ispunct", Fispunct, args, ,
01328 "-*- texinfo -*-\n\
01329 @deftypefn {Mapping Function} {} ispunct (@var{s})\n\
01330 Return a logical array which is true where the elements of @var{s} are\n\
01331 punctuation characters and false where they are not.\n\
01332 @seealso{isalpha, isdigit, isspace, iscntrl}\n\
01333 @end deftypefn")
01334 {
01335 octave_value retval;
01336 if (args.length () == 1)
01337 retval = args(0).xispunct ();
01338 else
01339 print_usage ();
01340
01341 return retval;
01342 }
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358 DEFUNX ("isspace", Fisspace, args, ,
01359 "-*- texinfo -*-\n\
01360 @deftypefn {Mapping Function} {} isspace (@var{s})\n\
01361 Return a logical array which is true where the elements of @var{s} are\n\
01362 whitespace characters (space, formfeed, newline, carriage return, tab, and\n\
01363 vertical tab) and false where they are not.\n\
01364 @seealso{iscntrl, ispunct, isalpha, isdigit}\n\
01365 @end deftypefn")
01366 {
01367 octave_value retval;
01368 if (args.length () == 1)
01369 retval = args(0).xisspace ();
01370 else
01371 print_usage ();
01372
01373 return retval;
01374 }
01375
01376
01377
01378
01379
01380
01381
01382
01383
01384
01385
01386
01387 DEFUNX ("isupper", Fisupper, args, ,
01388 "-*- texinfo -*-\n\
01389 @deftypefn {Mapping Function} {} isupper (@var{s})\n\
01390 Return a logical array which is true where the elements of @var{s} are\n\
01391 uppercase letters and false where they are not.\n\
01392 @seealso{islower, isalpha, isletter, isalnum}\n\
01393 @end deftypefn")
01394 {
01395 octave_value retval;
01396 if (args.length () == 1)
01397 retval = args(0).xisupper ();
01398 else
01399 print_usage ();
01400
01401 return retval;
01402 }
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415 DEFUNX ("isxdigit", Fisxdigit, args, ,
01416 "-*- texinfo -*-\n\
01417 @deftypefn {Mapping Function} {} isxdigit (@var{s})\n\
01418 Return a logical array which is true where the elements of @var{s} are\n\
01419 hexadecimal digits (0-9 and @nospell{a-fA-F}).\n\
01420 @seealso{isdigit}\n\
01421 @end deftypefn")
01422 {
01423 octave_value retval;
01424 if (args.length () == 1)
01425 retval = args(0).xisxdigit ();
01426 else
01427 print_usage ();
01428
01429 return retval;
01430 }
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445 DEFUN (lgamma, args, ,
01446 "-*- texinfo -*-\n\
01447 @deftypefn {Mapping Function} {} lgamma (@var{x})\n\
01448 @deftypefnx {Mapping Function} {} gammaln (@var{x})\n\
01449 Return the natural logarithm of the gamma function of @var{x}.\n\
01450 @seealso{gamma, gammainc}\n\
01451 @end deftypefn")
01452 {
01453 octave_value retval;
01454 if (args.length () == 1)
01455 retval = args(0).lgamma ();
01456 else
01457 print_usage ();
01458
01459 return retval;
01460 }
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491 DEFUN (log, args, ,
01492 "-*- texinfo -*-\n\
01493 @deftypefn {Mapping Function} {} log (@var{x})\n\
01494 Compute the natural logarithm,\n\
01495 @tex\n\
01496 $\\ln{(x)},$\n\
01497 @end tex\n\
01498 @ifnottex\n\
01499 @code{ln (@var{x})},\n\
01500 @end ifnottex\n\
01501 for each element of @var{x}. To compute the\n\
01502 matrix logarithm, see @ref{Linear Algebra}.\n\
01503 @seealso{exp, log1p, log2, log10, logspace}\n\
01504 @end deftypefn")
01505 {
01506 octave_value retval;
01507 if (args.length () == 1)
01508 retval = args(0).log ();
01509 else
01510 print_usage ();
01511
01512 return retval;
01513 }
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526 DEFUN (log10, args, ,
01527 "-*- texinfo -*-\n\
01528 @deftypefn {Mapping Function} {} log10 (@var{x})\n\
01529 Compute the base-10 logarithm of each element of @var{x}.\n\
01530 @seealso{log, log2, logspace, exp}\n\
01531 @end deftypefn")
01532 {
01533 octave_value retval;
01534 if (args.length () == 1)
01535 retval = args(0).log10 ();
01536 else
01537 print_usage ();
01538
01539 return retval;
01540 }
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550 DEFUN (log1p, args, ,
01551 "-*- texinfo -*-\n\
01552 @deftypefn {Mapping Function} {} log1p (@var{x})\n\
01553 Compute\n\
01554 @tex\n\
01555 $\\ln{(1 + x)}$\n\
01556 @end tex\n\
01557 @ifnottex\n\
01558 @code{log (1 + @var{x})}\n\
01559 @end ifnottex\n\
01560 accurately in the neighborhood of zero.\n\
01561 @seealso{log, exp, expm1}\n\
01562 @end deftypefn")
01563 {
01564 octave_value retval;
01565 if (args.length () == 1)
01566 retval = args(0).log1p ();
01567 else
01568 print_usage ();
01569
01570 return retval;
01571 }
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581 DEFUN (real, args, ,
01582 "-*- texinfo -*-\n\
01583 @deftypefn {Mapping Function} {} real (@var{z})\n\
01584 Return the real part of @var{z}.\n\
01585 @seealso{imag, conj}\n\
01586 @end deftypefn")
01587 {
01588 octave_value retval;
01589 if (args.length () == 1)
01590 retval = args(0).real ();
01591 else
01592 print_usage ();
01593
01594 return retval;
01595 }
01596
01597
01598
01599
01600
01601
01602
01603
01604
01605
01606
01607
01608
01609
01610
01611
01612 DEFUN (round, args, ,
01613 "-*- texinfo -*-\n\
01614 @deftypefn {Mapping Function} {} round (@var{x})\n\
01615 Return the integer nearest to @var{x}. If @var{x} is complex, return\n\
01616 @code{round (real (@var{x})) + round (imag (@var{x})) * I}. If there\n\
01617 are two nearest integers, return the one further away from zero.\n\
01618 \n\
01619 @example\n\
01620 @group\n\
01621 round ([-2.7, 2.7])\n\
01622 @result{} -3 3\n\
01623 @end group\n\
01624 @end example\n\
01625 @seealso{ceil, floor, fix, roundb}\n\
01626 @end deftypefn")
01627 {
01628 octave_value retval;
01629 if (args.length () == 1)
01630 retval = args(0).round ();
01631 else
01632 print_usage ();
01633
01634 return retval;
01635 }
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658 DEFUN (roundb, args, ,
01659 "-*- texinfo -*-\n\
01660 @deftypefn {Mapping Function} {} roundb (@var{x})\n\
01661 Return the integer nearest to @var{x}. If there are two nearest\n\
01662 integers, return the even one (banker's rounding). If @var{x} is complex,\n\
01663 return @code{roundb (real (@var{x})) + roundb (imag (@var{x})) * I}.\n\
01664 @seealso{round}\n\
01665 @end deftypefn")
01666 {
01667 octave_value retval;
01668 if (args.length () == 1)
01669 retval = args(0).roundb ();
01670 else
01671 print_usage ();
01672
01673 return retval;
01674 }
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699 DEFUN (sign, args, ,
01700 "-*- texinfo -*-\n\
01701 @deftypefn {Mapping Function} {} sign (@var{x})\n\
01702 Compute the @dfn{signum} function, which is defined as\n\
01703 @tex\n\
01704 $$\n\
01705 {\\rm sign} (@var{x}) = \\cases{1,&$x>0$;\\cr 0,&$x=0$;\\cr -1,&$x<0$.\\cr}\n\
01706 $$\n\
01707 @end tex\n\
01708 @ifnottex\n\
01709 \n\
01710 @example\n\
01711 @group\n\
01712 -1, x < 0;\n\
01713 sign (x) = 0, x = 0;\n\
01714 1, x > 0.\n\
01715 @end group\n\
01716 @end example\n\
01717 \n\
01718 @end ifnottex\n\
01719 \n\
01720 For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\
01721 @end deftypefn")
01722 {
01723 octave_value retval;
01724 if (args.length () == 1)
01725 retval = args(0).signum ();
01726 else
01727 print_usage ();
01728
01729 return retval;
01730 }
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747 DEFUN (sin, args, ,
01748 "-*- texinfo -*-\n\
01749 @deftypefn {Mapping Function} {} sin (@var{x})\n\
01750 Compute the sine for each element of @var{x} in radians.\n\
01751 @seealso{asin, sind, sinh}\n\
01752 @end deftypefn")
01753 {
01754 octave_value retval;
01755 if (args.length () == 1)
01756 retval = args(0).sin ();
01757 else
01758 print_usage ();
01759
01760 return retval;
01761 }
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782 DEFUN (sinh, args, ,
01783 "-*- texinfo -*-\n\
01784 @deftypefn {Mapping Function} {} sinh (@var{x})\n\
01785 Compute the hyperbolic sine for each element of @var{x}.\n\
01786 @seealso{asinh, cosh, tanh}\n\
01787 @end deftypefn")
01788 {
01789 octave_value retval;
01790 if (args.length () == 1)
01791 retval = args(0).sinh ();
01792 else
01793 print_usage ();
01794
01795 return retval;
01796 }
01797
01798
01799
01800
01801
01802
01803
01804
01805
01806
01807
01808
01809
01810
01811
01812
01813 DEFUN (sqrt, args, ,
01814 "-*- texinfo -*-\n\
01815 @deftypefn {Mapping Function} {} sqrt (@var{x})\n\
01816 Compute the square root of each element of @var{x}. If @var{x} is negative,\n\
01817 a complex result is returned. To compute the matrix square root, see\n\
01818 @ref{Linear Algebra}.\n\
01819 @seealso{realsqrt, nthroot}\n\
01820 @end deftypefn")
01821 {
01822 octave_value retval;
01823 if (args.length () == 1)
01824 retval = args(0).sqrt ();
01825 else
01826 print_usage ();
01827
01828 return retval;
01829 }
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841
01842
01843
01844
01845
01846 DEFUN (tan, args, ,
01847 "-*- texinfo -*-\n\
01848 @deftypefn {Mapping Function} {} tan (@var{z})\n\
01849 Compute the tangent for each element of @var{x} in radians.\n\
01850 @seealso{atan, tand, tanh}\n\
01851 @end deftypefn")
01852 {
01853 octave_value retval;
01854 if (args.length () == 1)
01855 retval = args(0).tan ();
01856 else
01857 print_usage ();
01858
01859 return retval;
01860 }
01861
01862
01863
01864
01865
01866
01867
01868
01869
01870
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881 DEFUN (tanh, args, ,
01882 "-*- texinfo -*-\n\
01883 @deftypefn {Mapping Function} {} tanh (@var{x})\n\
01884 Compute hyperbolic tangent for each element of @var{x}.\n\
01885 @seealso{atanh, sinh, cosh}\n\
01886 @end deftypefn")
01887 {
01888 octave_value retval;
01889 if (args.length () == 1)
01890 retval = args(0).tanh ();
01891 else
01892 print_usage ();
01893
01894 return retval;
01895 }
01896
01897
01898
01899
01900
01901
01902
01903
01904
01905
01906
01907
01908
01909
01910
01911
01912 DEFUNX ("toascii", Ftoascii, args, ,
01913 "-*- texinfo -*-\n\
01914 @deftypefn {Mapping Function} {} toascii (@var{s})\n\
01915 Return ASCII representation of @var{s} in a matrix. For example:\n\
01916 \n\
01917 @example\n\
01918 @group\n\
01919 toascii (\"ASCII\")\n\
01920 @result{} [ 65, 83, 67, 73, 73 ]\n\
01921 @end group\n\
01922 \n\
01923 @end example\n\
01924 @seealso{char}\n\
01925 @end deftypefn")
01926 {
01927 octave_value retval;
01928 if (args.length () == 1)
01929 retval = args(0).xtoascii ();
01930 else
01931 print_usage ();
01932
01933 return retval;
01934 }
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948 DEFUNX ("tolower", Ftolower, args, ,
01949 "-*- texinfo -*-\n\
01950 @deftypefn {Mapping Function} {} tolower (@var{s})\n\
01951 @deftypefnx {Mapping Function} {} lower (@var{s})\n\
01952 Return a copy of the string or cell string @var{s}, with each uppercase\n\
01953 character replaced by the corresponding lowercase one; non-alphabetic\n\
01954 characters are left unchanged. For example:\n\
01955 \n\
01956 @example\n\
01957 @group\n\
01958 tolower (\"MiXeD cAsE 123\")\n\
01959 @result{} \"mixed case 123\"\n\
01960 @end group\n\
01961 @end example\n\
01962 @seealso{toupper}\n\
01963 @end deftypefn")
01964 {
01965 octave_value retval;
01966 if (args.length () == 1)
01967 retval = args(0).xtolower ();
01968 else
01969 print_usage ();
01970
01971 return retval;
01972 }
01973
01974 DEFALIAS (lower, tolower);
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986
01987
01988
01989
01990
01991
01992
01993
01994
01995
01996
01997
01998
01999 DEFUNX ("toupper", Ftoupper, args, ,
02000 "-*- texinfo -*-\n\
02001 @deftypefn {Mapping Function} {} toupper (@var{s})\n\
02002 @deftypefnx {Mapping Function} {} upper (@var{s})\n\
02003 Return a copy of the string or cell string @var{s}, with each lowercase\n\
02004 character replaced by the corresponding uppercase one; non-alphabetic\n\
02005 characters are left unchanged. For example:\n\
02006 \n\
02007 @example\n\
02008 @group\n\
02009 toupper (\"MiXeD cAsE 123\")\n\
02010 @result{} \"MIXED CASE 123\"\n\
02011 @end group\n\
02012 @end example\n\
02013 @seealso{tolower}\n\
02014 @end deftypefn")
02015 {
02016 octave_value retval;
02017 if (args.length () == 1)
02018 retval = args(0).xtoupper ();
02019 else
02020 print_usage ();
02021
02022 return retval;
02023 }
02024
02025 DEFALIAS (upper, toupper);
02026
02027
02028
02029
02030
02031
02032
02033
02034
02035
02036
02037
02038
02039
02040
02041
02042
02043
02044
02045
02046
02047
02048
02049 DEFALIAS (gammaln, lgamma);
02050
02051 DEFALIAS (finite, isfinite);