Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
FindMissingLagrange
//g++ 7.4.0 //Interpolation: Lagrange Method //code is created by Rezaul Hoque on January 13 , 2021 //please contact at jewelmrh@yahoo.com //if x advances by unequal interval then Lagrange method is used for interpolation #include <iostream> using namespace std; int main () { int n=5; float x[n]={0,2,3,5,6}; float y[n]={5,7,8,10,12}; float corrX, missY; corrX=4; missY =( y[0]*(corrX-x[1])*(corrX-x[2])*(corrX-x[3])*(corrX-x[4]))/((x[0]-x[1])*(x[0]-x[2])*(x[0]-x[3])*(x[0]-x[4])) + ( y[1]*(corrX-x[0])*(corrX-x[2])*(corrX-x[3])*(corrX-x[4]))/((x[1]-x[0])*(x[1]-x[2])*(x[1]-x[3])*(x[1]-x[4])) + ( y[2]*(corrX-x[1])*(corrX-x[0])*(corrX-x[3])*(corrX-x[4]))/((x[2]-x[1])*(x[2]-x[0])*(x[2]-x[3])*(x[2]-x[4])) + ( y[3]*(corrX-x[1])*(corrX-x[2])*(corrX-x[0])*(corrX-x[4]))/((x[3]-x[1])*(x[3]-x[2])*(x[3]-x[0])*(x[3]-x[4]))+( y[4]*(corrX-x[1])*(corrX-x[2])*(corrX-x[3])*(corrX-x[0]))/((x[4]-x[1])*(x[4]-x[2])*(x[4]-x[3])*(x[4]-x[0])); cout <<"The missing y is "<<missY<<endl; return 0; }
run
|
edit
|
history
|
help
0
odws
IceCream
Triangle
CPP - Ex 5
fibonacci
410
container access all elements
Filtering a vector attribute with template UnaryPredicate
char
Zadanie Kolokwium_2011_z4