comparison doc/interpreter/tips.txi @ 7081:503001863427

[project @ 2007-10-31 01:08:14 by jwe]
author jwe
date Wed, 31 Oct 2007 01:09:28 +0000
parents fd42779a8428
children 74075b3b54c1
comparison
equal deleted inserted replaced
7080:7e465260a48f 7081:503001863427
181 ## This file is part of Octave. 181 ## This file is part of Octave.
182 ## 182 ##
183 ## Octave is free software; you can redistribute it and/or 183 ## Octave is free software; you can redistribute it and/or
184 ## modify it under the terms of the GNU General Public 184 ## modify it under the terms of the GNU General Public
185 ## License as published by the Free Software Foundation; 185 ## License as published by the Free Software Foundation;
186 ## either version 3 of the License, or (at your option) any later 186 ## either version 3 of the License, or (at your option) any
187 ## version. 187 ## later version.
188 ## 188 ##
189 ## Octave is distributed in the hope that it will be useful, 189 ## Octave is distributed in the hope that it will be useful,
190 ## but WITHOUT ANY WARRANTY; without even the implied 190 ## but WITHOUT ANY WARRANTY; without even the implied
191 ## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 191 ## warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
192 ## PURPOSE. See the GNU General Public License for more 192 ## PURPOSE. See the GNU General Public License for more
380 therefore looks like this 380 therefore looks like this
381 381
382 @example 382 @example
383 @group 383 @group
384 -*- texinfo -*- 384 -*- texinfo -*-
385 @@deftypefn@{Function File@} @{@@var@{return_value@} = @} function_name (@dots{}) 385 @@deftypefn@{Function File@} @{@@var@{ret@} = @} fn (@dots{})
386 @@cindex index term 386 @@cindex index term
387 Help text in Texinfo format. Code samples should be marked like 387 Help text in Texinfo format. Code samples should be marked
388 @@code@{sample of code@} and variables should be marked as 388 like @@code@{sample of code@} and variables should be marked
389 @@var@{variable@}. 389 as @@var@{variable@}.
390 @@seealso@{function2@} 390 @@seealso@{fn2@}
391 @@end deftypefn 391 @@end deftypefn
392 @end group 392 @end group
393 @end example 393 @end example
394 394
395 This help string must be commented in user functions, or in the help 395 This help string must be commented in user functions, or in the help
489 example 489 example
490 490
491 @example 491 @example
492 @group 492 @group
493 -*- texinfo -*- 493 -*- texinfo -*-
494 @@deftypefn@{Function File@} @{@@var@{a@} = @} function_name (@@var@{x@}, @dots{}) 494 @@deftypefn@{Function File@} @{@@var@{a@} = @} fn (@@var@{x@}, @dots{})
495 @@deftypefnx@{Function File@} @{@@var@{a@} = @} function_name (@@var@{y@}, @dots{}) 495 @@deftypefnx@{Function File@} @{@@var@{a@} = @} fn (@@var@{y@}, @dots{})
496 Help text in Texinfo format. 496 Help text in Texinfo format.
497 @@end deftypefn 497 @@end deftypefn
498 @end group 498 @end group
499 @end example 499 @end example
500 500
504 documentation string of @code{nchoosek} is 504 documentation string of @code{nchoosek} is
505 505
506 @example 506 @example
507 @group 507 @group
508 -*- texinfo -*- 508 -*- texinfo -*-
509 @@deftypefn @{Function File@} @{@@var@{c@} =@} nchoosek (@@var@{n@}, @@var@{k@}) 509 @@deftypefn @{Function File@} @{@} nchoosek (@@var@{n@}, @@var@{k@})
510 510
511 Compute the binomial coefficient or all combinations of @@var@{n@}. 511 Compute the binomial coefficient or all combinations of
512 If @@var@{n@} is a scalar then, calculate the binomial coefficient 512 @@var@{n@}. If @@var@{n@} is a scalar then, calculate the
513 of @@var@{n@} and @@var@{k@}, defined as 513 binomial coefficient of @@var@{n@} and @@var@{k@}, defined as
514 514
515 @@iftex 515 @@iftex
516 @@tex 516 @@tex
517 $$ 517 $$
518 @{n \choose k@} = @{n (n-1) (n-2) \cdots (n-k+1) \over k!@} 518 @{n \choose k@} = @{n (n-1) (n-2) \cdots (n-k+1) \over k!@}
530 \ / 530 \ /
531 @@end group 531 @@end group
532 @@end example 532 @@end example
533 @@end ifinfo 533 @@end ifinfo
534 534
535 If @@var@{n@} is a vector, this generates all combinations of the elements 535 If @@var@{n@} is a vector, this generates all combinations
536 of @@var@{n@}, taken @@var@{k@} at a time, one row per combination. The 536 of the elements of @@var@{n@}, taken @@var@{k@} at a time,
537 resulting @@var@{c@} has size @@code@{[nchoosek (length (@@var@{n@}), 537 one row per combination. The resulting @@var@{c@} has size
538 @@var@{k@}), @@var@{k@}]@}. 538 @@code@{[nchoosek (length (@@var@{n@}),@@var@{k@}), @@var@{k@}]@}.
539 539
540 @@seealso@{bincoeff@} 540 @@seealso@{bincoeff@}
541 @@end deftypefn 541 @@end deftypefn
542 @end group 542 @end group
543 @end example 543 @end example
550 @c reproduce it here to prevent it looking different than how it would 550 @c reproduce it here to prevent it looking different than how it would
551 @c appear with info. 551 @c appear with info.
552 @example 552 @example
553 @group 553 @group
554 -- Function File: C = nchoosek (N, K) 554 -- Function File: C = nchoosek (N, K)
555 Compute the binomial coefficient or all combinations of N. If N 555 Compute the binomial coefficient or all combinations
556 is a scalar then, calculate the binomial coefficient of N and K, 556 of N. If N is a scalar then, calculate the binomial
557 defined as 557 coefficient of N and K, defined as
558 558
559 / \ 559 / \
560 | n | n (n-1) (n-2) ... (n-k+1) 560 | n | n (n-1) (n-2) ... (n-k+1) n!
561 | | = ------------------------- 561 | | = ------------------------- = ---------
562 | k | k! 562 | k | k! k! (n-k)!
563 \ / 563 \ /
564 564
565 If N is a vector generate all combinations of the elements of N, 565 If N is a vector generate all combinations of the
566 taken K at a time, one row per combination. The resulting C has 566 elements of N, taken K at a time, one row per
567 size `[nchoosek (length (N), K), K]'. 567 combination. The resulting C has size `[nchoosek
568 (length (N), K), K]'.
568 569
569 570
570 See also: bincoeff. 571 See also: bincoeff.
571 @end group 572 @end group
572 @end example 573 @end example