File: Special-Functions.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (1067 lines) | stat: -rw-r--r-- 41,956 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Special Functions (GNU Octave (version 6.2.0))</title>

<meta name="description" content="Special Functions (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Special Functions (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Arithmetic.html" rel="up" title="Arithmetic">
<link href="Rational-Approximations.html" rel="next" title="Rational Approximations">
<link href="Utility-Functions.html" rel="prev" title="Utility Functions">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<span id="Special-Functions"></span><div class="header">
<p>
Next: <a href="Rational-Approximations.html" accesskey="n" rel="next">Rational Approximations</a>, Previous: <a href="Utility-Functions.html" accesskey="p" rel="prev">Utility Functions</a>, Up: <a href="Arithmetic.html" accesskey="u" rel="up">Arithmetic</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Special-Functions-1"></span><h3 class="section">17.6 Special Functions</h3>

<span id="XREFairy"></span><dl>
<dt id="index-airy">: <em>[<var>a</var>, <var>ierr</var>] =</em> <strong>airy</strong> <em>(<var>k</var>, <var>z</var>, <var>opt</var>)</em></dt>
<dd><p>Compute Airy functions of the first and second kind, and their derivatives.
</p>
<div class="example">
<pre class="example"> K   Function   Scale factor (if &quot;opt&quot; is supplied)
---  --------   ---------------------------------------
 0   Ai (Z)     exp ((2/3) * Z * sqrt (Z))
 1   dAi(Z)/dZ  exp ((2/3) * Z * sqrt (Z))
 2   Bi (Z)     exp (-abs (real ((2/3) * Z * sqrt (Z))))
 3   dBi(Z)/dZ  exp (-abs (real ((2/3) * Z * sqrt (Z))))
</pre></div>

<p>The function call <code>airy (<var>z</var>)</code> is equivalent to
<code>airy (0, <var>z</var>)</code>.
</p>
<p>The result is the same size as <var>z</var>.
</p>
<p>If requested, <var>ierr</var> contains the following status information and
is the same size as the result.
</p>
<ol start="0">
<li> Normal return.

</li><li> Input error, return <code>NaN</code>.

</li><li> Overflow, return <code>Inf</code>.

</li><li> Loss of significance by argument reduction results in less than half
 of machine accuracy.

</li><li> Loss of significance by argument reduction, output may be inaccurate.

</li><li> Error&mdash;no computation, algorithm termination condition not met,
return <code>NaN</code>.
</li></ol>
</dd></dl>


<span id="XREFbesselj"></span><dl>
<dt id="index-besselj">: <em><var>J</var> =</em> <strong>besselj</strong> <em>(<var>alpha</var>, <var>x</var>)</em></dt>
<dt id="index-besselj-1">: <em><var>J</var> =</em> <strong>besselj</strong> <em>(<var>alpha</var>, <var>x</var>, <var>opt</var>)</em></dt>
<dt id="index-besselj-2">: <em>[<var>J</var>, <var>ierr</var>] =</em> <strong>besselj</strong> <em>(&hellip;)</em></dt>
<dd><p>Compute Bessel functions of the first kind.
</p>
<p>The order of the Bessel function <var>alpha</var> must be real.  The points for
evaluation <var>x</var> may be complex.
</p>
<p>If the optional argument <var>opt</var> is 1 or true, the result <var>J</var> is
multiplied by <code>exp&nbsp;<span class="nolinebreak">(-abs</span>&nbsp;(imag&nbsp;(<var>x</var>)))</code><!-- /@w -->.
</p>
<p>If <var>alpha</var> is a scalar, the result is the same size as <var>x</var>.  If <var>x</var>
is a scalar, the result is the same size as <var>alpha</var>.  If <var>alpha</var> is a
row vector and <var>x</var> is a column vector, the result is a matrix with
<code>length (<var>x</var>)</code> rows and <code>length (<var>alpha</var>)</code> columns.
Otherwise, <var>alpha</var> and <var>x</var> must conform and the result will be the same
size.
</p>
<p>If requested, <var>ierr</var> contains the following status information and is the
same size as the result.
</p>
<ol start="0">
<li> Normal return.

</li><li> Input error, return <code>NaN</code>.

</li><li> Overflow, return <code>Inf</code>.

</li><li> Loss of significance by argument reduction results in less than half of machine
accuracy.

</li><li> Loss of significance by argument reduction, output may be inaccurate.

</li><li> Error&mdash;no computation, algorithm termination condition not met, return
<code>NaN</code>.
</li></ol>


<p><strong>See also:</strong> <a href="#XREFbessely">bessely</a>, <a href="#XREFbesseli">besseli</a>, <a href="#XREFbesselk">besselk</a>, <a href="#XREFbesselh">besselh</a>.
</p></dd></dl>


<span id="XREFbessely"></span><dl>
<dt id="index-bessely">: <em><var>Y</var> =</em> <strong>bessely</strong> <em>(<var>alpha</var>, <var>x</var>)</em></dt>
<dt id="index-bessely-1">: <em><var>Y</var> =</em> <strong>bessely</strong> <em>(<var>alpha</var>, <var>x</var>, <var>opt</var>)</em></dt>
<dt id="index-bessely-2">: <em>[<var>Y</var>, <var>ierr</var>] =</em> <strong>bessely</strong> <em>(&hellip;)</em></dt>
<dd><p>Compute Bessel functions of the second kind.
</p>
<p>The order of the Bessel function <var>alpha</var> must be real.  The points for
evaluation <var>x</var> may be complex.
</p>
<p>If the optional argument <var>opt</var> is 1 or true, the result <var>Y</var> is
multiplied by <code>exp&nbsp;<span class="nolinebreak">(-abs</span>&nbsp;(imag&nbsp;(<var>x</var>)))</code><!-- /@w -->.
</p>
<p>If <var>alpha</var> is a scalar, the result is the same size as <var>x</var>.  If <var>x</var>
is a scalar, the result is the same size as <var>alpha</var>.  If <var>alpha</var> is a
row vector and <var>x</var> is a column vector, the result is a matrix with
<code>length (<var>x</var>)</code> rows and <code>length (<var>alpha</var>)</code> columns.
Otherwise, <var>alpha</var> and <var>x</var> must conform and the result will be the same
size.
</p>
<p>If requested, <var>ierr</var> contains the following status information and is the
same size as the result.
</p>
<ol start="0">
<li> Normal return.

