<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The ILNumerics Blog &#187; Quantum Mechanics</title>
	<atom:link href="https://ilnumerics.net/blog/tag/quantum-mechanics/feed/" rel="self" type="application/rss+xml" />
	<link>https://ilnumerics.net/blog</link>
	<description>The Productivity Machine  &#124;  A fresh attempt for scientific computing  &#124;  http://ilnumerics.net</description>
	<lastBuildDate>Thu, 05 Dec 2024 09:09:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title>ILNumerics for Scientists &#8211; Going 3D</title>
		<link>https://ilnumerics.net/blog/ilnumerics-for-scientists/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-for-scientists/#comments</comments>
		<pubDate>Tue, 20 Jan 2015 15:38:39 +0000</pubDate>
		<dc:creator><![CDATA[Jonas]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Interesting/ useless]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[Visualization]]></category>
		<category><![CDATA[3d visualization]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[Getting Started]]></category>
		<category><![CDATA[Quantum Mechanics]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=761</guid>
		<description><![CDATA[<p>Recap Last time I started with one of the easiest problems in quantum mechanics: the particle in a box. This time I’ll add 1 dimension and we’ll see a particle in a 2D box. To visualize its wave function and density we need 3D surface plots. 2D Box This time we have a particle that &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-for-scientists/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics for Scientists &#8211; Going 3D</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists/">ILNumerics for Scientists &#8211; Going 3D</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h3>Recap</h3>
<p style="text-align: justify;"><a title="ILNumerics for Scientists – An easy start" href="http://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/">Last time </a>I started with one of the easiest problems in quantum mechanics: the particle in a box. This time I’ll add 1 dimension and we’ll see a particle in a 2D box. To visualize its wave function and density we need 3D surface plots.</p>
<h3>2D Box</h3>
<p style="text-align: justify;">This time we have a particle that is confined in a 2D box. The potential within the box is zero and outside the box infinity. Again the solution is well-known and can be found on <a href="https://en.wikipedia.org/wiki/Particle_in_a_box">Wikipedia</a>. This time the state of the wave function is determined by two numbers. These are typically called quantum numbers and refer to the X and the Y direction, respectively.</p>
<p style="text-align: justify;">The absolute size of the box doesn’t really matter and we didn’t worry about it in the 1D case. However, the relative size of the length and the width make a difference. The solution to our problem reads</p>
<p style="text-align: center;">$\Psi_{n,k}(x,y) = \sqrt{\frac{4}{L_x L_y}} \cdot \sin(n \cdot \pi \cdot x / L_x) \cdot \sin(k \cdot \pi \cdot y / L_y)$</p>
<h3>The Math</h3>
<p style="text-align: justify;">Very similar to the 1D case I quickly coded the wave function and the density for further plotting. I had to make sure that the arrays are fit for 3D plotting, so the code looks a little bit different compared to last post’s</p>
<pre class="brush: csharp; title: ; notranslate">
     public static ILArray&lt;double&gt; CalcWF(int EVXID, int EVYID, double LX, double LY, int MeshSize)
     {
        ILArray&lt;double&gt; X = linspace&lt;double&gt;(0, LX, MeshSize);
        ILArray&lt;double&gt; Y = linspace&lt;double&gt;(0, LY, MeshSize);

        ILArray&lt;double&gt; Y2d = 1;
        ILArray&lt;double&gt; X2d = meshgrid(X, Y, Y2d);

        ILArray&lt;double&gt; Z = sqrt(4.0 / LX / LY) * sin(EVXID * pi * X2d / LX) * sin(EVYID * pi * Y2d / LY);

        return Z.Concat(X2d,2).Concat(Y2d,2);
     }
</pre>
<p>Again, this took me like 10 minutes and I was done.</p>
<h3>The Visualization</h3>
<p>This time the user can choose the quantum numbers for X and Y direction, the ratio between the length and the width of the box and also the number of mesh points along each axis for plotting. This makes the visualization panel a little bit more involved. Nevertheless, it’s still rather simple and easy to use. This time it took me only 45 minutes – I guess I learned a lot from last time.</p>
<h3>The result</h3>
<p>Here is the result of my little program. You can click and play with it. If you’re interested, you can download the <a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Particle2DBox.zip">Particle2DBox</a> source code. Have fun!</p>
<p style="text-align: justify;"><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Particle2DBox.jpg"><img class="aligncenter wp-image-767 size-full" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/Particle2DBox.jpg" alt="Particle2DBox" width="928" height="640" /></a>This is a screenshot of the application. I chose the second quantum number along the x axis and the fourth quantum number along the y axis. The box is twice as long in y direction as it is in x direction. The mesh size is 100 in each direction. On the left hand side you see the wave function and on the right hand side the probability density.</p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists/">ILNumerics for Scientists &#8211; Going 3D</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-for-scientists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ILNumerics for Scientists &#8211; An easy start</title>
		<link>https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/</link>
		<comments>https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/#comments</comments>
		<pubDate>Wed, 07 Jan 2015 16:05:43 +0000</pubDate>
		<dc:creator><![CDATA[Jonas]]></dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ILNumerics]]></category>
		<category><![CDATA[Scientific Computing]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[Getting Started]]></category>
		<category><![CDATA[Quantum Mechanics]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://ilnumerics.net/blog/?p=714</guid>
		<description><![CDATA[<p>Motivation I’ve been working as a scientist at universities for 10 years before deciding to go into industry. The one thing I hated most was coding. At the end of the day coding for scientists is like running for a football player. Obviously, you need it but it’s not what you’re here for. I really &#8230; <a href="https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/" class="more-link">Continue reading <span class="screen-reader-text">ILNumerics for Scientists &#8211; An easy start</span> <span class="meta-nav">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/">ILNumerics for Scientists &#8211; An easy start</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h3>Motivation</h3>
<p style="text-align: justify;">I’ve been working as a scientist at universities for 10 years before deciding to go into industry. The one thing I hated most was coding. At the end of the day coding for scientists is like running for a football player. Obviously, you need it but it’s not what you’re here for.</p>
<p style="text-align: justify;">I really dreaded the coding and the debugging. So much precious time for something that was so clear on paper and I just wanted the solution of my equations to see whether my idea made sense or not. More often than not scientists find that their idea was not so great and now they had spent so much time coding just to find out that the idea didn’t work.<span id="more-714"></span></p>
<p style="text-align: justify;">To make things worse even in the case that the idea was good the code was typically in a scripted language like Python or Matlab and now needed to be rewritten in Fortran or C++. Isn’t there a better way of doing things? Isn’t there a way where the idea creation and the formulation is the bottle neck and not the coding? I could’ve spent so much more time on valuable thinking instead of senseless coding.</p>
<p style="text-align: justify;">Now, obviously, I’m going to tell you how ILNumerics does exactly that. And, obviously, I do that because I work for them. Still, this is my experience and this is how easy it was. And at the end of the day, you’re not going to buy our product because of this blog post, rather because you downloaded our <a href="http://ilnumerics.net/download.html">free trial</a> and convinced yourself.</p>
<h3 style="text-align: justify;">The Problem</h3>
<p style="text-align: justify;">Let’s start with one of the simplest problems in quantum mechanics – the particle in a box. This is a quantum mechanical particle in a potential-free box with an infinite potential outside the box. In other words, the particle is forced to stay within the box. Anybody unfamiliar with this problem can read the <a href="https://en.wikipedia.org/wiki/Particle_in_a_box">Wikipedia article </a>about this.</p>
<p style="text-align: justify;">The solution to this problem is well-known and can be found analytically. As always in quantum mechanics, the solution is quantized with infinitely many solutions – also known as states. Each of the solutions consists of a wave function associated with a corresponding energy.</p>
<p style="text-align: center;">$\Psi_n(x) = \sqrt{\frac{2}{L}} \sin(n \cdot \pi \cdot  x)$</p>
<p style="text-align: justify;">In the equation above $n$ designates the $n^{th}$ state and $L$ is the length of the box, set to 1 in our case.</p>
<h3 style="text-align: justify;">The Goal</h3>
<p style="text-align: justify;">My goal is to display the wave function and the probability density of a user-chosen state. I choose a simple problem and a simple goal because I’m just getting started. Obviously, this is not one of the problems I faced as a scientist in my earlier life, but it is a nice example.</p>
<h3 style="text-align: justify;">The Solution</h3>
<p style="text-align: justify;">Let’s start with the mathematical part. First I implemented the wave function for a given state. As the wave function is supposed to be plotted it is discretized over a mesh. Here is my body of my function:</p>
<pre class="brush: csharp; title: ; notranslate">
     ILArray&lt;double&gt; X = linspace&lt;double&gt;(0,1,MeshSize);
     ILArray&lt;double&gt; Y = sqrt(2.0)*sin(EVID*pi*X);
     return vertcat(X,Y);
</pre>
<p style="text-align: justify;">The parameter EVID is the eigenvector ID, i.e. an integer greater than 0 to identify which state should be calculated. I coded the same for the density, which basically means squaring the wave function stored in vector Y.</p>
<p>Done in less than 10 minutes!!!</p>
<h3>The Graphs</h3>
<p style="text-align: justify;">The rest is all about the presentation to the user. So I created a simple Windows Form with a numeric up/down counter (to allow the user to choose the state) and two panels for simple line plots. I just needed to wire all the components to make sure that the plots were rescaled and updated after the user changes the state. This took me some more time, because it was the first time for me. Still it took me only 60 minutes and done.</p>
<h3>The Result</h3>
<p style="text-align: justify;">Here you can find the result of my simple little program. You can download the <a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/ParticleBoxBest.zip" target="_blank">source code</a> and play with it. Have fun!</p>
<p style="text-align: center;"><a href="http://ilnumerics.net/blog/wp-content/uploads/2015/01/ParticleInABox.png"><img class="alignnone wp-image-715 size-full" src="http://ilnumerics.net/blog/wp-content/uploads/2015/01/ParticleInABox.png" alt="ParticleInABox" width="900" height="603" /></a></p>
<p>The post <a rel="nofollow" href="https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/">ILNumerics for Scientists &#8211; An easy start</a> appeared first on <a rel="nofollow" href="https://ilnumerics.net/blog">The ILNumerics Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://ilnumerics.net/blog/ilnumerics-for-scientists-an-easy-start/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
