close
標題:

用C program 寫微分(integration)的方法

免費註冊體驗

 

此文章來自奇摩知識+如有不便請留言告知

發問:

本人對c program不精 想發問如何用c program 寫微分數式 How to write the integration formular by c program For example, 怎樣才能寫到以下方程 in(|a^2| + |b^2| + |c^2|) 再者,假如要附加library library是何者? 望有心人答 之

最佳解答:

#include /* Propram to perform definite integration of a given function between two boundary limits input by user. Feel free to use and modify it, but please do not remove this comment. source: C for Engineering, http://c4engineering.hypermart.net */ #define N 1000 void main(void) { float i, a, b, sum = 0; printf("\nThis program will integrate a function between two boundary limits."); printf("\n\nEnter the first boundary limit:"); scanf("%f", &a); printf("\nEnter the second boundary limit:"); scanf("%f", &b); if(a > b) { i = a; a = b; b = i; } for(i = a; i < b; i += (b - a) / N) { /* Define your functionbelow, and include the suitable header files */ y = x * x + 2 * x - 4; sum += y * (b - a) / N; } printf("\n\nValue of integration is:%.3f", sum); getch(); return; }

其他解答:
arrow
arrow
    創作者介紹
    創作者 hzb53jl55v 的頭像
    hzb53jl55v

    hzb53jl55v的部落格

    hzb53jl55v 發表在 痞客邦 留言(0) 人氣()