fork(2) download
  1. Program RINDA;
  2. uses crt;
  3. var X, S, Y, A : real;
  4. k : integer;
  5. begin
  6. writeln(' Rekinam funkcijas y= x * Exp(-2*x) ');
  7. writeln(' Vertibas diapazona -3 ... 3 ar soli 0.25 ');
  8. writeln(' x Rinda Standartfunkcija Loc. skaits rindaa');
  9.  
  10. x:= -3;
  11. while x<= 3 do // veertibu intervals no -3 lidz 3
  12. begin
  13. S:=1-2*x*x; // n2 vertiba ar +1 elements
  14. A:= -2*x*x; // tikai n2 vertiba
  15. k:=3;
  16. while ABS (A)> 0.0001 do
  17. begin
  18. A:= -A*(2*x/(k-1)); //Algoritms, kas apreekina nakamo A vertibu
  19. S:=S+A; //Summeejums S+ algortims A
  20. k:=1+k; //N vertiba +1
  21. End;
  22. y:=x*Exp(-2*x);
  23. writeln(x:6:2, S:18:6, Y:18:6, k:12);
  24. x:=x+0.25 // SOLIS pa cik iet vertibas
  25. End;
  26. readkey;
  27. End.
Success #stdin #stdout 0.01s 252KB
stdin
Standard input is empty
stdout
 Rekinam funkcijas y= x * Exp(-2*x)        
 Vertibas diapazona  -3 ... 3 ar soli 0.25  
  x            Rinda      Standartfunkcija    Loc. skaits rindaa
 -3.00      -1206.286350      -1210.286380          25
 -2.75       -669.152799       -672.902814          24
 -2.50       -367.532868       -371.032898          22
 -2.25       -199.288532       -202.538545          21
 -2.00       -106.196273       -109.196300          19
 -1.75        -55.202030        -57.952041          18
 -1.50        -27.628285        -30.128305          16
 -1.25        -12.978111        -15.228117          15
 -1.00         -5.389046         -7.389056          13
 -0.75         -1.611253         -3.361267          11
 -0.50          0.140873         -1.359141           9
 -0.25          0.837826         -0.412180           7
  0.00          1.000000          0.000000           3
  0.25          0.901628          0.151633           7
  0.50          0.683929          0.183940           9
  0.75          0.417337          0.167348          11
  1.00          0.135328          0.135335          13
  1.25         -0.147398          0.102606          15
  1.50         -0.425306          0.074681          16
  1.75         -0.697147          0.052845          18
  2.00         -0.963386          0.036631          19
  2.25         -1.225014          0.024995          21

  2.50         -1.483136          0.016845          22

  2.75         -1.738752          0.011239          24

  3.00         -1.992582          0.007436          25