<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9135222751616024074</id><updated>2012-02-16T08:34:58.763-08:00</updated><title type='text'>Matt's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-8172338055248531834</id><published>2010-08-07T11:52:00.000-07:00</published><updated>2010-08-07T12:16:42.986-07:00</updated><title type='text'>Nearing the End</title><content type='html'>Well there's only a week left in GSoC, and plenty of coding left to do. We're supposed to focus on bug fixing and documentation only next week.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It is definitely true that my project became more and more of a bear conceptually as I continued on. Right now we are subclassing sympy's Mul, Add, and Pow classes in order to circumvent any sort of non-commutative/validation/operator problems. We've definitely found a way to avoid most/all of the design issues that I was faced with a few weeks back. Overall, I think a very respectable version of symbolic quantum mechanics (with a quantum  computing example) will be ready by the end.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This last week, we made a lot of progress on QMul, QAdd and QPow. I mainly observed that as we added more and more degrees of freedom (more code), more bugs and weird errors arose. I helped fix a few of these bugs including one today in which Bra('a')*Operator('b') was returning only Bra('a'). The fix was really simple (changing one line), but finding it was much more difficult. It was a good experience because I used more advance forms of debugging that I had previously not needed before.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Next week I'll write some tests and debug more. Things will start winding down and my project will be done soon enough :)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-8172338055248531834?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/8172338055248531834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/08/nearing-end.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/8172338055248531834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/8172338055248531834'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/08/nearing-end.html' title='Nearing the End'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-143425197871935102</id><published>2010-07-31T11:14:00.000-07:00</published><updated>2010-07-31T11:56:00.534-07:00</updated><title type='text'>More Design Issues</title><content type='html'>Unfortunately, it seems with my project that we keep running into more and more design issues. Put simply, the issues arise with Sympy's Mul and Add (and Pow) classes. In order for my quantum objects to be handled properly, we are going to have to subclass these classes. You can find more information about the issues &lt;a href="https://docs.google.com/document/pub?id=1aDhhEam6TzOYdtEBd9Yw_vD3jW7MFHnz6lpsPb87V9w"&gt;here&lt;/a&gt; (originally posted on the Sympy Google group).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;With all that to say, there still is a bit of time for coding left! Next week, we are going to subclass Mul, Add, and Pow (qmul, qadd, qpow). After that happens, I plan on creating a physics example that uses the existing quantum library I've helped build. I think I'm going to do the particle in a box (with infinitely strong walls) and use a position state to do so.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More on this next week when we get everything sorted out!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-143425197871935102?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/143425197871935102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/more-design-issues.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/143425197871935102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/143425197871935102'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/more-design-issues.html' title='More Design Issues'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-3829230650064961450</id><published>2010-07-24T14:07:00.000-07:00</published><updated>2010-09-03T12:12:29.102-07:00</updated><title type='text'>More Improvements and Nice Printing</title><content type='html'>This week was quite spread out in terms of what I coded in quantum.py. I made inner products work with operators and other objects in between them. We made &lt;i&gt;pretty&lt;/i&gt; print work with various quantum classes. And finally I made a suite of validating/combining/separating functions for inner and outer products.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;First of all, let's look at how &lt;/b&gt;&lt;i&gt;&lt;b&gt;pretty&lt;/b&gt;&lt;/i&gt;&lt;b&gt; makes quantum objects very readable. Let's create the iconic psi state (ket):&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In [5]: psi = Ket('psi')&lt;br /&gt;&lt;br /&gt;In [6]: psi&lt;br /&gt;Out[6]: |ψ&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Next let's create an operator and dagger it (and leave it unevaluated):&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In [9]: a = Operator('A')&lt;br /&gt;&lt;br /&gt;In [10]: Dagger(a)&lt;br /&gt;Out[10]:&lt;br /&gt;†&lt;br /&gt;A&lt;br /&gt;&lt;br /&gt;(the dagger symbol normally appears as a superscript to A, but Blogger is temperamental)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Inner products can have objects (mainly operators) between them now. Outer products will not have this functionality because it is not valid for them. When someone creates an inner product, they must instantiate the class because states and operators (and such) cannot automatically combine with their __mul__ method due to a very tricky reason (the subtlety lies deep within sympy's Mul class):&lt;/b&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In [12]: bra = Bra('_a')&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In [13]: b = Operator('B')&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [15]: ip = InnerProduct(bra, b, a, psi)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In [16]: ip&lt;/div&gt;&lt;div&gt;Out[16]: &lt;_a|⋅b⋅a⋅|ψ&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In [17]: ip.bra&lt;/div&gt;&lt;div&gt;Out[17]: &lt;_a|&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [19]: ip.ket&lt;/div&gt;&lt;div&gt;Out[19]: (B, A, |ψ&gt;)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Now let's take a look at some of the special functions I made:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [23]: expr = bra*a*b*a*psi*a&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In [24]: expr&lt;/div&gt;&lt;div&gt;Out[24]: &lt;_a|⋅a⋅b⋅a⋅|ψ&gt;⋅A&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In [25]: srepr(expr)&lt;/div&gt;&lt;div&gt;Out[25]: &lt;/div&gt;&lt;div&gt;Mul(Bra(Symbol('_a')), Operator(Symbol('A')), Operator(Symbol('B')), Operator(S&lt;/div&gt;&lt;div&gt;ymbol('A')), Ket(Symbol('psi')), Operator(Symbol('A')))&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;(let's see if this is a valid mul by using the validate_mul function)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [27]: validate_mul(expr)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Exception: Ket*(Operator or OuterProduct) is invalid in quantum mechanics.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;=============================================&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(so now let's make a valid expression)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [28]: expr = bra*a*b*a*psi*bra*a*psi&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [29]: inprod = combine_innerproduct(expr)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [30]: inprod&lt;/div&gt;&lt;div&gt;Out[30]: &lt;_a|⋅a⋅b⋅a⋅|ψ&gt;⋅&lt;_a|⋅a⋅|ψ&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(these functions automatically check to see if the mul is valid with validate_mul)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [31]: srepr(inprod)&lt;/div&gt;&lt;div&gt;Out[31]: &lt;/div&gt;&lt;div&gt;Mul(&lt;span class="Apple-style-span"  style="color:#CC33CC;"&gt;InnerProduct&lt;/span&gt;(Bra(Symbol('_a')), Operator(Symbol('A')), Operator(Symbol('B')&lt;/div&gt;&lt;div&gt;), Operator(Symbol('A')), Ket(Symbol('psi'))), &lt;span class="Apple-style-span"  style="color:#CC33CC;"&gt;InnerProduct&lt;/span&gt;(Bra(Symbol('_a')), &lt;/div&gt;&lt;div&gt;Operator(Symbol('A')), Ket(Symbol('psi'))))&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;=============================================&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [32]: outprod = combine_outerproduct(expr)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [34]: srepr(outprod)&lt;/div&gt;&lt;div&gt;Out[34]: &lt;/div&gt;&lt;div&gt;Mul(Bra(Symbol('_a')), Operator(Symbol('A')), Operator(Symbol('B')), Operator(S&lt;/div&gt;&lt;div&gt;ymbol('A')), &lt;span class="Apple-style-span"  style="color:#CC33CC;"&gt;OuterProduct&lt;/span&gt;(Ket(Symbol('psi')),Bra(Symbol('_a'))), Operator(Symbo&lt;/div&gt;&lt;div&gt;l('A')), Ket(Symbol('psi')))&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;=============================================&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(you can also split the products; I'll show you how this works on the inprod expression)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [36]: split = split_product(inprod)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;In [37]: srepr(split)&lt;/div&gt;&lt;div&gt;Out[37]: &lt;/div&gt;&lt;div&gt;Mul(Bra(Symbol('_a')), Operator(Symbol('A')), Operator(Symbol('B')), Operator(S&lt;/div&gt;&lt;div&gt;ymbol('A')), Ket(Symbol('psi')), Bra(Symbol('_a')), Operator(Symbol('A')), Ket(&lt;/div&gt;&lt;div&gt;Symbol('psi')))&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;(see, no more inner products!)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;=============================================&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So we see that the same expression can be combined into inner products or an outer product depending on which function one uses. And we can also split up the inner or outer products.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the last few weeks of my project, we have decided that it would be best if I started working on applications with this code such as an infinite square well and other quantum physics examples. We'll see initially how far I get on this next week!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-3829230650064961450?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/3829230650064961450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/more-improvements-and-nice-printing.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/3829230650064961450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/3829230650064961450'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/more-improvements-and-nice-printing.html' title='More Improvements and Nice Printing'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-7068623005530800369</id><published>2010-07-16T18:43:00.000-07:00</published><updated>2010-07-16T18:57:43.772-07:00</updated><title type='text'>An Enjoyable Week</title><content type='html'>This was a good week. I coded some stuff that wasn't nearly as abstract as Hilbert spaces, and my midterm was completed. &lt;br /&gt;&lt;br /&gt;Overall, I would say that I'm quite satisfied with my progress. We are still working on the many products between quantum objects, but that doesn't mean I can't work on the objects themselves or functions. As we saw in my previous post, basic symbolic quantum mechanics is coming together and it is very nice to see so.&lt;br /&gt;&lt;br /&gt;It seems that when we try and implement products between these objects (inner and outer products included too now unfortunately), many difficulties arise in the design decisions. That's okay though, sometimes things just catch us off guard sometimes. I know that in a few weeks everything will be nicely glued together (in a tensor product sense).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-7068623005530800369?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/7068623005530800369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/enjoyable-week.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7068623005530800369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7068623005530800369'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/enjoyable-week.html' title='An Enjoyable Week'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-8028763631663391829</id><published>2010-07-14T16:42:00.000-07:00</published><updated>2010-07-15T09:48:26.453-07:00</updated><title type='text'>Midweek Madness: Quantum Physics Examples</title><content type='html'>&lt;div style="text-align: left;"&gt;The code is starting to get quite amusing (especially because of how intuitive it is to implement something in Sympy). I have made basic quantum states (bras and kets) functional for now sans any sort of tensor products (postponed for the moment). There are other kinds of products though that need attention too like &lt;a href="http://en.wikipedia.org/wiki/Inner_product_space"&gt;inner&lt;/a&gt; products and &lt;a href="http://en.wikipedia.org/wiki/Outer_product"&gt;outer&lt;/a&gt; products, and they are now implemented in my code. I'll give more details on my overall progress when the week ends, but for now let's look at some physics/code in action (using the wondrous iPython shell running quantum.py and hilbert.py):&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Make bra and ket states:&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;In [3]: a = Bra('_a')   &lt;br /&gt;&lt;br /&gt;(I have to put the underscore because html starts getting in the way with the less-than sign.)&lt;br /&gt;&lt;br /&gt;In [4]: b = Ket('_b')&lt;br /&gt;&lt;br /&gt;In [5]: a&lt;br /&gt;Out[5]: &lt;_a|&lt;br /&gt;&lt;br /&gt;In [6]: b&lt;br /&gt;Out[6]: |_b&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Now let's create a Hilbert space for them to live in:&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In [7]: state_space = l2(2)&lt;br /&gt;&lt;br /&gt;In [8]: state_space&lt;br /&gt;Out[8]: l2(2)&lt;br /&gt;&lt;br /&gt;In [9]: a.hilbert_space = state_space&lt;br /&gt;&lt;br /&gt;In [10]: b.hilbert_space = state_space&lt;br /&gt;&lt;br /&gt;(This process could change slightly in the near future.)&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;We can check to see if they live in that Hilbert space!&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In [11]: (a and b) in l2(2)&lt;br /&gt;Out[11]: True&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;And now let's do some inner and outer products:&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In [12]: a*b&lt;br /&gt;Out[12]: &lt;_a|_b&gt;&lt;br /&gt;&lt;br /&gt;In [13]: type(a*b)&lt;br /&gt;Out[13]: &lt;_class 'sympy.physics.quantum.InnerProduct'&gt;&lt;br /&gt;&lt;br /&gt;In [14]: b*a&lt;br /&gt;Out[14]: |_b&gt;&lt;_a|&lt;br /&gt;&lt;br /&gt;In [15]: type(b*a)&lt;br /&gt;Out[15]: &lt;_class 'sympy.physics.quantum.OuterProduct'&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You can also "Dagger" (complex conjugate transpose) stuff:&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;In [16]: Dagger(a)&lt;br /&gt;Out[16]: |_a&gt;&lt;br /&gt;&lt;br /&gt;(a was a bra, now it's a ket)&lt;br /&gt;&lt;br /&gt;In [17]: Dagger(b)&lt;br /&gt;Out[17]: &lt;_b|&lt;br /&gt;&lt;br /&gt;(b was a ket, now it's a bra)&lt;br /&gt;&lt;br /&gt;In [18]: Dagger(a*b)&lt;br /&gt;Out[18]: &lt;_b|_a&gt;&lt;br /&gt;&lt;br /&gt;In [19]: Dagger(b*a)&lt;br /&gt;Out[19]: |_a&gt;&lt;_b|&lt;br /&gt;&lt;br /&gt;(inner/outer products reversed)&lt;br /&gt;&lt;br /&gt;Right now I've only shown pure symbolic calculations, but functions such as Dagger can also be used numerically (also this is a symbolic project!).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-8028763631663391829?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/8028763631663391829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/midweek-madness-quantum-physics.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/8028763631663391829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/8028763631663391829'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/midweek-madness-quantum-physics.html' title='Midweek Madness: Quantum Physics Examples'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-5214101657804899036</id><published>2010-07-09T09:37:00.000-07:00</published><updated>2010-07-09T12:06:02.267-07:00</updated><title type='text'>Design Decisions</title><content type='html'>This week I was faced with difficult design decisions. Originally, we had thought everything would go smoothly when I switched from Hilbert spaces to operators, states, etc. But in practice we encountered very deep, fundamental design issues with inheritance and structure.&lt;br /&gt;&lt;br /&gt;The issues arise with how we are going to handle tensor products, direct sums, and tensor powers (I will refer to these as simply the "operation base classes") between quantum objects. In order to explain the issues better, I will outline the four (current) possibilities we have come up with for the quantum structure of sympy:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1)&lt;/span&gt; Operation base classes function like Mul - nothing inherits from them:&lt;br /&gt;&lt;br /&gt;Cons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Operation base classes cannot have any special methods or attributes tied to a quantum object.&lt;/li&gt;&lt;li&gt;These classes then cannot act like a macro version of what they contain.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;2)&lt;/span&gt; The following multiple (diamond) inheritance tree:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_d5YCcBWh7HQ/TDdrYsTlpBI/AAAAAAAAAAM/Le7gJR41EJ4/s1600/blog+pic.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 287px;" src="http://1.bp.blogspot.com/_d5YCcBWh7HQ/TDdrYsTlpBI/AAAAAAAAAAM/Le7gJR41EJ4/s320/blog+pic.png" alt="" id="BLOGGER_PHOTO_ID_5491976342555960338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Where "something" means an operator, state, etc. and "Tensor Product" is just a placeholder for any operation base class (which of course includes tensor products). Dr. Granger posted questions on this (and similar structures) to the sympy group, and it was recommended that we inherit from Basic instead of Expr, so the top of the tree could change. The only con with this approach is how exactly the inheritance works (subtlety lies in __new__).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3)&lt;/span&gt; Create tons of subclasses (brute force style), where a bunch of  TensorProductSomethings exist and no generic TensorProduct exists.&lt;br /&gt;&lt;br /&gt;Cons:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;code repetition (completely defeats the purpose of object oriented programming)!&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;4) &lt;/span&gt;Possibility 2+3 hybrid:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_d5YCcBWh7HQ/TDdvMjnIB4I/AAAAAAAAAAU/pz64FrPth9M/s1600/blog+pic1.png"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 288px;" src="http://4.bp.blogspot.com/_d5YCcBWh7HQ/TDdvMjnIB4I/AAAAAAAAAAU/pz64FrPth9M/s320/blog+pic1.png" alt="" id="BLOGGER_PHOTO_ID_5491980532110067586" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Where operation base classes do not inherit from Expr (or Basic) - they only contain common logic that all TensorProductSomethings use.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So it's kind of complicated. But we'll sort through everything (including all the generous feedback) and come up with a solution so that I can get on with coding!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-5214101657804899036?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/5214101657804899036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/design-decisions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/5214101657804899036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/5214101657804899036'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/design-decisions.html' title='Design Decisions'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_d5YCcBWh7HQ/TDdrYsTlpBI/AAAAAAAAAAM/Le7gJR41EJ4/s72-c/blog+pic.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-359202078627401142</id><published>2010-07-03T15:33:00.000-07:00</published><updated>2010-07-07T15:04:58.661-07:00</updated><title type='text'>Interesting Times</title><content type='html'>So this week I submitted my Hilbert space code for review on the sympy patches group.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It went well. There were plenty of comments/concerns. I answered them all and made sure the code passed all of the tests. One of the issues at first was the code quality test not passing (whitespace errors, implicit import, etc.). I interpreted this wrongly at first and thought it didn't apply to my code (for whatever reason). But now it's all fixed!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Some more crucial changes included adding more tests to see if things do/don't commute. Also, I needed to update the direct sum class and make sure it commuted :p&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Overall, I can see why review processes take place - you get to see if your code isn't completely ridiculous :)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;On Friday I also dabbled in multiple inheritance with the __new__ method. It's going to be interesting creating a direct product/sum ancestor class for everything to inherit from as well as mul and add. We shall see next week when I enter deeper (quantum) waters.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-359202078627401142?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/359202078627401142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/interesting-times.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/359202078627401142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/359202078627401142'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/07/interesting-times.html' title='Interesting Times'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-7368344242618449519</id><published>2010-06-26T16:22:00.000-07:00</published><updated>2010-06-26T16:49:24.985-07:00</updated><title type='text'>Week of Code Part 2: Examples and Physics</title><content type='html'>So it's finally  time for me to start showing off my code to the rest of the world. I'll start with a simple example on how to create a Hilbert space. In these lines of code, I create an l2(2) Hilbert space (2 dimensional):&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 14px; font-family:helvetica, arial, freesans, clean, sans-serif;font-size:11px;"&gt;&lt;pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; "&gt;&lt;div class="line" id="LC76" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        &gt;&gt;&gt; from sympy.physics.hilbert import *&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC77" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        &gt;&gt;&gt; hs = l2(2)&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC78" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        &gt;&gt;&gt; hs&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC79" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        l2(2)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As we see, SymPy is able to know what an "l2(2)" is, and it can print it back out to us. By the way, this is the kind of Hilbert space that qbits live in!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's move on to a more complicated example where my code combines tensor products (analogous to multiplication for Hilbert spaces) into a single direct power (repeated tensor products):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 14px; font-family:helvetica, arial, freesans, clean, sans-serif;font-size:11px;"&gt;&lt;pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; "&gt;&lt;div class="line" id="LC253" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt;       &lt;/span&gt;&lt;/span&gt;&gt;&gt;&gt; ms = hs*hs*hs&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC254" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        &gt;&gt;&gt; ms&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC255" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        l2(2)**(3)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The variable "hs" is the same as in the previous example. And what do you know, they combined into a single direct power object which is seen printed in the last line! The code is really smart when it comes to combining these powers, so it can deal with more complicated examples such as combining powers with symbols in them. It also knows that tensor products are non-commutative, so it will not simply find all identical Hilbert spaces and combine them (only if they're "right next to each other"):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 14px; font-family:helvetica, arial, freesans, clean, sans-serif;font-size:11px;"&gt;&lt;pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 12px; "&gt;&lt;div class="line" id="LC445" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt;       &lt;/span&gt;&lt;/span&gt;&gt;&gt;&gt; from sympy.physics.hilbert import *&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC446" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        &gt;&gt;&gt; from sympy.abc import x&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC447" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;       &lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(221, 17, 68); "&gt; &gt;&gt;&gt; hs = l2(2)&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC452" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        &gt;&gt;&gt; direct_power = hs*hs*(hs**2)*(hs**x)*hs&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC453" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        &gt;&gt;&gt; direct_power&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC454" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1em; line-height: 1.4em; "&gt;&lt;span class="sd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 1.4em; color: rgb(221, 17, 68); "&gt;        l2(2)**(5 + x)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;See how "direct_power" has an assortment of identical Hilbert spaces each with a different direct power. It knows to combine them into a single direct power!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I was very satisfied when I got this working, and it has definitely caused me to be addicted to coding (especially when something isn't working)! Until next week :)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-7368344242618449519?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/7368344242618449519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/week-of-code-part-2-examples-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7368344242618449519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7368344242618449519'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/week-of-code-part-2-examples-and.html' title='Week of Code Part 2: Examples and Physics'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-1058234623968737171</id><published>2010-06-26T01:15:00.000-07:00</published><updated>2010-06-26T01:32:54.558-07:00</updated><title type='text'>Week of Code Part 1: The Summary</title><content type='html'>Now my GSoC experience is purely coding - as it inevitably should be! This week was spent entirely on finishing the Hilbert spaces basis in SymPy.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Last week, I started a huge test file for hilbert.py and finished it this week (mainly adding direct power tests). I definitely know that later on in the summer when I'm working on other direct products and sums, I will need to perhaps add a few more methods and properties to hilbert.py and its test file, but for now they are very solid.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I would say the most difficult part of my week was teaching my code to intelligently handle the combining of tensor products into direct powers. I definitely think this was a good lesson in logic and coding; it really helped iron out any kinks I had with programming in general. I'll post an example of how it combines powers tomorrow in the second part.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It was a difficult week - more difficult than any of the others. It was definitely the most rewarding though! I feel much more solid with coding in general. More on everything tomorrow including examples and physics in Part 2!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-1058234623968737171?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/1058234623968737171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/week-of-code-part-1-summary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/1058234623968737171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/1058234623968737171'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/week-of-code-part-1-summary.html' title='Week of Code Part 1: The Summary'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-6093880638038716002</id><published>2010-06-18T21:56:00.000-07:00</published><updated>2010-06-18T22:37:24.688-07:00</updated><title type='text'>Coding and Other Festivities Begin</title><content type='html'>The summer has officially started, and GSoC has my full attention.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I started this week off by reading a hulking amount of material on Python and quantum physics. We're talking hours and hours of reading - time consuming but rewarding. I picked up a few new object methods here and there in the Python book, and I learned about dictionaries, an object I previously had no knowledge of. As for the quantum physics, I read the appendix (pure linear algebra) of my quantum book from PHYS 405. I also read excerpts from Dr. Granger's grad school level quantum book. Lots and lots of reading...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But I did do some code interpreting (more reading; different kind) and coding! I started by creating my own sympy fork on github and creating a quantum branch with Dr. Granger's quantum files patched in and pushed. I concentrated mainly on the hilbert.py file, as implementing Hilbert spaces is my current task in my GSoC proposal. I needed to look over everything and understand what it is trying to do and what it is inheriting from to do it. And everything works remarkably well right now. There are a few design issues I think I need to work out with the inheriting (e.g. direct products and sums need their own class that the Hilbert ones will inherit from), but overall everything is pretty well laid out.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I started the test file: test_hilbert.py (found in the tests directory of my physics directory &lt;a href="http://github.com/mattcurry/sympy/tree/quantum/sympy/physics/"&gt;here&lt;/a&gt;). I've never written a test file before, so this was good practice. I may have gone overboard on the tests, but this was a good experience not only for the sake of writing tests but also to find some dimensionality issues with direct products and sums in hilbert.py. Infinity times a number is infinity, right? Well, due to some subtle simplification errors with symbols and infinity (oo in sympy) there is a problem with calling the dimension of a direct product or sum. I'll fix this next week, I promise!!!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Anyway, I had a grand old time this week, and highly uncannily my PHYS 405 professor, Dr. Gutierrez stopped by and talked about a bunch of crazy stuff that nearly blew my mind (or something like that).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-6093880638038716002?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/6093880638038716002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/coding-and-other-festivities-begin.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/6093880638038716002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/6093880638038716002'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/coding-and-other-festivities-begin.html' title='Coding and Other Festivities Begin'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-5820800155622173370</id><published>2010-06-11T22:57:00.000-07:00</published><updated>2010-06-11T23:35:07.272-07:00</updated><title type='text'>Out of The Fire; Into the... Tropical Ocean of Code and Quantum Physics!</title><content type='html'>So my finals week has finished, and I have to admit that my mind is slightly expired. I'll use this weekend as a relaxing transition from school/research/light-coding into more full time coding and fascinating quantum physics lectures from Dr. Granger. Next week, full speed ahead!&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm also probably going to pick up a couple of excellent books relevant to topics I'll be dealing with this summer: Python and Quantum Computing. The two books are "Quantum Computer Science" (Mermin) and "Python for Software Design" (Downey). We actually have the two books in our computer lab on campus, and I took a look at the quantum computing one. It had very interesting topics discussed in it including entanglement - my personal favorite.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also, in my last post I touched on Hilbert spaces (L2 &amp;amp; l2). I was talking to my friend (math major) today and he told me that there are Lp spaces (L2 &amp;amp; l2 are just the beginning). He told me about the &lt;i&gt;norm&lt;/i&gt; in those spaces and other interesting properties. It was kind of humbling to learn that the space I'm working in these next few weeks is just a part of a more general set (there seems to always be a bigger fish no matter what space or dimension or whatever you look at)!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-5820800155622173370?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/5820800155622173370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/out-of-fire-into-tropical-ocean-of-code.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/5820800155622173370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/5820800155622173370'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/out-of-fire-into-tropical-ocean-of-code.html' title='Out of The Fire; Into the... Tropical Ocean of Code and Quantum Physics!'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-6119098484983452317</id><published>2010-06-04T19:27:00.000-07:00</published><updated>2010-06-04T19:47:21.475-07:00</updated><title type='text'>Ahead On Our Way</title><content type='html'>This week in GSoC our gang decided to concentrate primarily on quantum physics, namely Hilbert spaces.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Dr. Granger lectured on the basics of what a Hilbert space demands from a vector space (a Hilbert space is a subset of a vector space). The main requirement is that the inner product between to vectors is defined. The vectors may be continuous (functions; L2 Hilbert space) or countably infinite (discrete component; l2 Hilbert space). The direct product is the "multiplication" that is defined for multiplying two Hilbert spaces. We observed that __mul__ in Sympy will need to be overwritten in order to properly interpret multiplying vectors in their respective Hilbert spaces.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As for Python, we began looking at decorators. More on this to come (when I'm not buried in huge HW assignments, lab write ups, projects, and finals)!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-6119098484983452317?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/6119098484983452317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/ahead-on-our-way.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/6119098484983452317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/6119098484983452317'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/06/ahead-on-our-way.html' title='Ahead On Our Way'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-7465638568568153255</id><published>2010-05-28T21:10:00.000-07:00</published><updated>2010-05-28T21:32:38.766-07:00</updated><title type='text'>Getting Started</title><content type='html'>GSoC began last Monday (5/24/2010)   :)&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm in the "Investigation" period of my project, where I research and learn quantum mechanics at Cal Poly. Right now we are taking the formal approach towards quantum mechanics in class. We have learned about states, bras, kets, and operators (not the phone kind). I'm finding this all quiet interesting, and I often think of the place this math has in the coding context during lecture.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also, Addison and I are playing around with a very simple version of a symbolic math "library" for python that we coded and published to github (http://github.com/mattcurry/scratch). We started with our intuitions on how a symbolic math library could function, and then we encountered some of the design decisions that sympy had to face when it was first being created. Dr. Granger helps us a lot with making the code function more like sympy. I think this is a great way to understand sympy on a deep level. After all, I need to know what my classes are inheriting from to some degree before I start coding during the summer.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm definitely enjoying it all so far, so I know I'm doing the right thing!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-7465638568568153255?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/7465638568568153255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/05/getting-started.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7465638568568153255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7465638568568153255'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/05/getting-started.html' title='Getting Started'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-5639749574810063318</id><published>2010-04-27T13:13:00.001-07:00</published><updated>2010-07-07T15:05:18.507-07:00</updated><title type='text'>PROPOSAL ACCEPTED!!!!!</title><content type='html'>An amazing day it was, yesterday.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-5639749574810063318?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/5639749574810063318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/proposal-accepted-amazing-day-it-was.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/5639749574810063318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/5639749574810063318'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/proposal-accepted-amazing-day-it-was.html' title='PROPOSAL ACCEPTED!!!!!'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-7731405685329922201</id><published>2010-04-15T10:27:00.000-07:00</published><updated>2010-04-15T10:36:28.349-07:00</updated><title type='text'>SymPy Patch</title><content type='html'>I've patched SymPy for the first time! I fixed a string name conflict with the various printmethods SymPy uses (the conflict happened between SymPy and Sage). I submitted my  patch &lt;a href="http://groups.google.com/group/sympy-patches/browse_thread/thread/5c92d6881e197375"&gt;here&lt;/a&gt;. Also, I used git to clone the SymPy repository and create the patch file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-7731405685329922201?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/7731405685329922201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/sympy-patch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7731405685329922201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/7731405685329922201'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/sympy-patch.html' title='SymPy Patch'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-827116854105109162</id><published>2010-04-12T19:55:00.000-07:00</published><updated>2010-04-12T19:58:09.996-07:00</updated><title type='text'>Proposal In</title><content type='html'>Last Friday I submitted my proposal to Google Summer of Code's website. You can take a look at the proposal here: &lt;a href="http://docs.google.com/View?id=dhd962vk_84p6wjkfc"&gt;http://docs.google.com/View?id=dhd962vk_84p6wjkfc&lt;/a&gt;. I'll know if my proposal gets accepted on 4/26/10!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-827116854105109162?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/827116854105109162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/proposal-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/827116854105109162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/827116854105109162'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/proposal-in.html' title='Proposal In'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9135222751616024074.post-309547145714637964</id><published>2010-04-05T20:56:00.000-07:00</published><updated>2010-04-05T20:57:08.572-07:00</updated><title type='text'>Welcome</title><content type='html'>Welcome, myself, to the world of blogging.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9135222751616024074-309547145714637964?l=mattjcurry.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mattjcurry.blogspot.com/feeds/309547145714637964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/welcome.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/309547145714637964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9135222751616024074/posts/default/309547145714637964'/><link rel='alternate' type='text/html' href='http://mattjcurry.blogspot.com/2010/04/welcome.html' title='Welcome'/><author><name>mcurry</name><uri>http://www.blogger.com/profile/10457551070900109390</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