</li><li> Input error, return <code>NaN</code>.

</li><li> Overflow, return <code>Inf</code>.

</li><li> Loss of significance by argument reduction results in less than half of machine
accuracy.

</li><li> Complete loss of significance by argument reduction, return <code>NaN</code>.

</li><li> Error&mdash;no computation, algorithm termination condition not met, return
<code>NaN</code>.
</li></ol>


<p><strong>See also:</strong> <a href="#XREFbesselj">besselj</a>, <a href="#XREFbesseli">besseli</a>, <a href="#XREFbesselk">besselk</a>, <a href="#XREFbesselh">besselh</a>.
</p></dd></dl>


<span id="XREFbesseli"></span><dl>
<dt id="index-besseli">: <em><var>I</var> =</em> <strong>besseli</strong> <em>(<var>alpha</var>, <var>x</var>)</em></dt>
<dt id="index-besseli-1">: <em><var>I</var> =</em> <strong>besseli</strong> <em>(<var>alpha</var>, <var>x</var>, <var>opt</var>)</em></dt>
<dt id="index-besseli-2">: <em>[<var>I</var>, <var>ierr</var>] =</em> <strong>besseli</strong> <em>(&hellip;)</em></dt>
<dd><p>Compute modified Bessel functions of the first kind.
</p>
<p>The order of the Bessel function <var>alpha</var> must be real.  The points for
evaluation <var>x</var> may be complex.
</p>
<p>If the optional argument <var>opt</var> is 1 or true, the result <var>I</var> is
multiplied by <code>exp&nbsp;<span class="nolinebreak">(-abs</span>&nbsp;(real&nbsp;(<var>x</var>)))</code><!-- /@w -->.
</p>
<p>If <var>alpha</var> is a scalar, the result is the same size as <var>x</var>.  If <var>x</var>
is a scalar, the result is the same size as <var>alpha</var>.  If <var>alpha</var> is a
row vector and <var>x</var> is a column vector, the result is a matrix with
<code>length (<var>x</var>)</code> rows and <code>length (<var>alpha</var>)</code> columns.
Otherwise, <var>alpha</var> and <var>x</var> must conform and the result will be the same
size.
</p>
<p>If requested, <var>ierr</var> contains the following status information and is the
same size as the result.
</p>
<ol start="0">
<li> Normal return.

</li><li> Input error, return <code>NaN</code>.

</li><li> Overflow, return <code>Inf</code>.

</li><li> Loss of significance by argument reduction results in less than half of machine
accuracy.

</li><li> Complete loss of significance by argument reduction, return <code>NaN</code>.

</li><li> Error&mdash;no computation, algorithm termination condition not met, return
<code>NaN</code>.
</li></ol>


<p><strong>See also:</strong> <a href="#XREFbesselk">besselk</a>, <a href="#XREFbesselj">besselj</a>, <a href="#XREFbessely">bessely</a>, <a href="#XREFbesselh">besselh</a>.
</p></dd></dl>


<span id="XREFbesselk"></span><dl>
<dt id="index-besselk">: <em><var>K</var> =</em> <strong>besselk</strong> <em>(<var>alpha</var>, <var>x</var>)</em></dt>
<dt id="index-besselk-1">: <em><var>K</var> =</em> <strong>besselk</strong> <em>(<var>alpha</var>, <var>x</var>, <var>opt</var>)</em></dt>
<dt id="index-besselk-2">: <em>[<var>K</var>, <var>ierr</var>] =</em> <strong>besselk</strong> <em>(&hellip;)</em></dt>
<dd>
<p>Compute modified Bessel functions of the second kind.
</p>
<p>The order of the Bessel function <var>alpha</var> must be real.  The points for
evaluation <var>x</var> may be complex.
</p>
<p>If the optional argument <var>opt</var> is 1 or true, the result <var>K</var> is
multiplied by <code>exp&nbsp;(<var>x</var>)</code><!-- /@w -->.
</p>
<p>If <var>alpha</var> is a scalar, the result is the same size as <var>x</var>.  If <var>x</var>
is a scalar, the result is the same size as <var>alpha</var>.  If <var>alpha</var> is a
row vector and <var>x</var> is a column vector, the result is a matrix with
<code>length (<var>x</var>)</code> rows and <code>length (<var>alpha</var>)</code> columns.
Otherwise, <var>alpha</var> and <var>x</var> must conform and the result will be the same
size.
</p>
<p>If requested, <var>ierr</var> contains the following status information and is the
same size as the result.
</p>
<ol start="0">
<li> Normal return.

</li><li> Input error, return <code>NaN</code>.

</li><li> Overflow, return <code>Inf</code>.

</li><li> Loss of significance by argument reduction results in less than half of machine
accuracy.

</li><li> Complete loss of significance by argument reduction, return <code>NaN</code>.

</li><li> Error&mdash;no computation, algorithm termination condition not met, return
<code>NaN</code>.
</li></ol>


