Skip to content

Commit e138cc3

Browse files
committed
upd
1 parent 26b6d94 commit e138cc3

8 files changed

+1289
-1946
lines changed

1.Integration.ipynb

+2-649
Large diffs are not rendered by default.

2.Differentiation.ipynb 2a.DifferentialEQ-Ordinary.ipynb

+2-169
Original file line numberDiff line numberDiff line change
@@ -4,168 +4,8 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"## Numerical Methods: "
8-
]
9-
},
10-
{
11-
"cell_type": "markdown",
12-
"metadata": {},
13-
"source": [
14-
"1. Integration\n",
15-
"4. Differential Equations"
16-
]
17-
},
18-
{
19-
"cell_type": "markdown",
20-
"metadata": {},
21-
"source": [
22-
"### Integration [source](https://docs.scipy.org/doc/scipy/reference/tutorial/integrate.html)"
23-
]
24-
},
25-
{
26-
"cell_type": "code",
27-
"execution_count": 1,
28-
"metadata": {},
29-
"outputs": [],
30-
"source": [
31-
"import numpy as np\n",
32-
"from scipy.integrate import quad, dblquad, tplquad"
33-
]
34-
},
35-
{
36-
"cell_type": "markdown",
37-
"metadata": {},
38-
"source": [
39-
"$ y = mx +c$"
40-
]
41-
},
42-
{
43-
"cell_type": "code",
44-
"execution_count": 5,
45-
"metadata": {},
46-
"outputs": [
47-
{
48-
"name": "stdout",
49-
"output_type": "stream",
50-
"text": [
51-
"integral value = 6.499999999999999 , absolute error = 7.216449660063516e-14\n"
52-
]
53-
}
54-
],
55-
"source": [
56-
"def f(x):\n",
57-
" return 5*x + 4\n",
58-
"\n",
59-
"x_lower = 0 # the lower limit of x\n",
60-
"x_upper = 1 # the upper limit of x\n",
7+
"## Differentiation\n",
618
"\n",
62-
"val, abserr = quad(f, x_lower, x_upper)\n",
63-
"print(\"integral value =\", val, \", absolute error =\", abserr)"
64-
]
65-
},
66-
{
67-
"cell_type": "markdown",
68-
"metadata": {},
69-
"source": [
70-
"* Bessel function"
71-
]
72-
},
73-
{
74-
"cell_type": "code",
75-
"execution_count": 7,
76-
"metadata": {},
77-
"outputs": [],
78-
"source": [
79-
"from scipy.special import jn, yn, jn_zeros, yn_zeros"
80-
]
81-
},
82-
{
83-
"cell_type": "code",
84-
"execution_count": 8,
85-
"metadata": {},
86-
"outputs": [
87-
{
88-
"name": "stdout",
89-
"output_type": "stream",
90-
"text": [
91-
"0.7366751370811073 9.389126882496403e-13\n"
92-
]
93-
}
94-
],
95-
"source": [
96-
"def integrand(x, n):\n",
97-
"\n",
98-
" \"\"\"\n",
99-
" Bessel function of first kind and order n.\n",
100-
" \"\"\"\n",
101-
" return jn(n, x)\n",
102-
"\n",
103-
"x_lower = 0 # the lower limit of x\n",
104-
"x_upper = 10 # the upper limit of x\n",
105-
"val, abserr = quad(integrand, x_lower, x_upper, args=(3,))\n",
106-
"\n",
107-
"print(val, abserr)"
108-
]
109-
},
110-
{
111-
"cell_type": "markdown",
112-
"metadata": {},
113-
"source": [
114-
"* Gaussian function"
115-
]
116-
},
117-
{
118-
"cell_type": "code",
119-
"execution_count": 9,
120-
"metadata": {},
121-
"outputs": [
122-
{
123-
"name": "stdout",
124-
"output_type": "stream",
125-
"text": [
126-
"numerical = 1.7724538509027912 4.6261378229003154e-14\n",
127-
"analytical = 1.7724538509055159\n"
128-
]
129-
}
130-
],
131-
"source": [
132-
"val, abserr = quad(lambda x: np.exp(-x ** 2), -5.0, 5.0)\n",
133-
"print(\"numerical =\", val, abserr)\n",
134-
"analytical = np.sqrt(np.pi)\n",
135-
"print(\"analytical =\", analytical)"
136-
]
137-
},
138-
{
139-
"cell_type": "code",
140-
"execution_count": 11,
141-
"metadata": {},
142-
"outputs": [
143-
{
144-
"name": "stdout",
145-
"output_type": "stream",
146-
"text": [
147-
"0.7853981633974476 1.3753098510218528e-08\n"
148-
]
149-
}
150-
],
151-
"source": [
152-
"def integrand(x, y):\n",
153-
" return np.exp(-x**2-y**2)\n",
154-
"\n",
155-
"x_lower = 0\n",
156-
"x_upper = 10\n",
157-
"y_lower = 0\n",
158-
"y_upper = 10\n",
159-
"\n",
160-
"val, abserr = dblquad(integrand, x_lower, x_upper,\\\n",
161-
" lambda x : y_lower, lambda x: y_upper)\n",
162-
"print(val, abserr)"
163-
]
164-
},
165-
{
166-
"cell_type": "markdown",
167-
"metadata": {},
168-
"source": [
1699
"### Ordinary Differential Equations [Source](https://docs.scipy.org/doc/scipy/reference/tutorial/integrate.html)"
17010
]
17111
},
@@ -426,13 +266,6 @@
426266
"$\\large{Ax = b}$"
427267
]
428268
},
429-
{
430-
"cell_type": "markdown",
431-
"metadata": {},
432-
"source": [
433-
"-------"
434-
]
435-
},
436269
{
437270
"cell_type": "markdown",
438271
"metadata": {},
@@ -821,7 +654,7 @@
821654
"name": "python",
822655
"nbconvert_exporter": "python",
823656
"pygments_lexer": "ipython3",
824-
"version": "3.7.1"
657+
"version": "3.7.3"
825658
}
826659
},
827660
"nbformat": 4,

2b.DifferentialEQ-Partial.ipynb

+662
Large diffs are not rendered by default.

3.Interpolation.ipynb

+28-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
{
2-
"cells": [],
3-
"metadata": {},
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": []
9+
}
10+
],
11+
"metadata": {
12+
"kernelspec": {
13+
"display_name": "Python 3",
14+
"language": "python",
15+
"name": "python3"
16+
},
17+
"language_info": {
18+
"codemirror_mode": {
19+
"name": "ipython",
20+
"version": 3
21+
},
22+
"file_extension": ".py",
23+
"mimetype": "text/x-python",
24+
"name": "python",
25+
"nbconvert_exporter": "python",
26+
"pygments_lexer": "ipython3",
27+
"version": "3.7.3"
28+
}
29+
},
430
"nbformat": 4,
531
"nbformat_minor": 2
632
}

4.Optimization.ipynb

-765
This file was deleted.

0 commit comments

Comments
 (0)