Tips & Tricks – Elektromagnetisme http://elektromagnetisme.no The home of FYS1120 Mon, 20 Oct 2014 11:23:54 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.3 28429679 Equation sheet http://elektromagnetisme.no/2012/09/24/equation-sheet/ http://elektromagnetisme.no/2012/09/24/equation-sheet/#respond Mon, 24 Sep 2012 18:01:05 +0000 http://elektromagnetisme.no/?p=1564 Continue reading ]]> We have put together an equation sheet that you will be handed on the mid-term and final exam. The sheet is not complete, so please be aware of errors and missing equations, and check in here frequently to download the latest version.

If you miss something that you would like to have included in the equation sheet, don’t hesitate to ask us to include it. (We can’t guarantee that we’ll accept any proposal, though.)

 

]]>
http://elektromagnetisme.no/2012/09/24/equation-sheet/feed/ 0 1564
Online lectures from MIT with Walter Lewin http://elektromagnetisme.no/2012/09/18/online-lectures-from-mit-with-walter-lewin/ http://elektromagnetisme.no/2012/09/18/online-lectures-from-mit-with-walter-lewin/#respond Tue, 18 Sep 2012 14:47:05 +0000 http://elektromagnetisme.no/?p=1503 Continue reading ]]>

If you have missed out on some of the lectures or feel you could need a second view on some subjects, we recommend having a look at Walter Lewin’s lectures from MIT:

Our syllabus is not the same as in their course, but some lectures are very relevant. For instance there are lectures on Gauss law, electric flux, magnetism and much more that will follow in our course too.

Spending some time watching a few lectures when you have spare time or are tired of reading can help you grasp concepts that you find hard to understand. It could also be very inspiring!

Should you find some lectures especially useful, don’t forget to tip your fellow students about it by leaving a comment below.

]]>
http://elektromagnetisme.no/2012/09/18/online-lectures-from-mit-with-walter-lewin/feed/ 0 1503
Note on RLC circuits http://elektromagnetisme.no/2011/11/30/note-on-rlc-circuits/ http://elektromagnetisme.no/2011/11/30/note-on-rlc-circuits/#comments Wed, 30 Nov 2011 14:07:17 +0000 http://mindseye.no/?p=1102 Continue reading ]]> Atle has written very helpful note on RLC circuits that could be pretty useful as a repetition before the exam. The book is not soo thorough on how to work with RLC circuits and does some parts of the text on specialized cases that are not necessarily working out in general. Reading about how to solve such circuits in the final pages of this note can turn out extremely valuable on the exam.

Enjoy!

]]>
http://elektromagnetisme.no/2011/11/30/note-on-rlc-circuits/feed/ 7 1102
Note on the magnetic vector potential http://elektromagnetisme.no/2011/10/27/note-on-the-magnetic-vector-potential/ http://elektromagnetisme.no/2011/10/27/note-on-the-magnetic-vector-potential/#respond Wed, 26 Oct 2011 22:29:56 +0000 http://mindseye.no/?p=992 Continue reading ]]>

Magnetic dipole (Source: Wikipedia*)

In electrostatics we found it very convenient to introduce the concept of the electric potential. It gave us a straight forward way of calculating electric fields without doing any vector calculations or using any symmetry arguments. Can we introduce something similar for magnetic fields?  It turns out that because magnetic fields are divergence less we can find a vector potential who’s curl gives us the magnetic field! Even though this magnetic vector potential is not as useful as the electrostatic potential in elementary applications, it turns out to be of major importance in electrodynamics as well as classical mechanics and quantum mechanics. It might therefore be a good idea to get familiar with the concept and some of it’s properties already, especially if you are taking a degree in physics. In this note I explain how to find the vector potential, the concept of a gauge transformation and it’s fundamental equations relating it to currents in both electrostatics and electrodynamics. Read more here:

* Image found at http://en.wikipedia.org/wiki/File:VFPt_dipole_magnetic3.svg / CC BY-SA 3.0

]]>
http://elektromagnetisme.no/2011/10/27/note-on-the-magnetic-vector-potential/feed/ 0 992
Magnetic fields from solenoids http://elektromagnetisme.no/2011/10/24/magnetic-fields-from-solenoids/ http://elektromagnetisme.no/2011/10/24/magnetic-fields-from-solenoids/#respond Mon, 24 Oct 2011 18:27:01 +0000 http://mindseye.no/?p=977 Continue reading ]]> Finn Ravndal has written a note on the magnetic field from solenoids. In this note Finn explains how to calculate the field at different points in space around and inside the solenoid. This can come in very handy for those of you who still feel a bit unfamiliar with the concept and for those who want to learn a bit more.

Notat om spoler

]]>
http://elektromagnetisme.no/2011/10/24/magnetic-fields-from-solenoids/feed/ 0 977
SyntaxError: Non-ASCII character http://elektromagnetisme.no/2011/09/17/syntaxerror-non-ascii-character/ http://elektromagnetisme.no/2011/09/17/syntaxerror-non-ascii-character/#respond Sat, 17 Sep 2011 11:27:38 +0000 http://mindseye.no/?p=859 Continue reading ]]> There are probably going to be a few things to watch out for in the oblig. One of these is characters not being copied correctly from the source code in the note on Jacobi’s method. A common error that Python will spew out in this case is

SyntaxError: Non-ASCII character '\xe2' in file ... on line 40, 
but no decoding declared ...

This is caused by the apostrophe ‘ being incorrectly replaced as a quotation mark ` during copying. The difference is very subtle, but for Python there is a huge difference; The apostrophe is completely legal to indicate a text string. The quotation mark is not.

The solution is to replace the offending quotation marks with apostrophes (the latter is found on the *-button on Norwegian keyboards) or to simply copy the source code manually instead.

Also, do watch out for whitespaces sneaking into your source code while copying.

Sadly, there is often many errors like these that show up when copying source code from PDF’s. Make sure you verify that the source code is the same after copying.

]]>
http://elektromagnetisme.no/2011/09/17/syntaxerror-non-ascii-character/feed/ 0 859
Using Mayavi’s contour3d function http://elektromagnetisme.no/2011/09/12/using-mayavis-contour3d-function/ http://elektromagnetisme.no/2011/09/12/using-mayavis-contour3d-function/#respond Mon, 12 Sep 2011 20:16:46 +0000 http://mindseye.no/?p=809 Continue reading ]]> The Mayavi library that we’re using in this years course holds a great amount of functions to plot 3D and 2D data. Among these is the contour3d function that is very useful to plot equipotential surfaces in 3D space. This could for instance be used to plot a potential. In the exercise set from week 3, you may use this to visualize the potential inside and outside a uniformly charged sphere.

The solution program for this exercise is shown below:

from numpy import *
from enthought.mayavi.mlab import *

x,y,z = mgrid[-100:101:5., -100:101:5., -100:101:5.]
R = 40
Q = 1.0

r = sqrt(x**2 + y**2 + z**2)
V = 0*x
for i in range(len(r)):
    for j in range(len(r)):
        for k in range(len(r)):
            if r[i][j][k] < R:
                V[i][j][k] = Q / (8 * pi * R) * (3 - r[i][j][k]**2/R**2)
            else:
                V[i][j][k] = Q / (4 * pi * r[i][j][k])

contour3d(x, y, z, V, contours=20, opacity=0.5)

Note that we are setting contours=20 to have 20 equipotential surfaces and opacity=0.5 to be able to see through the surfaces. Otherwise we would only be able to see the outermost surface. You can read more about these and other settings by typing “help contour3d” in IPython (after importing mayavi) or by looking at the online reference.

The result is shown in the figure below:

A close up of the potential from a uniformly charged sphere. The rings are spherical shells coloured according to the level of the potential. They are semi-transparent, so that you can see the inner shells (the orange is the innermost shell.)

Do you see how the potential rises and lowers quickly close to the edge of the sphere? The edge of the sphere is located approximately where the color goes from yellow-ish to green. What does this tell you about the field in this area?

]]>
http://elektromagnetisme.no/2011/09/12/using-mayavis-contour3d-function/feed/ 0 809
Calculating the gradient in Python http://elektromagnetisme.no/2011/09/12/calculating-the-gradient-in-python/ http://elektromagnetisme.no/2011/09/12/calculating-the-gradient-in-python/#respond Mon, 12 Sep 2011 18:43:44 +0000 http://mindseye.no/?p=790 Continue reading ]]> The NumPy package in Python serves us with a huge selection of useful functions for working with all kinds of numerical problems. One such function is gradient(V), that takes in a mgrid based matrix V and returns three mgrid matrices for each component of the gradient.

For instance, if you have the electric potential as a function of x, y and z, you can use NumPy’s gradient function to find the electric field through the relation \mathbf E = - \nabla V. An example of this is shown below:

from numpy import *
from enthought.mayavi.mlab import *

x,y,z = mgrid[-100:101:25., -100:101:25., -100:101:25.]

V = 2*x**2 + 3*y**2 - 4*z # just a random function for the potential

Ex,Ey,Ez = gradient(V)
Ex = - Ex
Ey = - Ey
Ez = - Ez

quiver3d(x,y,z,Ex,Ey,Ez) # plot the electric field just for fun

Note that this potential is random and not necessarily something you would find in a real electromagnetic problem. The resulting electric field is shown below:

The field generated from using NumPy's gradient function on our random potential.

 

]]>
http://elektromagnetisme.no/2011/09/12/calculating-the-gradient-in-python/feed/ 0 790