8spl0.c

来自「C语言描述的常用数值算法程序集」· C语言 代码 · 共 24 行

C
24
字号

  #include "8spl.c"
  #include "stdio.h"
  main()
  { int k,n;
    double t;
    static double x[11]={-1.0,-0.95,-0.75,-0.55,-0.3,0.0,
                         0.2,0.45,0.6,0.8,1.0};
    static double y[11]={0.0384615,0.0424403,0.06639,0.116788,
           0.307692,1.0,0.5,0.164948,0.1,0.0588236,0.0384615};
    static double s[5];
    k=-1; n=11;
    printf("\n");
    t=-0.85; spl(x,y,n,k,t,s);
    printf("x=%6.3f,   f(x)=%e\n",t,s[4]);
    printf("s0=%e, s1=%e, s2=%e, s3=%e\n",s[0],s[1],s[2],s[3]);
    printf("\n");
    t=0.15; spl(x,y,n,k,t,s);
    printf("x=%6.3f,   f(x)=%e\n",t,s[4]);
    printf("s0=%e, s1=%e, s2=%e, s3=%e\n",s[0],s[1],s[2],s[3]);
    printf("\n");
  }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?