Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //WIELOPUNKTOWA
- #include <iostream>
- #include <cmath>
- using namespace std;
- double rownanie(double x);
- double pochodna(double x);
- double wzor(double x);
- int main()
- {
- cout<<"Wielopunktowa"<<endl;
- double x,e,h;
- int l=0;
- cout<<"Podaj x: ";cin>>x;cout<<endl;
- cout<<"Podaj e: ";cin>>e;cout<<endl;
- do
- {
- h=wzor(x);
- x=x+h;
- l++;
- }while(fabs(h)>=e);
- cout.precision(16);
- cout<<"Punkt: "<<x<<endl;
- cout<<"Ilosc krokow: "<<l<<endl;
- //cout<<"Blad: "<<fabs(x-)/fabs(x)<<endl;
- return 0;
- }
- double rownanie(double x)
- {
- return (x*(exp(x)))-pow(x,2.);//e
- }
- double pochodna(double x)
- {
- return (exp(x)*(x+1))-(2*x);
- //return x*((exp(x))*x*(x+3.)-2.);
- }
- double wzor(double x)//5
- {
- double u=rownanie(x)/pochodna(x);
- return -((u/(1.*(2.*pochodna(x)))*(3.*pochodna(x)-pochodna(x-u))));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement