计算物理第12次作业

Name: 贺一珺
Student Number: 2014302290002

Question

  • 5.1 Solve for the potential in the prism geometry in Figure 5.4.
  • 5.4 Investigate how the magnitude of the fringing field of a parallel plate capacitor, that is, the electric field outside the central region of the capacitor in Figure 5.6, varies as a function of the plate seperation.
  • 5.6 Calculate the electric potential and field near a lightning rod. Model this as a very long and narrow metal rod held at a high voltage, with one end near a conducting plane. Of special interest is the field near the tip of the rod.
  • 5.7 Write two progrems to solve the capacitor problem of Figure 5.6 and 5.7, one using the Jacobi method and one using the SOR algorithm. For a fixed accuracy compare the number of iterations, N_iter, that each algorithm requires as a function of the number of grid elements, L. Show that for the Jacobi method N_iter ~ L^2, while with SOR N_iter ~ L.

Abstract

In last chapter I calculated the trejectory of planets and analys several conditions that lead to chaos. In this chapter I will try to use python to solve several diffrential equations under different boundary conditions.
The potential in space satisfies the Laplace equation:

Laplace equation

Given specific boundary conditions, we can work out the eqaution analytically. However, the boundary conditions in the real world has never been that easy. Thus we need to find numberical ways to solve the problem. In this chapter we learned that in 2-dimensional cases, the whole space can be approximate as a net and the value on each point is the average of the volue of its surrending points.
In this homework, I will try to use Jacobi method, Gauss-Seidel method and simultaneous over-relaxation method which increase the speed of approximation.

Background

Relaxation (iterative method)

In numerical mathematics, relaxation methods are iterative methods for solving systems of equations, including nonlinear systems.

Relaxation methods were developed for solving large sparse linear systems, which arose as finite-difference discretizations of differential equations. They are also used for the solution of linear equations for linear least-squares problems and also for systems of linear inequalities, such as those arising in linear programming. They have also been developed for solving nonlinear systems of equations.

Relaxation methods are important especially in the solution of linear systems used to model elliptic partial differential equations, such as Laplace's equation and its generalization, Poisson's equation. These equations describe boundary-value problems, in which the solution-function's values are specified on boundary of a domain; the problem is to compute a solution also on its interior. Relaxation methods are used to solve the linear equations resulting from a discretization of the differential equation, for example by finite differences.

These iterative methods of relaxation should not be confused with "relaxations" in mathematical optimization, which approximate a difficult problem by a simpler problem, whose "relaxed" solution provides information about the solution of the original problem.

Jacobi method

In numerical linear algebra, the Jacobi method (or Jacobi iterative method) is an algorithm for determining the solutions of a diagonally dominant system of linear equations. Each diagonal element is solved for, and an approximate value is plugged in. The process is then iterated until it converges. This algorithm is a stripped-down version of the Jacobi transformation method of matrix diagonalization.

Gauss–Seidel method

In numerical linear algebra, the Gauss–Seidel method, also known as the Liebmann method or the method of successive displacement, is an iterative method used to solve a linear system of equations. It is named after the German mathematicians Carl Friedrich Gauss and Philipp Ludwig von Seidel, and is similar to the Jacobi method. Though it can be applied to any matrix with non-zero elements on the diagonals, convergence is only guaranteed if the matrix is either diagonally dominant, or symmetric and positive definite.

Plotting

(For concenience, small changes of my code will not be shown here.)

5.1

Here is code1
Here is code2

I use Gauss-Seidel to do this calculation and here I get the result:
The potential is:

Electrical potential

Here is the 3D picture:


3D plotting

And here I get the electric field:


Electric field

5.4

Here is code

I use Gauss-Seidel to do this calculation and here I get the result:

Plate seperation: 0.6

The potential is:

Electrical potential

Here is the 3D picture:

3D plotting

And here I get the electric field:

Electric field
Plate seperation: 0.4
Electrical potential

Here is 3D picture:

3D plotting
Plate seperation: 0.1

Here is electric potential:

potential

3D plotting:

3D plotting
Plate seperation: 0.5

Here is electric potential:

potential

Here is 3D picture:

3D plotting

5.6

Here is code1
Here is code2
Here is the electric potential:

Electric potential

Here is 3D picture:

3D plotting

Here is electric field:

Electric field

5.7

Here is code
Now I will compare the G-S method and SOR method:

Comparasion

It can be easily concluded from this picture that the speed of converence of SOR method is significantly better than that of Gauss-Seidel method.

Acknowledgement

  • Prof. Cai
  • Yuqiao Wu
  • wikipedia

How to contect me?

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,928评论 6 509
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,748评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,282评论 0 357
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,065评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,101评论 6 395
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,855评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,521评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,414评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,931评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,053评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,191评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,873评论 5 347
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,529评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,074评论 0 23
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,188评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,491评论 3 375
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,173评论 2 357

推荐阅读更多精彩内容

  • 文/素心说 2006年,有个人从我家里走了就没再回来过;十年后,又一个人来了家里再也不会走了。 06年离开的那个人...
    素心说阅读 440评论 3 10
  • 怀着一颗犹疑的心。 这是就要奔向远方了么。 一辈子的生活,要怎么计划,未来怎样发展,我好像从来没想过。 这世上最难...
    梵谷脸谱阅读 469评论 0 51
  • 那时你一头乌发 夜晚倒扣在你的脸上 两颗星辰闪烁 灰色的泥巴长在脚上 紧紧抓住那一方土地 为了温饱 后来在家乡的稻...
    何圳鑫阅读 156评论 0 0