<div class="gmail_quote">On 30 September 2012 09:37, Alan Gauld <span dir="ltr"><<a href="mailto:alan.gauld@btinternet.com" target="_blank">alan.gauld@btinternet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 29/09/12 23:57, Oscar Benjamin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 29 September 2012 22:57, Alan Gauld <<a href="mailto:alan.gauld@btinternet.com" target="_blank">alan.gauld@btinternet.com</a><br>
</blockquote>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
    My point is that we should not choose short names just to keep an<br></div>
    expression on a single line....<div class="im"><br>
<br>
    in written math too. (Most of the equations I remember reading from<br>
    my quantum mechanics days were split over at least 3 lines... trying<br>
<br></div><div class="im">
I wouldn't advocate forcing an equation onto a single line if it doesn't<br>
fit on a single line. However, I'm sure that the equations you're<br>
refering to would have already been using lots of symbols described by<br>
very succinct single-greek/latin-letters and other simple glyphs.<br>
</div></blockquote>
<br>
Yes which made them even more difficult to understand.</blockquote><div><br></div><div>Quantum mechanics is hard for anyone. I don't think that an alternative notation will make it any easier for people in the business of learning/teaching/using quantum mechanics (there are already several notations developed specifically for quantum mechanics). I also don't think that it is possible to find a notation that will make quantum mechanics intelligible to a layperson: whether you call it psi or time_dependent_wave_function you will still be assuming that the reader knows what a wave function is.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
> Now imagine replacing each of those single letter symbols<br>
> with English underscore-separated words so instead of letter<br>
> capital psi you would have 'time_dependent_wave_function'<br>
> and instead of hbar you would have 'planks_constant_over_twopi'<br>
> and so on. Your equation would go from three lines to thirty<br>
<br></div>
One of the things I like about programming is that I can take those types of equations and break them into chunks and put them in<br>
separate named functions. Then each term gets evaluated separately<br>
and has a name that represents what it means in physical terms.<br></blockquote><div><br></div><div>I often write scripts like the one that the OP is tasked with writing. While I can write a script like the OP's in less than 5 minutes, in practise it takes longer to convince myself that the code is correct (if it is important for it to be so). I spend most of the time when developing such a script simply looking at the code and comparing it with the mathematical problem I was trying to solve. The further your code diverges from the original problem statement the harder it becomes to really convince yourself that the code is correct. Renaming all of your variables (any more than you need to) so that cross-referencing always requires a mental table would be a waste of time and would increase the likelihood of bugs.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<off topic rant><br>
One of the things that makes math hard for people to grasp is its insistence on abstracting functions/values to single letter names etc. (especially when those names are in a foreign language/symbology,<br>
like Greek!) Of course, the abstraction is powerful in its own right because it can then be applied in multiple domains, but that abstraction is often the barrier to people understanding the<br>
principle. Those that are "good at math" are often really those<br>
who are "good at abstraction".<br>
</off topic></blockquote><div><br></div><div>I'll agree with the last sentence. The  conventions used in mathematical symbols convey a lot of meaning (to me). If you look at the Lotka-Volterra equations on Wikipedia, you'll see that the letters x and y are used for the variables and greek letters are used for the constants. That distinction between the variables and constants ("parameters" in dynamics jargon) is very important when trying to understand the model. It is also the only thing you need to know about this model to correctly write the code that solves the system (and is obscured by renaming the variables).</div>
<div><br></div><div>In any case I guess you won't be pleased by my discovery that, thanks to PEP 3131, the following is valid code in Python 3 (I've attached the code in case it doesn't display properly):</div>
<div><br></div><div>'''</div><div><div>#!/usr/bin/env python3</div><div># -*- encoding: utf-8 -*-</div><div><br></div><div># Parameters</div><div>α = 1</div><div>β = 0.1</div><div>γ = 1.5</div><div>δ = 0.075</div>
<div><br></div><div># Initial conditions</div><div>xₒ = 10</div><div>yₒ = 5</div><div>Zₒ = xₒ, yₒ</div><div><br></div><div># Solution parameters</div><div>tₒ = 0</div><div>Δt = 0.001</div><div>T = 10</div><div><br></div><div>
# Lotka-Volterra derivative</div><div>def f(Z, t):</div><div>    x, y = Z</div><div>    ẋ = x * (α - β*y)</div><div>    ẏ = -y * (γ - δ*x)</div><div>    return ẋ, ẏ</div><div><br></div><div># Accumulate results from Euler stepper</div>
<div>tᵢ = tₒ</div><div>Zᵢ = Zₒ</div><div>Zₜ, t = [], []</div><div>while tᵢ <= tₒ + T:</div><div>    Zₜ.append(Zᵢ)</div><div>    t.append(tᵢ)</div><div>    Zᵢ = [Zᵢⱼ+ Δt*Żᵢⱼ for Zᵢⱼ, Żᵢⱼ in zip(Zᵢ, f(Zᵢ, tᵢ))]</div><div>
    tᵢ += Δt</div><div><br></div><div># Output since I don't have plotting libraries in Python 3</div><div>print('t', 'x', 'y')</div><div>for tᵢ, (xᵢ, yᵢ) in zip(t, Zₜ):</div><div>    print(tᵢ, xᵢ, yᵢ)</div>
</div><div>'''</div><div><br></div><div>Oscar</div></div>