math.tex 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 2000 by Florian Klaempfl
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \chapter{The MATH unit}
  22. \FPCexampledir{mathex}
  23. This chapter describes the \file{math} unit. The \var{math} unit
  24. was initially written by Florian Klaempfl. It provides mathematical
  25. functions which aren't covered by the system unit.
  26. This chapter starts out with a definition of all types and constants
  27. that are defined, followed by a complete explanation of each function.
  28. {\em Remark} This unit is compiled in Object Pascal mode so all
  29. \var{integers} are 32 bit.
  30. \section{Constants and types}
  31. The following types are defined in the \file{math} unit:
  32. \begin{verbatim}
  33. Type
  34. Float = Extended;
  35. \end{verbatim}
  36. All calculations are done with the Float type. This allows to
  37. recompile the unit with a different float type to obtain a
  38. desired precision.
  39. \begin{verbatim}
  40. Type
  41. TPaymentTime = (PTEndOfPeriod,PTStartOfPeriod);
  42. \end{verbatim}
  43. \var{TPaymentTime} is used in the financial calculations.
  44. \begin{verbatim}
  45. Type
  46. EInvalidArgument = Class(EMathError);
  47. \end{verbatim}
  48. The \var{EInvalidArgument} exception is used to report invalid arguments.
  49. \section{Functions and Procedures}
  50. \begin{function}{arccos}
  51. \Declaration
  52. Function arccos(x : float) : float;
  53. \Description
  54. \var{Arccos} returns the inverse cosine of its argument \var{x}. The
  55. argument \var{x} should lie between -1 and 1 (borders included).
  56. \Errors
  57. If the argument \var{x} is not in the allowed range, an
  58. \var{EInvalidArgument} exception is raised.
  59. \SeeAlso
  60. \seef{arcsin}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
  61. \end{function}
  62. \FPCexample{ex1}
  63. \begin{function}{arcosh}
  64. \Declaration
  65. Function arcosh(x : float) : float;
  66. Function arccosh(x : float) : float;
  67. \Description
  68. \var{Arcosh} returns the inverse hyperbolic cosine of its argument \var{x}.
  69. The argument \var{x} should be larger than 1.
  70. The \var{arccosh} variant of this function is supplied for \delphi
  71. compatibility.
  72. \Errors
  73. If the argument \var{x} is not in the allowed range, an \var{EInvalidArgument}
  74. exception is raised.
  75. \SeeAlso
  76. \seef{cosh}, \seef{sinh}, \seef{arcsin}, \seef{arsinh}, \seef{artanh},
  77. \seef{tanh}
  78. \end{function}
  79. \FPCexample{ex3}
  80. \begin{function}{arcsin}
  81. \Declaration
  82. Function arcsin(x : float) : float;
  83. \Description
  84. \var{Arcsin} returns the inverse sine of its argument \var{x}. The
  85. argument \var{x} should lie between -1 and 1.
  86. \Errors
  87. If the argument \var{x} is not in the allowed range, an \var{EInvalidArgument}
  88. exception is raised.
  89. \SeeAlso
  90. \seef{arccos}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
  91. \end{function}
  92. \FPCexample{ex2}
  93. \begin{function}{arctan2}
  94. \Declaration
  95. Function arctan2(x,y : float) : float;
  96. \Description
  97. \var{arctan2} calculates \var{arctan(y/x)}, and returns an angle in the
  98. correct quadrant. The returned angle will be in the range $-\pi$ to
  99. $\pi$ radians.
  100. The values of \var{x} and \var{y} must be between -2\^{}64 and 2\^{}64,
  101. moreover \var{x} should be different from zero.
  102. On Intel systems this function is implemented with the native intel
  103. \var{fpatan} instruction.
  104. \Errors
  105. If \var{x} is zero, an overflow error will occur.
  106. \SeeAlso
  107. \seef{arccos}, \seef{arcosh}, \seef{arsinh}, \seef{artanh}
  108. \end{function}
  109. \FPCexample{ex6}
  110. \begin{function}{arsinh}
  111. \Declaration
  112. Function arsinh(x : float) : float;
  113. Function arcsinh(x : float) : float;
  114. \Description
  115. \var{arsinh} returns the inverse hyperbolic sine of its argument \var{x}.
  116. The \var{arscsinh} variant of this function is supplied for \delphi
  117. compatibility.
  118. \Errors
  119. None.
  120. \SeeAlso
  121. \seef{arcosh}, \seef{arccos}, \seef{arcsin}, \seef{artanh}
  122. \end{function}
  123. \FPCexample{ex4}
  124. \begin{function}{artanh}
  125. \Declaration
  126. Function artanh(x : float) : float;
  127. Function arctanh(x : float) : float;
  128. \Description
  129. \var{artanh} returns the inverse hyperbolic tangent of its argument \var{x},
  130. where \var{x} should lie in the interval [-1,1], borders included.
  131. The \var{arctanh} variant of this function is supplied for \delphi compatibility.
  132. \Errors
  133. In case \var{x} is not in the interval [-1,1], an \var{EInvalidArgument}
  134. exception is raised.
  135. \SeeAlso
  136. \seef{arcosh}, \seef{arccos}, \seef{arcsin}, \seef{artanh}
  137. \Errors
  138. \SeeAlso
  139. \end{function}
  140. \FPCexample{ex5}
  141. \begin{function}{ceil}
  142. \Declaration
  143. Function ceil(x : float) : longint;
  144. \Description
  145. \var{Ceil} returns the lowest integer number greater than or equal to \var{x}.
  146. The absolute value of \var{x} should be less than \var{maxint}.
  147. \Errors
  148. If the asolute value of \var{x} is larger than maxint, an overflow error will
  149. occur.
  150. \SeeAlso
  151. \seef{floor}
  152. \end{function}
  153. \FPCexample{ex7}
  154. \begin{function}{cosh}
  155. \Declaration
  156. Function cosh(x : float) : float;
  157. \Description
  158. \var{Cosh} returns the hyperbolic cosine of it's argument {x}.
  159. \Errors
  160. None.
  161. \SeeAlso
  162. \seef{arcosh}, \seef{sinh}, \seef{arsinh}
  163. \end{function}
  164. \FPCexample{ex8}
  165. \begin{function}{cotan}
  166. \Declaration
  167. Function cotan(x : float) : float;
  168. \Description
  169. \var{Cotan} returns the cotangent of it's argument \var{x}. \var{x} should
  170. be different from zero.
  171. \Errors
  172. If \var{x} is zero then a overflow error will occur.
  173. \SeeAlso
  174. \seef{tanh}
  175. \end{function}
  176. \FPCexample{ex9}
  177. \begin{function}{cycletorad}
  178. \Declaration
  179. Function cycletorad(cycle : float) : float;
  180. \Description
  181. \var{Cycletorad} transforms it's argument \var{cycle}
  182. (an angle expressed in cycles) to radians.
  183. (1 cycle is $2 \pi$ radians).
  184. \Errors
  185. None.
  186. \SeeAlso
  187. \seef{degtograd}, \seef{degtorad}, \seef{radtodeg},
  188. \seef{radtograd}, \seef{radtocycle}
  189. \end{function}
  190. \FPCexample{ex10}
  191. \begin{function}{degtograd}
  192. \Declaration
  193. Function degtograd(deg : float) : float;
  194. \Description
  195. \var{Degtograd} transforms it's argument \var{deg} (an angle in degrees)
  196. to grads.
  197. (90 degrees is 100 grad.)
  198. \Errors
  199. None.
  200. \SeeAlso
  201. \seef{cycletorad}, \seef{degtorad}, \seef{radtodeg},
  202. \seef{radtograd}, \seef{radtocycle}
  203. \end{function}
  204. \FPCexample{ex11}
  205. \begin{function}{degtorad}
  206. \Declaration
  207. Function degtorad(deg : float) : float;
  208. \Description
  209. \var{Degtorad} converts it's argument \var{deg} (an angle in degrees) to
  210. radians.
  211. (pi radians is 180 degrees)
  212. \Errors
  213. None.
  214. \SeeAlso
  215. \seef{cycletorad}, \seef{degtograd}, \seef{radtodeg},
  216. \seef{radtograd}, \seef{radtocycle}
  217. \end{function}
  218. \FPCexample{ex12}
  219. \begin{function}{floor}
  220. \Declaration
  221. Function floor(x : float) : longint;
  222. \Description
  223. \var{Floor} returns the largest integer smaller than or equal to \var{x}.
  224. The absolute value of \var{x} should be less than \var{maxint}.
  225. \Errors
  226. If \var{x} is larger than \var{maxint}, an overflow will occur.
  227. \SeeAlso
  228. \seef{ceil}
  229. \end{function}
  230. \FPCexample{ex13}
  231. \begin{procedure}{frexp}
  232. \Declaration
  233. Procedure frexp(x : float;var mantissa,exponent : float);
  234. \Description
  235. \var{Frexp} returns the mantissa and exponent of it's argument
  236. \var{x} in \var{mantissa} and \var{exponent}.
  237. \Errors
  238. None
  239. \SeeAlso
  240. \end{procedure}
  241. \FPCexample{ex14}
  242. \begin{function}{gradtodeg}
  243. \Declaration
  244. Function gradtodeg(grad : float) : float;
  245. \Description
  246. \var{Gradtodeg} converts its argument \var{grad} (an angle in grads)
  247. to degrees.
  248. (100 grad is 90 degrees)
  249. \Errors
  250. None.
  251. \SeeAlso
  252. \seef{cycletorad}, \seef{degtograd}, \seef{radtodeg},
  253. \seef{radtograd}, \seef{radtocycle}, \seef{gradtorad}
  254. \end{function}
  255. \FPCexample{ex15}
  256. \begin{function}{gradtorad}
  257. \Declaration
  258. Function gradtorad(grad : float) : float;
  259. \Description
  260. \var{Gradtorad} converts its argument \var{grad} (an angle in grads)
  261. to radians.
  262. (200 grad is pi degrees).
  263. \Errors
  264. None.
  265. \SeeAlso
  266. \seef{cycletorad}, \seef{degtograd}, \seef{radtodeg},
  267. \seef{radtograd}, \seef{radtocycle}, \seef{gradtodeg}
  268. \end{function}
  269. \FPCexample{ex16}
  270. \begin{function}{hypot}
  271. \Declaration
  272. Function hypot(x,y : float) : float;
  273. \Description
  274. \var{Hypot} returns the hypotenuse of the triangle where the sides
  275. adjacent to the square angle have lengths \var{x} and \var{y}.
  276. The function uses Pythagoras' rule for this.
  277. \Errors
  278. None.
  279. \SeeAlso
  280. \end{function}
  281. \FPCexample{ex17}
  282. \begin{function}{intpower}
  283. \Declaration
  284. Function intpower(base : float;exponent : longint) : float;
  285. \Description
  286. \var{Intpower} returns \var{base} to the power \var{exponent},
  287. where exponent is an integer value.
  288. \Errors
  289. If \var{base} is zero and the exponent is negative, then an
  290. overflow error will occur.
  291. \SeeAlso
  292. \seef{power}
  293. \end{function}
  294. \FPCexample{ex18}
  295. \begin{function}{ldexp}
  296. \Declaration
  297. Function ldexp(x : float;p : longint) : float;
  298. \Description
  299. \var{Ldexp} returns $2^p x$.
  300. \Errors
  301. None.
  302. \SeeAlso
  303. \seef{lnxp1}, \seef{log10},\seef{log2},\seef{logn}
  304. \end{function}
  305. \FPCexample{ex19}
  306. \begin{function}{lnxp1}
  307. \Declaration
  308. Function lnxp1(x : float) : float;
  309. \Description
  310. \var{Lnxp1} returns the natural logarithm of \var{1+X}. The result
  311. is more precise for small values of \var{x}. \var{x} should be larger
  312. than -1.
  313. \Errors
  314. If $x\leq -1$ then an \var{EInvalidArgument} exception will be raised.
  315. \SeeAlso
  316. \seef{ldexp}, \seef{log10},\seef{log2},\seef{logn}
  317. \end{function}
  318. \FPCexample{ex20}
  319. \begin{function}{log10}
  320. \Declaration
  321. Function log10(x : float) : float;
  322. \Description
  323. \var{Log10} returns the 10-base logarithm of \var{X}.
  324. \Errors
  325. If \var{x} is less than or equal to 0 an 'invalid fpu operation' error
  326. will occur.
  327. \SeeAlso
  328. \seef{ldexp}, \seef{lnxp1},\seef{log2},\seef{logn}
  329. \end{function}
  330. \FPCexample{ex21}
  331. \begin{function}{log2}
  332. \Declaration
  333. Function log2(x : float) : float;
  334. \Description
  335. \var{Log2} returns the 2-base logarithm of \var{X}.
  336. \Errors
  337. If \var{x} is less than or equal to 0 an 'invalid fpu operation' error
  338. will occur.
  339. \SeeAlso
  340. \seef{ldexp}, \seef{lnxp1},\seef{log10},\seef{logn}
  341. \end{function}
  342. \FPCexample{ex22}
  343. \begin{function}{logn}
  344. \Declaration
  345. Function logn(n,x : float) : float;
  346. \Description
  347. \var{Logn} returns the n-base logarithm of \var{X}.
  348. \Errors
  349. If \var{x} is less than or equal to 0 an 'invalid fpu operation' error
  350. will occur.
  351. \SeeAlso
  352. \seef{ldexp}, \seef{lnxp1},\seef{log10},\seef{log2}
  353. \end{function}
  354. \FPCexample{ex23}
  355. \begin{function}{max}
  356. \Declaration
  357. Function max(Int1,Int2:Cardinal):Cardinal;
  358. Function max(Int1,Int2:Integer):Integer;
  359. \Description
  360. \var{Max} returns the maximum of \var{Int1} and \var{Int2}.
  361. \Errors
  362. None.
  363. \SeeAlso
  364. \seef{min}, \seef{maxIntValue}, \seef{maxvalue}
  365. \end{function}
  366. \FPCexample{ex24}
  367. \begin{function}{maxIntValue}
  368. \Declaration
  369. function MaxIntValue(const Data: array of Integer): Integer;
  370. \Description
  371. \var{MaxIntValue} returns the largest integer out of the \var{Data}
  372. array.
  373. This function is provided for \delphi compatibility, use the \seef{maxvalue}
  374. function instead.
  375. \Errors
  376. None.
  377. \SeeAlso
  378. \seef{maxvalue}, \seef{minvalue}, \seef{minIntValue}
  379. \end{function}
  380. \FPCexample{ex25}
  381. \begin{function}{maxvalue}
  382. \Declaration
  383. Function maxvalue(const data : array of float) : float;
  384. Function maxvalue(const data : array of Integer) : Integer;
  385. Function maxvalue(const data : PFloat; Const N : Integer) : float;
  386. Function maxvalue(const data : PInteger; Const N : Integer) : Integer;
  387. \Description
  388. \var{Maxvalue} returns the largest value in the \var{data}
  389. array with integer or float values. The return value has
  390. the same type as the elements of the array.
  391. The third and fourth forms accept a pointer to an array of \var{N}
  392. integer or float values.
  393. \Errors
  394. None.
  395. \SeeAlso
  396. \seef{maxIntValue}, \seef{minvalue}, \seef{minIntValue}
  397. \end{function}
  398. \FPCexample{ex26}
  399. \begin{function}{mean}
  400. \Declaration
  401. Function mean(const data : array of float) : float;
  402. Function mean(const data : PFloat; Const N : longint) : float;
  403. \Description
  404. \var{Mean} returns the average value of \var{data}.
  405. The second form accepts a pointer to an array of \var{N} values.
  406. \Errors
  407. None.
  408. \SeeAlso
  409. \seep{meanandstddev}, \seep{momentskewkurtosis}, \seef{sum}
  410. \end{function}
  411. \FPCexample{ex27}
  412. \begin{procedure}{meanandstddev}
  413. \Declaration
  414. Procedure meanandstddev(const data : array of float;
  415. var mean,stddev : float);
  416. procedure meanandstddev(const data : PFloat;
  417. Const N : Longint;var mean,stddev : float);
  418. \Description
  419. \var{meanandstddev} calculates the mean and standard deviation of \var{data}
  420. and returns the result in \var{mean} and \var{stddev}, respectively.
  421. The second form accepts a pointer to an array of \var{N} values.
  422. \Errors
  423. None.
  424. \SeeAlso
  425. \seef{mean},\seef{sum}, \seef{sumofsquares}, \seep{momentskewkurtosis}
  426. \end{procedure}
  427. \FPCexample{ex28}
  428. \begin{function}{min}
  429. \Declaration
  430. Function min(Int1,Int2:Cardinal):Cardinal;
  431. Function min(Int1,Int2:Integer):Integer;
  432. \Description
  433. \var{min} returns the smallest value of \var{Int1} and \var{Int2};
  434. \Errors
  435. None.
  436. \SeeAlso
  437. \seef{max}
  438. \end{function}
  439. \FPCexample{ex29}
  440. \begin{function}{minIntValue}
  441. \Declaration
  442. Function minIntValue(const Data: array of Integer): Integer;
  443. \Description
  444. \var{MinIntvalue} returns the smallest value in the \var{Data} array.
  445. This function is provided for \delphi compatibility, use \var{minvalue}
  446. instead.
  447. \Errors
  448. None
  449. \SeeAlso
  450. \seef{minvalue}, \seef{maxIntValue}, \seef{maxvalue}
  451. \end{function}
  452. \FPCexample{ex30}
  453. \begin{function}{minvalue}
  454. \Declaration
  455. Function minvalue(const data : array of float) : float;
  456. Function minvalue(const data : array of Integer) : Integer;
  457. Function minvalue(const data : PFloat; Const N : Integer) : float;
  458. Function minvalue(const data : PInteger; Const N : Integer) : Integer;
  459. \Description
  460. \var{Minvalue} returns the smallest value in the \var{data}
  461. array with integer or float values. The return value has
  462. the same type as the elements of the array.
  463. The third and fourth forms accept a pointer to an array of \var{N}
  464. integer or float values.
  465. \Errors
  466. None.
  467. \SeeAlso
  468. \seef{maxIntValue}, \seef{maxvalue}, \seef{minIntValue}
  469. \end{function}
  470. \FPCexample{ex31}
  471. \begin{procedure}{momentskewkurtosis}
  472. \Declaration
  473. procedure momentskewkurtosis(const data : array of float;
  474. var m1,m2,m3,m4,skew,kurtosis : float);
  475. procedure momentskewkurtosis(const data : PFloat; Const N : Integer;
  476. var m1,m2,m3,m4,skew,kurtosis : float);
  477. \Description
  478. \var{momentskewkurtosis} calculates the 4 first moments of the distribution
  479. of valuesin \var{data} and returns them in \var{m1},\var{m2},\var{m3} and
  480. \var{m4}, as well as the \var{skew} and \var{kurtosis}.
  481. \Errors
  482. None.
  483. \SeeAlso
  484. \seef{mean}, \seep{meanandstddev}
  485. \end{procedure}
  486. \FPCexample{ex32}
  487. \begin{function}{norm}
  488. \Declaration
  489. Function norm(const data : array of float) : float;
  490. Function norm(const data : PFloat; Const N : Integer) : float;
  491. \Description
  492. \var{Norm} calculates the Euclidian norm of the array of data.
  493. This equals \var{sqrt(sumofsquares(data))}.
  494. The second form accepts a pointer to an array of \var{N} values.
  495. \Errors
  496. None.
  497. \SeeAlso
  498. \seef{sumofsquares}
  499. \end{function}
  500. \FPCexample{ex33}
  501. \begin{function}{popnstddev}
  502. \Declaration
  503. Function popnstddev(const data : array of float) : float;
  504. \Description
  505. \Errors
  506. \SeeAlso
  507. \end{function}
  508. \FPCexample{}
  509. \begin{function}{popnvariance}
  510. \Declaration
  511. Function popnvariance(const data : array of float) : float;
  512. \Description
  513. \Errors
  514. \SeeAlso
  515. \end{function}
  516. \FPCexample{}
  517. \begin{function}{power}
  518. \Declaration
  519. Function power(base,exponent : float) : float;
  520. \Description
  521. \var{power} raises \var{base} to the power \var{power}. This is equivalent
  522. to \var{exp(power*ln(base))}. Therefore \var{base} should be non-negative.
  523. \Errors
  524. None.
  525. \SeeAlso
  526. \seef{intpower}
  527. \end{function}
  528. \FPCexample{}
  529. \begin{function}{radtocycle}
  530. \Declaration
  531. Function radtocycle(rad : float) : float;
  532. \Description
  533. \Errors
  534. \SeeAlso
  535. \end{function}
  536. \FPCexample{}
  537. \begin{function}{radtodeg}
  538. \Declaration
  539. Function radtodeg(rad : float) : float;
  540. \Description
  541. \Errors
  542. \SeeAlso
  543. \end{function}
  544. \FPCexample{}
  545. \begin{function}{radtograd}
  546. \Declaration
  547. Function radtograd(rad : float) : float;
  548. \Description
  549. \Errors
  550. \SeeAlso
  551. \end{function}
  552. \FPCexample{}
  553. \begin{function}{randg}
  554. \Declaration
  555. Function randg(mean,stddev : float) : float;
  556. \Description
  557. \Errors
  558. \SeeAlso
  559. \end{function}
  560. \FPCexample{}
  561. \begin{procedure}{sincos}
  562. \Declaration
  563. Procedure sincos(theta : float;var sinus,cosinus : float);
  564. \Description
  565. \Errors
  566. \SeeAlso
  567. \end{procedure}
  568. \FPCexample{}
  569. \begin{function}{sinh}
  570. \Declaration
  571. Function sinh(x : float) : float;
  572. \Description
  573. \Errors
  574. \SeeAlso
  575. \end{function}
  576. \FPCexample{}
  577. \begin{function}{stddev}
  578. \Declaration
  579. Function stddev(const data : array of float) : float;
  580. \Description
  581. \Errors
  582. \SeeAlso
  583. \end{function}
  584. \FPCexample{}
  585. \begin{function}{sum}
  586. \Declaration
  587. Function sum(const data : array of float) : float;
  588. \Description
  589. \Errors
  590. \SeeAlso
  591. \end{function}
  592. \FPCexample{}
  593. var sum,sumofsquares : float);
  594. \begin{function}{sumofsquares}
  595. \Declaration
  596. Function sumofsquares(const data : array of float) : float;
  597. \Description
  598. \Errors
  599. \SeeAlso
  600. \end{function}
  601. \FPCexample{}
  602. \begin{procedure}{sumsandsquares}
  603. \Declaration
  604. Procedure sumsandsquares(const data : array of float;
  605. \Description
  606. \Errors
  607. \SeeAlso
  608. \end{procedure}
  609. \FPCexample{}
  610. \begin{function}{tan}
  611. \Declaration
  612. Function tan(x : float) : float;
  613. \Description
  614. \Errors
  615. \SeeAlso
  616. \end{function}
  617. \FPCexample{}
  618. \begin{function}{tanh}
  619. \Declaration
  620. Function tanh(x : float) : float;
  621. \Description
  622. \Errors
  623. \SeeAlso
  624. \end{function}
  625. \FPCexample{}
  626. \begin{function}{totalvariance}
  627. \Declaration
  628. Function totalvariance(const data : array of float) : float;
  629. \Description
  630. \Errors
  631. \SeeAlso
  632. \end{function}
  633. \FPCexample{}
  634. \begin{function}{variance}
  635. \Declaration
  636. Function variance(const data : array of float) : float;
  637. \Description
  638. \Errors
  639. \SeeAlso
  640. \end{function}
  641. \FPCexample{}