<p><strong>See also:</strong> <a href="#XREFbesseli">besseli</a>, <a href="#XREFbesselj">besselj</a>, <a href="#XREFbessely">bessely</a>, <a href="#XREFbesselh">besselh</a>.
</p></dd></dl>


<span id="XREFbesselh"></span><dl>
<dt id="index-besselh">: <em><var>H</var> =</em> <strong>besselh</strong> <em>(<var>alpha</var>, <var>x</var>)</em></dt>
<dt id="index-besselh-1">: <em><var>H</var> =</em> <strong>besselh</strong> <em>(<var>alpha</var>, <var>k</var>, <var>x</var>)</em></dt>
<dt id="index-besselh-2">: <em><var>H</var> =</em> <strong>besselh</strong> <em>(<var>alpha</var>, <var>k</var>, <var>x</var>, <var>opt</var>)</em></dt>
<dt id="index-besselh-3">: <em>[<var>H</var>, <var>ierr</var>] =</em> <strong>besselh</strong> <em>(&hellip;)</em></dt>
<dd><p>Compute Bessel functions of the third kind (Hankel functions).
</p>
<p>The order of the Bessel function <var>alpha</var> must be real.  The kind of Hankel
function is specified by <var>k</var> and may be either first (<var>k</var> = 1) or
second (<var>k</var> = 2).  The default is Hankel functions of the first kind.  The
points for evaluation <var>x</var> may be complex.
</p>
<p>If the optional argument <var>opt</var> is 1 or true, the result is multiplied
by <code>exp (-I*<var>x</var>)</code> for <var>k</var> = 1 or <code>exp (I*<var>x</var>)</code> for
<var>k</var> = 2.
</p>
<p>If <var>alpha</var> is a scalar, the result is the same size as <var>x</var>.  If <var>x</var>
is a scalar, the result is the same size as <var>alpha</var>.  If <var>alpha</var> is a
row vector and <var>x</var> is a column vector, the result is a matrix with
<code>length (<var>x</var>)</code> rows and <code>length (<var>alpha</var>)</code> columns.
Otherwise, <var>alpha</var> and <var>x</var> must conform and the result will be the same
size.
</p>
<p>If requested, <var>ierr</var> contains the following status information and is the
same size as the result.
</p>
<ol start="0">
<li> Normal return.

</li><li> Input error, return <code>NaN</code>.

</li><li> Overflow, return <code>Inf</code>.

</li><li> Loss of significance by argument reduction results in less than half of machine
accuracy.

</li><li> Complete loss of significance by argument reduction, return <code>NaN</code>.

</li><li> Error&mdash;no computation, algorithm termination condition not met, return
<code>NaN</code>.
</li></ol>


<p><strong>See also:</strong> <a href="#XREFbesselj">besselj</a>, <a href="#XREFbessely">bessely</a>, <a href="#XREFbesseli">besseli</a>, <a href="#XREFbesselk">besselk</a>.
</p></dd></dl>


<span id="XREFbeta"></span><dl>
<dt id="index-beta">: <em></em> <strong>beta</strong> <em>(<var>a</var>, <var>b</var>)</em></dt>
<dd><p>Compute the Beta function for real inputs <var>a</var> and <var>b</var>.
</p>
<p>The Beta function definition is
</p>
<div class="example">
<pre class="example">beta (a, b) = gamma (a) * gamma (b) / gamma (a + b).
</pre></div>


<p>The Beta function can grow quite large and it is often more useful to work
with the logarithm of the output rather than the function directly.
See <a href="#XREFbetaln">betaln</a>, for computing the logarithm of the Beta function
in an efficient manner.
</p>
<p><strong>See also:</strong> <a href="#XREFbetaln">betaln</a>, <a href="#XREFbetainc">betainc</a>, <a href="#XREFbetaincinv">betaincinv</a>.
</p></dd></dl>


<span id="XREFbetainc"></span><dl>
<dt id="index-betainc">: <em></em> <strong>betainc</strong> <em>(<var>x</var>, <var>a</var>, <var>b</var>)</em></dt>
<dt id="index-betainc-1">: <em></em> <strong>betainc</strong> <em>(<var>x</var>, <var>a</var>, <var>b</var>, <var>tail</var>)</em></dt>
<dd><p>Compute the incomplete beta function.
</p>
<p>This is defined as
</p>
<div class="example">
<pre class="example">               x
              /
             |
I_x (a, b) = | t^(a-1) (1-t)^(b-1) dt
             |
             /
            0
</pre></div>


<p>with real <var>x</var> in the range [0,1].  The inputs <var>a</var> and <var>b</var> must
be real and strictly positive (&gt; 0).  If one of the inputs is not a scalar
then the other inputs must be scalar or of compatible dimensions.
</p>
<p>By default, <var>tail</var> is <code>&quot;lower&quot;</code> and the incomplete beta function
integrated from 0 to <var>x</var> is computed.  If <var>tail</var> is <code>&quot;upper&quot;</code>
then the complementary function integrated from <var>x</var> to 1 is calculated.
The two choices are related by
</p>
<p>betainc (<var>x</var>, <var>a</var>, <var>b</var>, <code>&quot;upper&quot;</code>) =
1 - betainc (<var>x</var>, <var>a</var>, <var>b</var>, <code>&quot;lower&quot;</code>).
</p>
<p><code>betainc</code> uses a more sophisticated algorithm than subtraction to
get numerically accurate results when the <code>&quot;lower&quot;</code> value is small.
</p>
<p>Reference: A. Cuyt, V. Brevik Petersen, B. Verdonk, H. Waadeland,
W.B. Jones, <cite>Handbook of Continued Fractions for Special Functions</cite>,
ch. 18.
</p>

