# 4.1 数值积分、高等函数绘制

[郑重声明]，本文大量引用了维基百科内容。

is defined informally as the signed area of the region in the xy-plane that is bounded by the graph of f, the x-axis and the vertical lines x = a and x = b. The area above the x-axis adds to the total and that below the x-axis subtracts from the total. The operation of integration, up to an additive constant, is the inverse of the operation of differentiation. For this reason, the term integral may also refer to the related notion of the antiderivative, a function F whose derivative is the given function f. In this case, it is called an indefinite integral and is written:

The integrals discussed in this article are those termed definite integrals. It is the fundamental theorem of calculus that connects differentiation with the definite integral: if f is a continuous real-valued function defined on a closed interval [a, b], then, once an antiderivative F of f is known, the definite integral of f over that interval is given by

The principles of integration were formulated independently by Isaac Newton and Gottfried Wilhelm Leibniz in the late 17th century, who thought of the integral as an infinite sum of rectangles of infinitesimal width. Bernhard Riemann gave a rigorous mathematical definition of integrals. It is based on a limiting procedure that approximates the area of a curvilinear region by breaking the region into thin vertical slabs. Beginning in the nineteenth century, more sophisticated notions of integrals began to appear, where the type of the function as well as the domain over which the integration is performed has been generalised. A line integral is defined for functions of two or more variables, and the interval of integration [a, b] is replaced by a curve connecting the two endpoints. In a surface integral, the curve is replaced by a piece of a surface in three-dimensional space.

```1. var Fun=function(x){ //函数
2.  return Math.sqrt(1-x*x);
3. }```

```1. var calculous=function(fun,start,end,nDivided){
2.  var x,dx=(end-start)/nDivided;
3.  for(varsum=0,i=0;i<nDivided;i++){
4.       x=start+(i+0.5)*dx;
5.       sum+=dx*Fun(x);
6.    }
7.  return sum;
8. }```

```1. <!DOCTYPEhtml>
2. <htmlstyle="height: 100%">
4.        <metacharset="utf-8">
6.    <bodystyle="height: 100%; margin: 0">
7.        <divid="container" style="height: 100%"></div>
8.        <scripttype="text/javascript">
9.
10. var Fun=function(x){ //函数
11.  return Math.sqrt(1-x*x);
12. }
13.
14. var calculous=function(fun,start,end,nDivided){
15.  var x,dx=(end-start)/nDivided;
16.  for(varsum=0,i=0;i<nDivided;i++){
17.       x=start+(i+0.5)*dx;
18.       sum+=dx*Fun(x);
19.    }
20.  return sum;
21. }
22.
23. console.log("分割10次的计算结果：",calculous(Fun,0,1,10));
24. console.log("分割100次的计算结果：",calculous(Fun,0,1,100));
25. console.log("分割200次的计算结果：",calculous(Fun,0,1,200));
26. console.log("分割1000次的计算结果：",calculous(Fun,0,1,1000));
27. console.log("标准答案是：",Math.PI/4);
28.
29.        </script>
30.    </body>
31. </html>```

81 篇文章12 人订阅

0 条评论

## 相关文章

38190

57440

### 机器学习/深度学习代码速查：6大工具库 &27种神经网络图览

Kailash Ahirwar，Mate Lab 联合创始人，Github的一位资深作者，也是一位活雷锋，近日在其Github个人主页上发表了一个机器学习/深度...

52250

### 1775. [国家集训队2010]小Z的袜子

【题目描述】     作为一个生活散漫的人，小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天，小Z再也无法忍受这恼人的找袜子过程，于是他...

36760

### 牛顿法(Newton Method)求解f(x)=0

https://en.wikipedia.org/wiki/Newton%27s_method

33590

### 绘图: matplotlib核心剖析

matplotlib是基于Python语言的开源项目，旨在为Python提供一个数据绘图包。我将在这篇文章中介绍matplotlib API的核心对象，并介绍如...

23570

9120

12330

222100

363100