6. ( ) .
: , :
x | 23,3 | 24,25 | 25,25 | 26,1 |
y |
:
#include <stdio.h>
#include <math.h>
#include <conio.h>
void interpol_Lagrang(int n, float x[n], float y[n], float q[n]);
int main(int argc, char **argv)
{
int n; //
int i; //
printf("\n uzlov interpoljacii n= ");
scanf("%d", &n);
float x[n], y[n]; //
float q[n]; //
//
//
printf("\nVvedite vector argumenta (%d znacheniy):\n", n);
for (i=0; i<n; i++)
scanf("%f", &x[i]);
printf("\n");
printf("\nVvedite vector funkcii (%d znacheniy):\n", n);
for (i=0; i<n; i++)
scanf("%f", &y[i]);
printf("\n");
Interpol_Lagrang(n, x, y, q);
printf("\nKoefficienty interpol. polinoma Lagranga po vozrast. stepeney:\n");
for (i=0; i<n; i++)
printf("%10.3f", q[i]);
printf("\n");
Return 0;
}
:
, :
29451,52 3499,265x + 138,406x2 1,799x3
, ,
:
- :
int Furie_interpol_analit(int n, float a[], float b[]);
- n ,
- :
float a[n]; // cos(), // (n+1 )
float b[n]; // sin(), // (n+1 )
- :
Furie_interpol_analit(n, a, b);
- ( ) .
float function(float x) f=f(x), :
Float function(float x)
{
Float f;
f=x*x;
if(x>M_PI)
f=(2.0*M_PI-x)*(2.0*M_PI-x);
Return f;
}
:
x2, x≤π,
f(x)=
(2π x), x>π.
:
f(x) = 3,289868 4/1! cos(x) + 4/2! cos(2x) 4/3! cos(3x) + 4/4! cos(4x) -
:
#include <stdio.h>
#include <math.h>
#include <conio.h>
int Furie_interpol_analit(int n, float a[], float b[]);
int main(int argc, char **argv)
{
int n; //
int i; //
printf("\n Kol-vo slagaem. n=");
scanf("%d", &n);
float a[n]; // cos(),
// (n+1 )
|
|
float b[n]; // sin(),
// (n+1 )