<p><strong>See also:</strong> <a href="#XREFbeta">beta</a>, <a href="#XREFbetaincinv">betaincinv</a>, <a href="#XREFbetaln">betaln</a>.
</p></dd></dl>


<span id="XREFbetaincinv"></span><dl>
<dt id="index-betaincinv">: <em></em> <strong>betaincinv</strong> <em>(<var>y</var>, <var>a</var>, <var>b</var>)</em></dt>
<dt id="index-betaincinv-1">: <em></em> <strong>betaincinv</strong> <em>(<var>y</var>, <var>a</var>, <var>b</var>, &quot;lower&quot;)</em></dt>
<dt id="index-betaincinv-2">: <em></em> <strong>betaincinv</strong> <em>(<var>y</var>, <var>a</var>, <var>b</var>, &quot;upper&quot;)</em></dt>
<dd><p>Compute the inverse of the normalized incomplete beta function.
</p>
<p>The normalized incomplete beta function is defined as
</p>
<div class="example">
<pre class="example">               x
              /
             |
I_x (a, b) = | t^(a-1) (1-t)^(b-1) dt
             |
             /
            0
</pre></div>


<p>If two inputs are scalar, then <code>betaincinv (<var>y</var>, <var>a</var>, <var>b</var>)</code>
is returned for each of the other inputs.
</p>
<p>If two or more inputs are not scalar, the sizes of them must agree, and
<code>betaincinv</code> is applied element-by-element.
</p>
<p>The variable <var>y</var> must be in the interval [0,1], while <var>a</var> and
<var>b</var> must be real and strictly positive.
</p>
<p>By default, <var>tail</var> is <code>&quot;lower&quot;</code> and the inverse of the incomplete
beta function integrated from 0 to <var>x</var> is computed.  If <var>tail</var> is
<code>&quot;upper&quot;</code> then the complementary function integrated from <var>x</var> to 1
is inverted.
</p>
<p>The function is computed by standard Newton&rsquo;s method, by solving
</p>
<div class="example">
<pre class="example"><var>y</var> - betainc (<var>x</var>, <var>a</var>, <var>b</var>) = 0
</pre></div>



<p><strong>See also:</strong> <a href="#XREFbetainc">betainc</a>, <a href="#XREFbeta">beta</a>, <a href="#XREFbetaln">betaln</a>.
</p></dd></dl>


<span id="XREFbetaln"></span><dl>
<dt id="index-betaln">: <em></em> <strong>betaln</strong> <em>(<var>a</var>, <var>b</var>)</em></dt>
<dd><p>Compute the natural logarithm of the Beta function for real inputs <var>a</var>
and <var>b</var>.
</p>
<p><code>betaln</code> is defined as
</p>
<div class="example">
<pre class="example">betaln (a, b) = log (beta (a, b))
</pre></div>

<p>and is calculated in a way to reduce the occurrence of underflow.
</p>
<p>The Beta function can grow quite large and it is often more useful to work
with the logarithm of the output rather than the function directly.
</p>
<p><strong>See also:</strong> <a href="#XREFbeta">beta</a>, <a href="#XREFbetainc">betainc</a>, <a href="#XREFbetaincinv">betaincinv</a>, <a href="#XREFgammaln">gammaln</a>.
</p></dd></dl>


<span id="XREFbincoeff"></span><dl>
<dt id="index-bincoeff">: <em></em> <strong>bincoeff</strong> <em>(<var>n</var>, <var>k</var>)</em></dt>
<dd><p>Return the binomial coefficient of <var>n</var> and <var>k</var>.
</p>
<p>The binomial coefficient is defined as
</p>
<div class="example">
<pre class="example"> /   \
 | n |    n (n-1) (n-2) &hellip; (n-k+1)
 |   |  = -------------------------
 | k |               k!
 \   /
</pre></div>

<p>For example:
</p>
<div class="example">
<pre class="example">bincoeff (5, 2)
   &rArr; 10
</pre></div>

<p>In most cases, the <code>nchoosek</code> function is faster for small
scalar integer arguments.  It also warns about loss of precision for
big arguments.
</p>

<p><strong>See also:</strong> <a href="Basic-Statistical-Functions.html#XREFnchoosek">nchoosek</a>.
</p></dd></dl>


