Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Diferenciacion e integracion beta 0.1
//g++ 5.4.0 #include<math.h> #include <iostream> #include <iomanip> #include<stdlib.h> #include<stdio.h> #include<vector> using namespace std; int programa3(); int diferencias(vector<double>,vector<double>,int); int llenar_datos(vector<double>,vector<double>,int); int main() { cout<<fixed<<setprecision(6); programa3(); } int programa3(){ int t; vector<double> x(1); vector<double> fx(1); double h; cin>>t; llenar_datos(x,fx,t); diferencias(x,fx,t); } int llenar_datos(vector<double> x,vector<double> fx ,int t){ double d1, d2; cout<<"Hola"; x.resize(t); fx.resize(t); x.clear(); fx.clear(); for(int i=0; i<t; i++){ cin>>d1; cin>>d2; x[i]=d1; fx[i]=d2; } } int diferencias(vector<double> x,vector<double> fx ,int t){ vector<double> dif,dif2; double d1, d2, h, a, b; cin>>a; cin>>b; dif.clear(); dif2.clear(); dif.resize(t); dif2.resize(t); h=x[1]-x[0]; for(int i=1; i<t-1; i++){ dif[i]=(fx[i+1]-fx[i-1])/(2*h); dif2[i]=(fx[i+1]-2*fx[i]+fx[i-1])/(h*h); } cout<<"-----------------------------------------\n"; cout<<"|x |"<<"f(x) |"<<"f'(x) |"<<"f''(x) |"<<"\n"; cout<<"-----------------------------------------\n"; for(int i=0; i<t; i++){ cout<<"|"<<x[i]<<" |"<<fx[i]<<" |"; if(x[i] >= a and x[i] <= b) cout<<dif[i]<<" |"<<dif2[i]<<"|\n"; else cout<<" | |\n"; } cout<<"-----------------------------------------\n"; }
run
|
edit
|
history
|
help
0
PreDir
Nadpisanie metod
Bind Function
PhB
override
F-Random Strings
LP(Multi)
RuntimeError
break.cpp
Such case