Changeset 1350 in Sophya for trunk/SophyaLib/Manual
- Timestamp:
- Nov 28, 2000, 11:18:54 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Manual/sophya.tex
r1347 r1350 486 486 in the HTML pages of the Sophya manual. 487 487 488 \subsection{Polynomial} 489 490 Polynomials of 1 or 2 variables are supported ({\tt Poly} and {\tt Poly2}). 491 Various operations are supported~: 492 \begin{itemize} 493 \item elementary operations between polynomials $(+,-,*,/) $ 494 \item setting or getting coefficients 495 \item computing the value of the polynomial for a given value 496 of the variable(s), 497 \item derivating 498 \item computing roots (degre 1 or 2) 499 \item fitting the polynomial to vectors of data. 500 \end{itemize} 501 Here is an example of polynomial fitting~: 502 \begin{verbatim} 503 #include "poly.h" 504 // ... 505 Poly pol(2); 506 pol[0] = 100.; pol[1] = 0.; pol[2] = 0.01; // Setting coefficients 507 TVector<r_8> x(100); 508 TVector<r_8> y(100); 509 TVector<r_8> ey(100); 510 for(int i=0;i<100;i++) { 511 x(i) = i; 512 ey(i) = 10.; 513 y(i) = pol((double) i) + ey(i)*NorRand(); 514 ey(i) *= ey(i) 515 } 516 517 TVector<r_8> errcoef; 518 Poly polfit; 519 polfit.Fit(x,y,ey,2,errcoef); 520 521 cout<<"Fit Result"<<polfit<<endl; 522 cout<<"Errors :"<<errcoef; 523 \end{verbatim} 524 525 Similar operations can be done on polynomials with 2 variables. 488 526 489 527 \section{Module Samba}
Note:
See TracChangeset
for help on using the changeset viewer.