├── Complex-Functions.html ├── README.md ├── Summation.PNG ├── Zeta-Function-EMS.py ├── Zeta-point05Resolution.PNG ├── complexback.PNG ├── critical-line.PNG └── zetaEMS.html /Complex-Functions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Complex Functions 4 | 5 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
43 |
44 |
45 | 46 | 47 | 51 | 52 |
48 | Complex Functions
49 | An attempt to plot them
Based on certain amazing animations
in a video at 3Blue1Brown
50 |
53 |
54 |
55 |
56 | 57 | 58 | 59 | 62 | 63 | 64 | 65 | 68 | 71 | 72 | 75 | 76 | 77 | 78 | 79 | 80 |
60 | Function Input 61 |
66 | Simple 67 | 69 | Summation 70 | 73 | Zeta 74 |
81 |
82 |
83 | 103 | 104 | 105 | 106 | 107 | 110 | 111 | 112 | 113 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 131 | 135 | 138 | 141 | 142 | 143 | 144 | 145 |
108 | Summation Term 109 |
114 | 115 | 116 |
129 | from (n = ) 130 | 132 | 133 | 134 | 136 | to (m = ) 137 | 139 | 140 |
146 |
147 |
148 | 149 | 150 | 151 | 154 | 155 | 156 |
152 | $$f(z) = \sum_{n=1}^{\infty} 2^{-n} = 1$$ 153 |
157 |
158 |
159 |
160 |
161 | 162 | 163 | 164 | 167 | 168 | 169 | 170 | 171 |
165 | 166 |
172 | 173 | 174 | 189 | 190 |
175 | 176 | 177 | 185 | 186 |
178 |
179 |
180 | 181 | 182 |
183 |
184 |
187 | 188 |
191 |
192 | 203 |
204 |
205 | 206 | 207 | 210 | 211 |
208 | Compute Transform Animation 209 |
212 | 213 |
214 |
215 | 216 | 217 | 218 | 221 | 222 | 227 | 230 | 231 | 234 | 235 | 238 | 239 | 240 |
219 | Play 220 | 223 |
224 |
225 | 226 |
228 | Final Result 229 | 232 | Edit Mesh 233 | 236 | DarkMode 237 |
241 |
242 |
243 |
244 | 245 | 246 | 247 | 250 | 251 | 252 | 253 |
248 | Made using Math.js, MathJax to visualize complex functions. Input point is in orange. If the complex function is a summation, then each term is a complex number which can be represented as a line. Sum of these lines added vectorially gives us the resulting output point in black. 249 |
254 |
255 |
256 | 303 | 304 | 305 | 306 | 309 | 310 | 311 | 313 | 314 | 315 |
307 | Summation Term Magnitudes 308 |
312 |
316 | 317 | 318 |
319 | 320 |
321 | 322 | 323 | 4648 | 4649 | 4650 | 4651 | 4652 | 4653 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Complex-Functions 2 | An [interactive](https://prajwalsouza.github.io/Experiments/Complex-Functions.html) for visualizing complex functions based on a [3Blue1Brown video](https://www.youtube.com/watch?v=sD0NjbwqlYw). 3 | Also, Riemann Zeta Function was estimated using Euler Maclaurin Summation. The code can be found [here](https://github.com/prajwalsouza/Complex-Functions/blob/master/zetaEMS.html). It is based on certain [methods mentioned in the work](https://math.dartmouth.edu/archive/m56s13/public_html/Nguyen_proj.pdf) of Hanh Nguyen. 4 | 5 | ### Some snapshots of the simulation 6 | 7 | **Plot of Riemann Zeta Function and the interface.** 8 | 9 | ![Plot of Riemann Zeta](https://github.com/prajwalsouza/Complex-Functions/blob/master/Zeta-point05Resolution.PNG "Plot of Riemann Zeta Function") 10 | 11 | **Summation of a Series as described in the 3Blue1Brown video** 12 | 13 | ![Summation](https://github.com/prajwalsouza/Complex-Functions/blob/master/Summation.PNG "Summation of a Series as described in the 3Blue1Brown video") 14 | 15 | **Plot of Zeta function along the critical line** 16 | 17 | ![Plot of Zeta along critical line](https://github.com/prajwalsouza/Complex-Functions/blob/master/critical-line.PNG "Plot of Zeta function along the critical line") 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Summation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prajwalsouza/Complex-Functions/138835a06706ac1796c4e1c452b99467db20fe97/Summation.PNG -------------------------------------------------------------------------------- /Zeta-Function-EMS.py: -------------------------------------------------------------------------------- 1 | from mpmath import mp 2 | from scipy import special 3 | 4 | # Computation of the Riemann Zeta Function 5 | # The following formula is based on Euler-Maclaurin Summation as mentioned in 6 | # https://math.dartmouth.edu/archive/m56s13/public_html/Nguyen_proj.pdf 7 | # which is the work of Hanh Nguyen. 8 | 9 | def zetaEMS(s, N, v): 10 | sum1 = mp.mpc(0) 11 | s = mp.mpc(s) 12 | for n in range(1, N): 13 | sum1 = sum1 + (n**(-s)) 14 | 15 | sum1 = sum1 + ((N**(1 - s))/mp.mpc(s - 1)) 16 | sum1 = sum1 + ((N**(-s))/mp.mpc(2)) 17 | 18 | sum2 = 0 19 | for k1 in range(1, v + 1): 20 | t1 = (bernoulli(2*k1)/mp.mpc(fact(2*k1))) 21 | prd = mp.mpc(1) 22 | for h in range(0, (2*k1) - 1): 23 | prd = prd*(s + mp.mpc(h)) 24 | t2 = prd 25 | t3 = N**(1 - s - (2*k1)) 26 | sum2 = sum2 + (t1*t2*t3) 27 | 28 | return sum1 + sum2 29 | 30 | # Bernoulli numbers calculated using Scipy's special function module 31 | 32 | def bernoulli(val): 33 | return special.bernoulli(val)[val] 34 | 35 | # Computing the factorial of a number 36 | 37 | def fact(d): 38 | pd = 1 39 | for a in range(1, d + 1): 40 | pd = pd*a 41 | 42 | return pd 43 | 44 | # Computing Combination nCr (Binomial Coefficients) 45 | 46 | def nCr(n, r): 47 | return mp.mpf(fact(n))/mp.mpf(fact(r)*fact(n - r)) 48 | 49 | 50 | complexinput = 0.5+14.13j 51 | output = zetaEMS(complexinput, N=100, v=100) 52 | # As mentioned in the work, N has to chosen to be of the order of magnitude of the complex input. But, here, I've chosen a large value. 53 | # value of v has been chosen depending on accuracy. (More than v = 100, bernoulli numbers are extremely high and can lead to errors) 54 | 55 | print("Input : ") 56 | print(complexinput) 57 | print("Zeta Function : ") 58 | print(output) 59 | -------------------------------------------------------------------------------- /Zeta-point05Resolution.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prajwalsouza/Complex-Functions/138835a06706ac1796c4e1c452b99467db20fe97/Zeta-point05Resolution.PNG -------------------------------------------------------------------------------- /complexback.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prajwalsouza/Complex-Functions/138835a06706ac1796c4e1c452b99467db20fe97/complexback.PNG -------------------------------------------------------------------------------- /critical-line.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/prajwalsouza/Complex-Functions/138835a06706ac1796c4e1c452b99467db20fe97/critical-line.PNG -------------------------------------------------------------------------------- /zetaEMS.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 74 | 75 | 76 | 77 | --------------------------------------------------------------------------------