<span id="XREFcommutation_005fmatrix"></span><dl>
<dt id="index-commutation_005fmatrix">: <em></em> <strong>commutation_matrix</strong> <em>(<var>m</var>, <var>n</var>)</em></dt>
<dd><p>Return the commutation matrix
K(m,n)
which is the unique
<var>m</var>*<var>n</var> by <var>m</var>*<var>n</var>
matrix such that
<em>K(m,n) * vec(A) = vec(A')</em>
for all
<em>m</em> by <em>n</em>
matrices
<em>A</em>.
</p>
<p>If only one argument <var>m</var> is given,
<em>K(m,m)</em>
is returned.
</p>
<p>See Magnus and Neudecker (1988), <cite>Matrix Differential
Calculus with Applications in Statistics and Econometrics</cite>.
</p></dd></dl>


<span id="XREFcosint"></span><dl>
<dt id="index-cosint">: <em></em> <strong>cosint</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the cosine integral function:
</p>
<div class="example">
<pre class="example">            +oo
           /
Ci (x) = - | (cos (t)) / t dt
           /
          x
</pre></div>

<p>An equivalent definition is
</p>
<div class="example">
<pre class="example">                             x
                            /
                            |  cos (t) - 1
Ci (x) = gamma + log (x) +  | -------------  dt
                            |        t
                            /
                           0
</pre></div>

<p>Reference:
</p>
<p>M. Abramowitz and I.A. Stegun,
<cite>Handbook of Mathematical Functions</cite>, 1964.
</p>

<p><strong>See also:</strong> <a href="#XREFsinint">sinint</a>, <a href="#XREFexpint">expint</a>, <a href="Trigonometry.html#XREFcos">cos</a>.
</p>
</dd></dl>


<span id="XREFduplication_005fmatrix"></span><dl>
<dt id="index-duplication_005fmatrix">: <em></em> <strong>duplication_matrix</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Return the duplication matrix
<em>Dn</em>
which is the unique
<em>n^2</em> by <em>n*(n+1)/2</em>
matrix such that
<em>Dn vech (A) = vec (A)</em>
for all symmetric
<em>n</em> by <em>n</em>
matrices
<em>A</em>.
</p>
<p>See Magnus and Neudecker (1988), <cite>Matrix Differential
Calculus with Applications in Statistics and Econometrics</cite>.
</p></dd></dl>


<span id="XREFdawson"></span><dl>
<dt id="index-dawson">: <em></em> <strong>dawson</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the Dawson (scaled imaginary error) function.
</p>
<p>The Dawson function is defined as
</p>
<div class="example">
<pre class="example">(sqrt (pi) / 2) * exp (-z^2) * erfi (z)
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerfc">erfc</a>, <a href="#XREFerf">erf</a>, <a href="#XREFerfcx">erfcx</a>, <a href="#XREFerfi">erfi</a>, <a href="#XREFerfinv">erfinv</a>, <a href="#XREFerfcinv">erfcinv</a>.
</p></dd></dl>


<span id="XREFellipj"></span><dl>
<dt id="index-ellipj">: <em>[<var>sn</var>, <var>cn</var>, <var>dn</var>, <var>err</var>] =</em> <strong>ellipj</strong> <em>(<var>u</var>, <var>m</var>)</em></dt>
<dt id="index-ellipj-1">: <em>[<var>sn</var>, <var>cn</var>, <var>dn</var>, <var>err</var>] =</em> <strong>ellipj</strong> <em>(<var>u</var>, <var>m</var>, <var>tol</var>)</em></dt>
<dd><p>Compute the Jacobi elliptic functions <var>sn</var>, <var>cn</var>, and <var>dn</var>
of complex argument <var>u</var> and real parameter <var>m</var>.
</p>
<p>If <var>m</var> is a scalar, the results are the same size as <var>u</var>.
If <var>u</var> is a scalar, the results are the same size as <var>m</var>.
If <var>u</var> is a column vector and <var>m</var> is a row vector, the
results are matrices with <code>length (<var>u</var>)</code> rows and
<code>length (<var>m</var>)</code> columns.  Otherwise, <var>u</var> and
<var>m</var> must conform in size and the results will be the same size as the
inputs.
</p>
<p>The value of <var>u</var> may be complex.
The value of <var>m</var> must be 0 &le; <var>m</var> &le; 1.
</p>
<p>The optional input <var>tol</var> is currently ignored (<small>MATLAB</small> uses this to
allow faster, less accurate approximation).
</p>
<p>If requested, <var>err</var> contains the following status information
and is the same size as the result.
</p>
<ol start="0">
<li> Normal return.

</li><li> Error&mdash;no computation, algorithm termination condition not met,
return <code>NaN</code>.
</li></ol>

<p>Reference: Milton Abramowitz and Irene A Stegun,
<cite>Handbook of Mathematical Functions</cite>, Chapter 16 (Sections 16.4, 16.13,
and 16.15), Dover, 1965.
</p>

<p><strong>See also:</strong> <a href="#XREFellipke">ellipke</a>.
</p></dd></dl>


<span id="XREFellipke"></span><dl>
<dt id="index-ellipke">: <em><var>k</var> =</em> <strong>ellipke</strong> <em>(<var>m</var>)</em></dt>
<dt id="index-ellipke-1">: <em><var>k</var> =</em> <strong>ellipke</strong> <em>(<var>m</var>, <var>tol</var>)</em></dt>
<dt id="index-ellipke-2">: <em>[<var>k</var>, <var>e</var>] =</em> <strong>ellipke</strong> <em>(&hellip;)</em></dt>
<dd><p>Compute complete elliptic integrals of the first K(<var>m</var>) and second
E(<var>m</var>) kind.
</p>
<p><var>m</var> must be a scalar or real array with -Inf &le; <var>m</var> &le; 1.
</p>
<p>The optional input <var>tol</var> controls the stopping tolerance of the
algorithm and defaults to <code>eps (class (<var>m</var>))</code>.  The tolerance can
be increased to compute a faster, less accurate approximation.
</p>
<p>When called with one output only elliptic integrals of the first kind are
returned.
</p>
<p>Mathematical Note:
</p>
<p>Elliptic integrals of the first kind are defined as
</p>

<div class="example">
<pre class="example">         1
        /               dt
K (m) = | ------------------------------
        / sqrt ((1 - t^2)*(1 - m*t^2))
       0
</pre></div>


<p>Elliptic integrals of the second kind are defined as
</p>

<div class="example">
<pre class="example">         1
        /  sqrt (1 - m*t^2)
E (m) = |  ------------------ dt
        /  sqrt (1 - t^2)
       0
</pre></div>


<p>Reference: Milton Abramowitz and Irene A. Stegun,
<cite>Handbook of Mathematical Functions</cite>, Chapter 17, Dover, 1965.
</p>
<p><strong>See also:</strong> <a href="#XREFellipj">ellipj</a>.
</p></dd></dl>


<span id="XREFerf"></span><dl>
<dt id="index-erf">: <em></em> <strong>erf</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the error function.
</p>
<p>The error function is defined as
</p>
<div class="example">
<pre class="example">                        z
              2        /
erf (z) = --------- *  | e^(-t^2) dt
          sqrt (pi)    /
                    t=0
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerfc">erfc</a>, <a href="#XREFerfcx">erfcx</a>, <a href="#XREFerfi">erfi</a>, <a href="#XREFdawson">dawson</a>, <a href="#XREFerfinv">erfinv</a>, <a href="#XREFerfcinv">erfcinv</a>.
</p></dd></dl>


<span id="XREFerfc"></span><dl>
<dt id="index-erfc">: <em></em> <strong>erfc</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the complementary error function.
</p>
<p>The complementary error function is defined as
<code>1&nbsp;<span class="nolinebreak">-</span>&nbsp;erf&nbsp;(<var>z</var>)</code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFerfcinv">erfcinv</a>, <a href="#XREFerfcx">erfcx</a>, <a href="#XREFerfi">erfi</a>, <a href="#XREFdawson">dawson</a>, <a href="#XREFerf">erf</a>, <a href="#XREFerfinv">erfinv</a>.
</p></dd></dl>


<span id="XREFerfcx"></span><dl>
<dt id="index-erfcx">: <em></em> <strong>erfcx</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the scaled complementary error function.
</p>
<p>The scaled complementary error function is defined as
</p>
<div class="example">
<pre class="example">exp (z^2) * erfc (z)
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerfc">erfc</a>, <a href="#XREFerf">erf</a>, <a href="#XREFerfi">erfi</a>, <a href="#XREFdawson">dawson</a>, <a href="#XREFerfinv">erfinv</a>, <a href="#XREFerfcinv">erfcinv</a>.
</p></dd></dl>


<span id="XREFerfi"></span><dl>
<dt id="index-erfi">: <em></em> <strong>erfi</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the imaginary error function.
</p>
<p>The imaginary error function is defined as
</p>
<div class="example">
<pre class="example">-i * erf (i*z)
</pre></div>


<p><strong>See also:</strong> <a href="#XREFerfc">erfc</a>, <a href="#XREFerf">erf</a>, <a href="#XREFerfcx">erfcx</a>, <a href="#XREFdawson">dawson</a>, <a href="#XREFerfinv">erfinv</a>, <a href="#XREFerfcinv">erfcinv</a>.
</p></dd></dl>


<span id="XREFerfinv"></span><dl>
<dt id="index-erfinv">: <em></em> <strong>erfinv</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the inverse error function.
</p>
<p>The inverse error function is defined such that
</p>
<div class="example">
<pre class="example">erf (<var>y</var>) == <var>x</var>
</pre></div>

<p><strong>See also:</strong> <a href="#XREFerf">erf</a>, <a href="#XREFerfc">erfc</a>, <a href="#XREFerfcx">erfcx</a>, <a href="#XREFerfi">erfi</a>, <a href="#XREFdawson">dawson</a>, <a href="#XREFerfcinv">erfcinv</a>.
</p></dd></dl>


<span id="XREFerfcinv"></span><dl>
<dt id="index-erfcinv">: <em></em> <strong>erfcinv</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the inverse complementary error function.
</p>
<p>The inverse complementary error function is defined such that
</p>
<div class="example">
<pre class="example">erfc (<var>y</var>) == <var>x</var>
</pre></div>

<p><strong>See also:</strong> <a href="#XREFerfc">erfc</a>, <a href="#XREFerf">erf</a>, <a href="#XREFerfcx">erfcx</a>, <a href="#XREFerfi">erfi</a>, <a href="#XREFdawson">dawson</a>, <a href="#XREFerfinv">erfinv</a>.
</p></dd></dl>


<span id="XREFexpint"></span><dl>
<dt id="index-expint">: <em></em> <strong>expint</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the exponential integral.
</p>
<p>The exponential integral is defined as:
</p>

<div class="example">
<pre class="example">           +oo
          /
          | exp (-t)
E_1 (x) = | -------- dt
          |    t
          /
         x
</pre></div>


<p>Note: For compatibility, this function uses the <small>MATLAB</small> definition
of the exponential integral.  Most other sources refer to this particular
value as <em>E_1 (x)</em>, and the exponential integral as
</p>
<div class="example">
<pre class="example">            +oo
           /
           | exp (-t)
Ei (x) = - | -------- dt
           |    t
           /
         -x
</pre></div>

<p>The two definitions are related, for positive real values of <var>x</var>, by
<code><span class="nolinebreak">E_1</span>&nbsp;<span class="nolinebreak">(-x)</span>&nbsp;=&nbsp;<span class="nolinebreak">-Ei</span>&nbsp;(x)&nbsp;<span class="nolinebreak">-</span>&nbsp;i*pi</code><!-- /@w -->.
</p>
<p>References:
</p>
<p>M. Abramowitz and I.A. Stegun,
<cite>Handbook of Mathematical Functions</cite>, 1964.
</p>
<p>N. Bleistein and R.A. Handelsman,
<cite>Asymptotic expansions of integrals</cite>, 1986.
</p>

<p><strong>See also:</strong> <a href="#XREFcosint">cosint</a>, <a href="#XREFsinint">sinint</a>, <a href="Exponents-and-Logarithms.html#XREFexp">exp</a>.
</p></dd></dl>


<span id="XREFgamma"></span><dl>
<dt id="index-gamma">: <em></em> <strong>gamma</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the Gamma function.
</p>
<p>The Gamma function is defined as
</p>
<div class="example">
<pre class="example">             infinity
            /
gamma (z) = | t^(z-1) exp (-t) dt.
            /
         t=0
</pre></div>


<p>Programming Note: The gamma function can grow quite large even for small
input values.  In many cases it may be preferable to use the natural
logarithm of the gamma function (<code>gammaln</code>) in calculations to minimize
loss of precision.  The final result is then
<code>exp (<var>result_using_gammaln</var>).</code>
</p>
<p><strong>See also:</strong> <a href="#XREFgammainc">gammainc</a>, <a href="#XREFgammaln">gammaln</a>, <a href="Utility-Functions.html#XREFfactorial">factorial</a>.
</p></dd></dl>


<span id="XREFgammainc"></span><dl>
<dt id="index-gammainc">: <em></em> <strong>gammainc</strong> <em>(<var>x</var>, <var>a</var>)</em></dt>
<dt id="index-gammainc-1">: <em></em> <strong>gammainc</strong> <em>(<var>x</var>, <var>a</var>, <var>tail</var>)</em></dt>
<dd><p>Compute the normalized incomplete gamma function.
</p>
<p>This is defined as
</p>
<div class="example">
<pre class="example">                                x
                       1       /
gammainc (x, a) = ---------    | exp (-t) t^(a-1) dt
                  gamma (a)    /
                            t=0
</pre></div>

<p>with the limiting value of 1 as <var>x</var> approaches infinity.
The standard notation is <em>P(a,x)</em>, e.g., Abramowitz and
Stegun (6.5.1).
</p>
<p>If <var>a</var> is scalar, then <code>gammainc (<var>x</var>, <var>a</var>)</code> is returned
for each element of <var>x</var> and vice versa.
</p>
<p>If neither <var>x</var> nor <var>a</var> is scalar then the sizes of <var>x</var> and
<var>a</var> must agree, and <code>gammainc</code> is applied element-by-element.
The elements of <var>a</var> must be non-negative.
</p>
<p>By default, <var>tail</var> is <code>&quot;lower&quot;</code> and the incomplete gamma function
integrated from 0 to <var>x</var> is computed.  If <var>tail</var> is <code>&quot;upper&quot;</code>
then the complementary function integrated from <var>x</var> to infinity is
calculated.
</p>
<p>If <var>tail</var> is <code>&quot;scaledlower&quot;</code>, then the lower incomplete gamma
function is multiplied by
<em>gamma(a+1)*exp(x)/(x^a)</em>.
If <var>tail</var> is <code>&quot;scaledupper&quot;</code>, then the upper incomplete gamma
function is multiplied by the same quantity.
</p>
<p>References:
</p>
<p>M. Abramowitz and I.A. Stegun,
<cite>Handbook of mathematical functions</cite>,
Dover publications, Inc., 1972.
</p>
<p>W. Gautschi,
<cite>A computational procedure for incomplete gamma functions</cite>,
ACM Trans. Math Software, pp. 466&ndash;481, Vol 5, No. 4, 2012.
</p>
<p>W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery,
<cite>Numerical Recipes in Fortran 77</cite>, ch. 6.2, Vol 1, 1992.
</p>

<p><strong>See also:</strong> <a href="#XREFgamma">gamma</a>, <a href="#XREFgammaincinv">gammaincinv</a>, <a href="#XREFgammaln">gammaln</a>.
</p></dd></dl>


<span id="XREFgammaincinv"></span><dl>
<dt id="index-gammaincinv">: <em></em> <strong>gammaincinv</strong> <em>(<var>y</var>, <var>a</var>)</em></dt>
<dt id="index-gammaincinv-1">: <em></em> <strong>gammaincinv</strong> <em>(<var>y</var>, <var>a</var>, <var>tail</var>)</em></dt>
<dd><p>Compute the inverse of the normalized incomplete gamma function.
</p>
<p>The normalized incomplete gamma function is defined as
</p>
<div class="example">
<pre class="example">                                x
                       1       /
gammainc (x, a) = ---------    | exp (-t) t^(a-1) dt
                  gamma (a)    /
                            t=0
</pre></div>


<p>and <code>gammaincinv (gammainc (<var>x</var>, <var>a</var>), <var>a</var>) = <var>x</var></code>
for each non-negative value of <var>x</var>.  If <var>a</var> is scalar then
<code>gammaincinv (<var>y</var>, <var>a</var>)</code> is returned for each element of
<var>y</var> and vice versa.
</p>
<p>If neither <var>y</var> nor <var>a</var> is scalar then the sizes of <var>y</var> and
<var>a</var> must agree, and <code>gammaincinv</code> is applied element-by-element.
The variable <var>y</var> must be in the interval <em>[0,1]</em> while <var>a</var> must
be real and positive.
</p>
<p>By default, <var>tail</var> is <code>&quot;lower&quot;</code> and the inverse of the incomplete
gamma function integrated from 0 to <var>x</var> is computed.  If <var>tail</var> is
<code>&quot;upper&quot;</code>, then the complementary function integrated from <var>x</var> to
infinity is inverted.
</p>
<p>The function is computed with Newton&rsquo;s method by solving
</p>
<div class="example">
<pre class="example"><var>y</var> - gammainc (<var>x</var>, <var>a</var>) = 0
</pre></div>


<p>Reference: A. Gil, J. Segura, and N. M. Temme, <cite>Efficient and
accurate algorithms for the computation and inversion of the incomplete
gamma function ratios</cite>, SIAM J. Sci. Computing, pp.
A2965&ndash;A2981, Vol 34, 2012.
</p>

<p><strong>See also:</strong> <a href="#XREFgammainc">gammainc</a>, <a href="#XREFgamma">gamma</a>, <a href="#XREFgammaln">gammaln</a>.
</p></dd></dl>


<span id="XREFlegendre"></span><dl>
<dt id="index-legendre">: <em><var>l</var> =</em> <strong>legendre</strong> <em>(<var>n</var>, <var>x</var>)</em></dt>
<dt id="index-legendre-1">: <em><var>l</var> =</em> <strong>legendre</strong> <em>(<var>n</var>, <var>x</var>, <var>normalization</var>)</em></dt>
<dd><p>Compute the associated Legendre function of degree <var>n</var> and order
<var>m</var> = 0 &hellip; <var>n</var>.
</p>
<p>The value <var>n</var> must be a real non-negative integer.
</p>
<p><var>x</var> is a vector with real-valued elements in the range [-1, 1].
</p>
<p>The optional argument <var>normalization</var> may be one of <code>&quot;unnorm&quot;</code>,
<code>&quot;sch&quot;</code>, or <code>&quot;norm&quot;</code>.  The default if no normalization is given
is <code>&quot;unnorm&quot;</code>.
</p>
<p>When the optional argument <var>normalization</var> is <code>&quot;unnorm&quot;</code>, compute
the associated Legendre function of degree <var>n</var> and order <var>m</var> and
return all values for <var>m</var> = 0 &hellip; <var>n</var>.  The return value has one
dimension more than <var>x</var>.
</p>
<p>The associated Legendre function of degree <var>n</var> and order <var>m</var>:
</p>

<div class="example">
<pre class="example"> m         m      2  m/2   d^m
P(x) = (-1) * (1-x  )    * ----  P(x)
 n                         dx^m   n
</pre></div>


<p>with Legendre polynomial of degree <var>n</var>:
</p>

<div class="example">
<pre class="example">          1    d^n   2    n
P(x) = ------ [----(x - 1) ]
 n     2^n n!  dx^n
</pre></div>


<p><code>legendre (3, [-1.0, -0.9, -0.8])</code> returns the matrix:
</p>
<div class="example">
<pre class="example"> x  |   -1.0   |   -0.9   |   -0.8
------------------------------------
m=0 | -1.00000 | -0.47250 | -0.08000
m=1 |  0.00000 | -1.99420 | -1.98000
m=2 |  0.00000 | -2.56500 | -4.32000
m=3 |  0.00000 | -1.24229 | -3.24000
</pre></div>

<p>When the optional argument <var>normalization</var> is <code>&quot;sch&quot;</code>, compute
the Schmidt semi-normalized associated Legendre function.  The Schmidt
semi-normalized associated Legendre function is related to the unnormalized
Legendre functions by the following:
</p>
<p>For Legendre functions of degree <var>n</var> and order 0:
</p>

<div class="example">
<pre class="example">  0      0
SP(x) = P(x)
  n      n
</pre></div>


<p>For Legendre functions of degree n and order m:
</p>

<div class="example">
<pre class="example">  m      m         m    2(n-m)! 0.5
SP(x) = P(x) * (-1)  * [-------]
  n      n              (n+m)!
</pre></div>


<p>When the optional argument <var>normalization</var> is <code>&quot;norm&quot;</code>, compute
the fully normalized associated Legendre function.  The fully normalized
associated Legendre function is related to the unnormalized associated
Legendre functions by the following:
</p>
<p>For Legendre functions of degree <var>n</var> and order <var>m</var>
</p>

<div class="example">
<pre class="example">  m      m         m    (n+0.5)(n-m)! 0.5
NP(x) = P(x) * (-1)  * [-------------]
  n      n                  (n+m)!
</pre></div>

</dd></dl>


<span id="XREFgammaln"></span><span id="XREFlgamma"></span><dl>
<dt id="index-gammaln">: <em></em> <strong>gammaln</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-lgamma">: <em></em> <strong>lgamma</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Return the natural logarithm of the gamma function of <var>x</var>.
</p>
<p><strong>See also:</strong> <a href="#XREFgamma">gamma</a>, <a href="#XREFgammainc">gammainc</a>.
</p></dd></dl>


<span id="XREFpsi"></span><dl>
<dt id="index-psi">: <em></em> <strong>psi</strong> <em>(<var>z</var>)</em></dt>
<dt id="index-psi-1">: <em></em> <strong>psi</strong> <em>(<var>k</var>, <var>z</var>)</em></dt>
<dd><p>Compute the psi (polygamma) function.
</p>
<p>The polygamma functions are the <var>k</var>th derivative of the logarithm
of the gamma function.  If unspecified, <var>k</var> defaults to zero.  A value
of zero computes the digamma function, a value of 1, the trigamma function,
and so on.
</p>
<p>The digamma function is defined:
</p>

<div class="example">
<pre class="example">psi (z) = d (log (gamma (z))) / dx
</pre></div>


<p>When computing the digamma function (when <var>k</var> equals zero), <var>z</var>
can have any value real or complex value.  However, for polygamma functions
(<var>k</var> higher than 0), <var>z</var> must be real and non-negative.
</p>

<p><strong>See also:</strong> <a href="#XREFgamma">gamma</a>, <a href="#XREFgammainc">gammainc</a>, <a href="#XREFgammaln">gammaln</a>.
</p></dd></dl>


<span id="XREFsinint"></span><dl>
<dt id="index-sinint">: <em></em> <strong>sinint</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the sine integral function:
</p>
<div class="example">
<pre class="example">           x
          /
Si (x) =  | sin (t) / t dt
          /
         0
</pre></div>


<p>Reference:
M. Abramowitz and I.A. Stegun,
<cite>Handbook of Mathematical Functions</cite>, 1964.
</p>

<p><strong>See also:</strong> <a href="#XREFcosint">cosint</a>, <a href="#XREFexpint">expint</a>, <a href="Trigonometry.html#XREFsin">sin</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Rational-Approximations.html" accesskey="n" rel="next">Rational Approximations</a>, Previous: <a href="Utility-Functions.html" accesskey="p" rel="prev">Utility Functions</a>, Up: <a href="Arithmetic.html" accesskey="u" rel="up">Arithmetic</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>