ОЧЕН СРОСНА (кто знает pascal,)

Discussion in 'Болталка' started by anti_sec2, 8 Dec 2008.

  1. anti_sec2

    anti_sec2 New Member

    Joined:
    18 Sep 2005
    Messages:
    14
    Likes Received:
    1
    Reputations:
    0
    помогите пожалуйста
    нужна составит прогу на pascale
    Решение СНАУ методом Ньютона
    пример x^3+2x^2+3x+5=0 задав точность e=0,001
    очен срочно плз help
     
  2. anti_sec2

    anti_sec2 New Member

    Joined:
    18 Sep 2005
    Messages:
    14
    Likes Received:
    1
    Reputations:
    0
    plz help
     
  3. Ch3ck

    Ch3ck Elder - Старейшина

    Joined:
    9 Jun 2006
    Messages:
    1,363
    Likes Received:
    1,190
    Reputations:
    430
    _http://forum.sources.ru/index.php?showtopic=252282
    и на Сипипи есть...
    Code:
    
          #include "iostream.h"
    
          #include "math.h"
    
          #include "stdlib.h"
    
           
    
          double f(double x)
    
          {
    
              return pow(x, 3)+2*pow(x, 2)+3*x+5;
     
          }
    
           
    
          double df(double x)
    
          {
    
            return 3*pow(x, 2)+4*x+3;
    
          }
    
           
    
          int main()
    
          {
    
            double eps = 0.001;
    
            double x = 0;
    
            while( fabs(f(x)) > eps )
    
            {
    
              x = x - f(x)/df(x);
    
            }
    
            cout << x << endl;
    
            system("pause");
    
            return 0;
          } 
    
     
    #3 Ch3ck, 8 Dec 2008
    Last edited: 8 Dec 2008
  4. anti_sec2

    anti_sec2 New Member

    Joined:
    18 Sep 2005
    Messages:
    14
    Likes Received:
    1
    Reputations:
    0
    Спасибо этот код у меня ест помоему это прога для решения x^3+2x^2+3x+5=0
    мне нужна на паскале
    ср3сл спасибо за хелп
    плз помогите на pascale
     
  5. P3L3NG

    P3L3NG Banned

    Joined:
    4 Jun 2008
    Messages:
    175
    Likes Received:
    204
    Reputations:
    11
    тож не откажусь :)
     
  6. P3L3NG

    P3L3NG Banned

    Joined:
    4 Jun 2008
    Messages:
    175
    Likes Received:
    204
    Reputations:
    11
    да мне тож такая прога пригодица.
    ЗЫ
    одна батарейка - 500 постов
     
  7. anti_sec2

    anti_sec2 New Member

    Joined:
    18 Sep 2005
    Messages:
    14
    Likes Received:
    1
    Reputations:
    0
    program Newtoon;

    uses crt;

    const
    n = 2;
    Nn = (n-1)*n/2;

    function Nuton(p: array of double; n: integer; x: array of double; Xx: double):double;
    var
    s:double;
    i:integer;
    begin
    s:=p[n-1];

    for i:=n-2 downto 0 do
    begin
    s:=p+(Xx-x)*s;
    end;
    Nuton:=s;
    end;

    procedure Nuton1(x: array of double;y: array of double;n:integer;p: array of double);
    var
    j,m,k,i,l: integer;

    begin
    for j:=0 to n-1 do
    begin
    p[j]:=(y[j+1]-y[j])/(x[j+1]-x[j]);
    write(p[j],' ');
    end;
    m := n-1;
    l:=2;

    for i:= n-2 downto 1 do
    begin
    k:=0;
    for j:= 1 to i do
    begin
    p[m]:=(p[m-i]-p[m-i-1])/(x[k+l]-x[k]);
    inc(m);
    inc(k);
    end;
    i:=i+1
    end;

    j:=0;
    for i:=1 to n-1 do
    begin
    y:=p[j];
    j:=j+(n-i);
    end;
    end;


    var
    x: array [1..5] of double;
    y: array [1..n] of double;
    i: integer;
    p: array [1..n] of double;
    z: double;
    begin
    for i:= 0 to n do
    begin
    y := 1+2*x+3*x*x+4*x*x*x+5*x*x*x*x;
    end;
    z:= 1.5;
    Nuton1(x,y,n,p);
    writeln(Nuton(y,n,x,z),' ', 1+2*z+3*z*z+4*z*z*z+5*z*z*z*z);
    readln;
    end.



    выдает ошибку встроке i:=i+1 [Error] Project2.dpr(46): Assignment to FOR-Loop variable 'i'
     
  8. anti_sec2

    anti_sec2 New Member

    Joined:
    18 Sep 2005
    Messages:
    14
    Likes Received:
    1
    Reputations:
    0
    cthlchu нечего обяснат ненадо проста дайте код проги
     
  9. P3L3NG

    P3L3NG Banned

    Joined:
    4 Jun 2008
    Messages:
    175
    Likes Received:
    204
    Reputations:
    11
    точку с запятой поставь ;)
    или юзай inc(i);
     
  10. anti_sec2

    anti_sec2 New Member

    Joined:
    18 Sep 2005
    Messages:
    14
    Likes Received:
    1
    Reputations:
    0
    точка тут непричем всеравно еррор [Error] Project2.dpr(47): Assignment to FOR-Loop variable 'i'
     
  11. mrTUZ

    mrTUZ Active Member

    Joined:
    17 May 2008
    Messages:
    63
    Likes Received:
    155
    Reputations:
    5
    Cthulchu, за 500 постов 1 батарейка дается
     
  12. Ponchik

    Ponchik Хлебо-булочное изделие

    Joined:
    30 Aug 2005
    Messages:
    687
    Likes Received:
    807
    Reputations:
    311
    ТС прыгни под машину =\
     
Loading...