# Python scripts for simulating QM, part 0: A general update

My proposed paper on my new approach to QM was not accepted at the international conference where I had sent my abstract. (For context, see the post before the last, here [^] ).

“Thank God,” that’s what I actually felt when I received this piece of news, “I can now immediately proceed to procrastinate on writing the full-length paper, and also, simultaneously, un-procrastinate on writing some programs in Python.”

So far, I have written several small and simple code-snippets. All of these were for the usual (text-book) cases; all in only $1D$. Here in this post, I will mention specifically which ones…

Time-independent Schrodinger equation (TISE):

Here, I’ve implemented a couple of scripts, one for finding the eigen-vectors and -values for a particle in a box (with both zero and arbitrarily specified potentials) and another one for the quantum simple harmonic oscillator.

These were written not with the shooting method (which is the method used in the article by Rhett Allain for the Wired magazine [^]) but with the matrix method. … Yes, I have gone past the stage of writing all the numerical analysis algorithm in original, all by myself. These days, I directly use Python libraries wherever available, e.g., NumPy’s LinAlg methods. That’s why, I preferred the matrix method. … My code was not written from scratch; it was based on Cooper’s code “qp_se_matrix”, here [PDF ^]).

Time-dependent Schrodinger equation (TDSE):

Here, I tried out a couple of scripts.

The first one was more or less a straightforward porting of Ian Cooper’s program “se_fdtd” [PDF ^] from the original MatLab to Python. The second one was James Nagel’s Python program (written in 2007 (!) and hosted as a SciPy CookBook tutorial, here [^]). Both follow essentially the same scheme.

Initially, I found this scheme to be a bit odd to follow. Here is what it does.

It starts out by replacing the complex-valued Schrodinger equation with a pair of real-valued (time-dependent) equations. That was perfectly OK by me. It was their discretization which I found to be a bit peculiar. The discretization scheme here is second-order in both space and time, and yet it involves explicit time-stepping. That’s peculiar, so let me write a detailed note below (in part, for my own reference later on).

Also note: Though both Cooper and Nagel implement essentially the same method, Nagel’s program is written in Python, and so, it is easier to discuss (because the array-indexing is 0-based). For this reason, I might make a direct reference only to Nagel’s program even though it is to be understood that the same scheme is found implemented also by Cooper.

A note on the method implemented by Nagel (and also by Cooper):

What happens here is that like the usual Crank-Nicolson (CN) algorithm for the diffusion equation, this scheme too puts the half-integer time-steps to use (so as to have a second-order approximation for the first-order derivative, that of time). However, in the present scheme, the half-integer time-steps turn out to be not entirely fictitious (the way they are, in the usual CN method for the single real-valued diffusion equation). Instead, all of the half-integer instants are fully real here in the sense that they do enter the final discretized equations for the time-stepping.

The way that comes to happen is this: There are two real-valued equations to solve here, coupled to each other—one each for the real and imaginary parts. Since both the equations have to be solved at each time-step, what this method does is to take advantage of that already existing splitting of the time-step, and implements a scheme that is staggered in time. (Note, this scheme is not staggered in space, as in the usual CFD codes; it is staggered only in time.) Thus, since it is staggered and explicit, even the finite-difference quantities that are defined only at the half-integer time-steps, also get directly involved in the calculations. How precisely does that happen?

The scheme defines, allocates memory storage for, and computationally evaluates the equation for the real part, but this computation occurs only at the full-integer instants ($n = 0, 1, 2, \dots$). Similarly, this scheme also defines, allocates memory for, and computationally evaluates the equation for the imaginary part; however, this computation occurs only at the half-integer instants ($n = 1/2, 1+1/2, 2+1/2, \dots$). The particulars are as follows:

The initial condition (IC) being specified is, in general, complex-valued. The real part of this IC is set into a space-wide array defined for the instant $n$; here, $n = 0$. Then, the imaginary part of the same IC is set into a separate array which is defined nominally for a different instant: $n+1/2$. Thus, even if both parts of the IC are specified at $t = 0$, the numerical procedure treats the imaginary part as if it was set into the system only at the instant $n = 1/2$.

Given this initial set-up, the actual time-evolution proceeds as follows:

• The real-part already available at $n$ is used in evaluating the “future” imaginary part—the one at $n+1/2$
• The imaginary part thus found at $n+1/2$ is used, in turn, for evaluating the “future” real part—the one at $n+1$.

At this point that you are allowed to say: lather, wash, repeat… Figure out exactly how. In particular, notice how the simulation must proceed in integer number of pairs of computational steps; how the imaginary part is only nominally (i.e. only computationally) distant in time from its corresponding real part.

Thus, overall, the discretization of the space part is pretty straight-forward here: the second-order derivative (the Laplacian) is replaced by the usual second-order finite difference approximation. However, for the time-part, what this scheme does is both similar to, and different from, the usual Crank-Nicolson scheme.

Like the CN scheme, the present scheme also uses the half-integer time-levels, and thus manages to become a second-order scheme for the time-axis too (not just space), even if the actual time interval for each time-step remains, exactly as in the CN, only $\Delta t$, not $2\Delta t$.

However, unlike the CN scheme, this scheme still remains explicit. That’s right. No matrix equation is being solved at any time-step. You just zip through the update equations.

Naturally, the zipping through comes with a “cost”: The very scheme itself comes equipped with a stability criterion; it is not unconditionally stable (the way CN is). In fact, the stability criterion now refers to half of the time-interval, not full, and thus, it is a bit even more restrictive as to how big the time-step ($\Delta t$) can be given a certain granularity of the space-discretization ($\Delta x$). … I don’t know, but guess that this is how they handle the first-order time derivatives in the FDTD method (finite difference time domain). May be the physics of their problems itself is such that they can get away with coarser grids without being physically too inaccurate, who knows…

Other aspects of the codes by Nagel and Cooper:

For the initial condition, both Cooper and Nagel begin with a “pulse” of a cosine function that is modulated to have the envelop of the Gaussian. In both their codes, the pulse is placed in the middle, and they both terminate the simulation when it reaches an end of the finite domain. I didn’t like this aspect of an arbitrary termination of the simulation.

However, I am still learning the ropes for numerically handling the complex-valued Schrodinger equation. In any case, I am not sure if I’ve got good enough a handle on the FDTD-like aspects of it. In particular, as of now, I am left wondering:

What if I have a second-order scheme for the first-order derivative of time, but if it comes with only fictitious half-integer time-steps (the way it does, in the usual Crank-Nicolson method for the real-valued diffusion equation)? In other words: What if I continue to have a second-order scheme for time, and yet, my scheme does not use leap-frogging? In still other words: What if I define both the real and imaginary parts at the same integer time-steps $n = 0, 1, 2, 3, \dots$ so that, in both cases, their values at the instant $n$ are directly fed into both their values at $n+1$?

In a way, this scheme seems simpler, in that no leap-frogging is involved. However, notice that it would also be an implicit scheme. I would have to solve two matrix-equations at each time-step. But then, I could perhaps get away with a larger time-step than what Nagel or Cooper use. What do you think? Is checker-board patterning (the main reason why we at all use staggered grids in CFD) an issue here—in time evolution? But isn’t the unconditional stability too good to leave aside without even trying? And isn’t the time-axis just one-way (unlike the space-axis that has BCs at both ends)? … I don’t know…

PBCs and ABCs:

Even as I was (and am) still grappling with the above-mentioned issue, I also wanted to make some immediate progress on the front of not having to terminate the simulation (once the pulse reached one of the ends of the domain).

So, instead of working right from the beginning with a (literally) complex Schrodinger equation, I decided to first model the simple (real-valued) diffusion equation, and to implement the PBCs (periodic boundary conditions) for it. I did.

My code seems to work, because the integral of the dependent variable (i.e., the total quantity of the diffusing quantity present in the entire domain—one with the topology of a ring) does seem to stay constant—as is promised by the Crank-Nicolson scheme. The integral stays “numerically the same” (within a small tolerance) even if obviously, there are now fluxes at both the ends. (An initial condition of a symmetrical saw-tooth profile defined between $y = 0.0$ and $y = 1.0$, does come to asymptotically approach the horizontal straight-line at $y = 0.5$. That is what happens at run-time, so obviously, the scheme seems to handle the fluxes right.)

Anyway, I don’t always write everything from the scratch; I am a great believer in lifting codes already written by others (with attribution, of course :)). Thus, while thus searching on the ‘net for some already existing resources on numerically modeling the Schrodinger equation (preferably with code!), I also ran into some papers on the simulation of SE using ABCs (i.e., the absorbing boundary conditions). I was not sure, however, if I should implement the ABCs immediately…

As of today, I think that I am going to try and graduate from the transient diffusion equation (with the CN scheme and PBCs), to a trial of the implicit TDSE without leap-frogging, as outlined above. The only question is whether I should throw in the PBCs to go with that or the ABCs. Or, may be, neither, and just keep pinning the  $\Psi$ values for the end- and ghost-nodes down to $0$, thereby effectively putting the entire simulation inside an infinite box?

At this point of time, I am tempted to try out the last. Thus, I think that I would rather first explore the staggering vs. non-staggering issue for a pulse in an infinite box, and understand it better, before proceeding to implement either the PBCs or the ABCs. Of course, I still have to think more about it… But hey, as I said, I am now in a mood of implementing, not of contemplating.

Why not upload the programs right away?

BTW, all these programs (TISE with matrix method, TDSE on the lines of Nagel/Cooper’s codes, transient DE with PBCs, etc.) are still in a fluid state, and so, I am not going to post them immediately here (though over a period of time, I sure would).

The reason for not posting the code runs something like this: Sometimes, I use the Python range objects for indexing. (I saw this goodie in Nagel’s code.) At other times, I don’t. But even when I don’t use the range objects, I anyway am tempted to revise the code so as to have them (for a better run-time efficiency).

Similarly, for the CN method, when it comes to solving the matrix equation at each time-step, I am still not using the TDMA (the Thomas algorithm) or even just sparse matrices. Instead, right now, I am allocating the entire $N \times N$ sized matrices, and am directly using NumPy’s LinAlg’s solve() function on these biggies. No, the computational load doesn’t show up; after all, I anyway have to use a 0.1 second pause in between the rendering passes, and the biggest matrices I tried were only $1001 \times 1001$ in size. (Remember, this is just a $1D$ simulation.) Even then, I am tempted a bit to improve the efficiency. For these and similar reasons, some or the other tweaking is still going on in all the programs. That’s why, I won’t be uploading them right away.

Anything else about my new approach, like delivering a seminar or so? Any news from the Indian physicists?

I had already contacted a couple of physics professors from India, both from Pune: one, about 1.5 years ago, and another, within the last 6 months. Both these times, I offered to become a co-guide for some computational physics projects to be done by their PG/UG students or so. Both times (what else?) there was absolutely no reply to my emails. … If they were to respond, we could have together progressed further on simulating my approach. … I have always been “open” about it.

The above-mentioned experience is precisely similar to how there have been no replies when I wrote to some other professors of physics, i.e., when I offered to conduct a seminar (covering my new approach) in their departments. Particularly, from the young IISER Pune professor whom I had written. … Oh yes, BTW, there has been one more physicist who I contacted recently for a seminar (within the last month). Once again, there has been no reply. (This professor is known to enjoy hospitality abroad as an Indian, and also use my taxpayer’s money for research while in India.)

No, the issue is not whether the emails I write using my Yahoo! account go into their span folder—or something like that. That would be too innocuous a cause, and too easy to deal with—every one has a mobile-phone these days. But I know these (Indian) physicists. Their behaviour remains exactly the same even if I write my emails using a respectable academic email ID (my employers’, complete with a .edu domain). This was my experience in 2016, and it repeated again in 2017.

The bottom-line is this: If you are an engineer and if you write to these Indian physicists, there is almost a guarantee that your emails will go into a black-hole. They will not reply to you even if you yourself have a PhD, and are a Full Professor of engineering (even if only on an ad-hoc basis), and have studied and worked abroad, and even if your blog is followed internationally. So long as you are engineer, and mention QM, the Indian physicists simply shut themselves off.

However, there is a trick to get them to reply you. Their behavior does temporarily change when you put some impressive guy in your cc-field (e.g., some professor friend of yours from some IIT). In this case, they sometimes do reply your first email. However, soon after that initial shaking of hands, they somehow go back to their true core; they shut themselves off.

And this is what invariably happens with all of them—no matter what other Indian bloggers might have led you to believe.

There must be some systemic reasons for such behavior, you say? Here, I will offer a couple of relevant observations.

Systemically speaking, Indian physicists, taken as a group (and leaving any possible rarest of the rare exceptions aside), all fall into one band: (i) The first commonality is that they all are government employees. (ii) The second commonality they all tend to be leftists (or, heavily leftists). (iii) The third commonality is they (by and large) share is that they had lower (or far lower) competitive scores in the entrance examinations at the gateway points like XII, GATE/JAM, etc.

The first factor typically means that they know that no one is going to ask them why they didn’t reply (even to people like with my background). The second factor typically means that they don’t want to give you any mileage, not even just a plain academic respect, if you are not already one of “them”. The third factor typically means that they simply don’t have the very intellectual means to understand or judge anything you say if it is original—i.e., if it is not based on some work of someone from abroad. In plain words: they are incompetent. (That in part is the reason whenever I run into a competent Indian physicist, it is both a surprise and a pleasure. To drop a couple of names: Prof. Kanhere (now retired) from UoP (now SPPU), and Prof. Waghmare of JNCASR. … But leaving aside this minuscule minority, and coming to the rest of the herd: the less said, the better.)

In short, Indian physicists all fall into a band. And they all are very classical—no tunneling is possible. Not with these Indian physicists. (The trends, I guess, are similar all over the world. Yet, I definitely can say that Indians are worse, far worse, than people from the advanced, Western, countries.)

Anyway, as far as the path through the simulations goes, since no help is going to come from these government servants (regarded as physicists by foreigners), I now realized that I have to get going about it—simulations for my new approach—entirely on my own. If necessary, from the basic of the basics. … And that’s how I got going with these programs.

Are these programs going to provide a peek into my new approach?

No, none of these programs I talked about in this post is going to be very directly helpful for simulations related to my new approach. The programs I wrote thus far are all very, very standard (simplest UG text-book level) stuff. If resolving QM riddles were that easy, any number of people would have done it already.

… So, the programs I wrote over the last couple of weeks are nothing but just a beginning. I have to cover a lot of distance. It may take months, perhaps even a year or so. But I intend to keep working at it. At least in an off and on manner. I have no choice.

And, at least currently, I am going about it at a fairly good speed.

For the same reason, expect no further blogging for another 2–3 weeks or so.

But one thing is for certain. As soon as my paper on my new approach (to be written after running the simulations) gets written, I am going to quit QM. The field does not hold any further interest to me.

Coming to you: If you still wish to know more about my new approach before the paper gets written, then you convince these Indian professors of physics to arrange for my seminar. Or, else…

… What else? Simple! You. Just. Wait.

[Or see me in person if you would be visiting India. As I said, I have always been “open” from my side, and I continue to remain so.]

A song I like:
(Hindi) “bheegee bheegee fizaa…”
Music: Hemant Kumar
Singer: Asha Bhosale
Lyrics: Kaifi Aazmi

History:
Originally published: 2018.11.26 18:12 IST
Extension and revision: 2018.11.27 19.29 IST

# I am keeping my New Year’s…

I am keeping my NYR [^], made last year.

No, really. I AM keeping my NYR. Here’s how.

December is meant for making resolutions. (It doesn’t matter whether it’s the 1st or the 31st; the month is [the?] December; that’s what matters.)

Done.

January is meant for making a time-table. … But it must be something on which you can execute. I have been actively engaged doing that. … You could see that, couldn’t you? … And, what’s more, you could’ve bet about it at any time in the past, too, couldn’t you?

Since execution can only follow, and not precede, planning, it must be February before execution proper itself can begin. As far as I am concerned, I will make sure of that. [And you know me. You know that I always deliver on all my promises, don’t you?]

March is known for madness. To be avoided, of course.

April is known for foolishness. To be avoided, as far as possible, but, hey, as “friends” of this blog, you know, it’s nothing to be afraid of!

May, in this part of the world, is far too hot for any one to handle it right, OK? The work-efficiency naturally drops down. This fact must be factored into any and every good piece of planning, I say! (Recall the British Governors and Other officers of the Bombay Presidency shifting their offices to Matheran/Mahabaleshwar during summer? [Anyone ever cared to measure the efficiency of this measure on their part? I mean, on work?])

Now, yes, June does bring in the [very welcome] monsoons, finally! But then, monsoon also is universally known to be the most romantic of all seasons. [It leaves a certain something of a feeling which ordinarily would require you to down a Sundowner or so. [I am trying to be honest, here!]… And then, even Kalidas would seem to agree. Remember (Sanskrit) “aashaaDhasya pratham…”? Naturally, the month is not very conducive to work, is it?]

OK.

This is [just] January, and my time-table is all done up and ready. Or, at least, it’s [at least] half-way through. …

I will really, really begin work in the second half of the year.

Bye until then.

A Song I Don’t Ever Recall Liking Back Then [When Things Mattered Far More Routinely in Far More Respects than They Do Today]

[Not too sure I like it today either. But there were certain happy isolated instances related to my more recent career which are associated with it. I had registered, but hadn’t known this fact, until recently.

But then, recently, I happened suddenly to “re-hear” the phrase (Hindi) “yeh kaunsaa…”, complete with the piece of the “sax” which follows it…

Then, the world had become [in a [comparatively] recent past] a slightly better place to live in.

So, I’d decided, not quite fully certain but still being inclined to this possibility, that I might actually like this song. … But I still don’t fully, you know… But I still do fully want to run it, you know…

Anyway, just listen to it…]

(Hindi) “chocolate, lime juice, ice-cream…” [No, it really is a Hindi song. Just listen to it further…]
Singer: Lata Mangeshkar [A peculiarity of this song is that precisely when [an aged] Lata sounds [a bit] heavy [of course due to the age not to mention the pressures of the day-to-day work and every one’s normal inability to hit the sweet spot every time!], the directors of the movie and the music together focus your attention on a rather cheerfully smiling and dancing Madhuri. [No, never been one of my favorite actresses, but then, that’s an entirely different story altogether.]]
Music: Ramlaxman
Lyrics: Dev Kohli [?]

[PS: And, coming to the video of this song, did you notice that the hero drives a Maruti Gypsy?

I mean, ask any NRI in USA, and they he will tell you that it was because this was an early 90’s movie; the fruits of the [half-/quarter-/oct-something-/etc.] economic liberalization had still not been had by the general public; the liberalization they [I mean these NRIs] had brought about.

If these [I mean the economic freedoms] were to be brought about , they could easily point out, with good amount of references to Hindi movies of the recent years, that the presence on Indian roads of the [government-subsidized-diesel-driven] SUVs could easily have been seen in the same movie!!!

Hmmm…  Point[s] taken.]

[A bit of an editing is still due, I am sure… TBD, when I get the time to do so…]

# Yes I know it!

Note: A long update was posted on 12th December 2017, 11:35 IST.

This post is spurred by my browsing of certain twitter feeds of certain pop-sci. writers.

The URL being highlighted—and it would be, say, “negligible,” but for the reputation of the Web domain name on which it appears—is this: [^].

I want to remind you that I know the answers to all the essential quantum mysteries.

Not only that, I also want to remind you that I can discuss about them, in person.

It’s just that my circumstances—past, and present (though I don’t know about future)—which compel me to say, definitely, that I am not available for writing it down for you (i.e. for the layman) whether here or elsewhere, as of now. Neither am I available for discussions on Skype, or via video conferencing, or with whatever “remoting” mode you have in mind. Uh… Yes… WhatsApp? Include it, too. Or something—anything—like that. Whether such requests come from some millionaire Indian in USA (and there are tons of them out there), or otherwise. Nope. A flat no is the answer for all such requests. They are out of question, bounds… At least for now.

… Things may change in future, but at least for the time being, the discussions would have to be with those who already have studied (the non-relativistic) quantum physics as it is taught in universities, up to graduate (PhD) level.

And, you have to have discussions in person. That’s the firm condition being set (for the gain of their knowledge 🙂 ).

Just wanted to remind you, that’s all!

Update on 12th December 2017, 11:35 AM IST:

I have moved the update to a new post.

A Song I Like:

(Western, Instrumental) “Berlin Melody”
Credits: Billy Vaughn

[The same 45 RPM thingie [as in here [^], and here [^]] . … I was always unsure whether I liked this one better or the “Come September” one. … Guess, after the n-th thought, that it was this one. There is an odd-even thing about it. For odd ‘n” I think this one is better. For even ‘n’, I think the “Come September” is better.

… And then, there also are a few more musical goodies which came my way during that vacation, and I will make sure that they find their way to you too….

Actually, it’s not the simple odd-even thing. The maths here is more complicated than just the binary logic. It’s an n-ary logic. And, I am “equally” divided among them all. (4+ decades later, I still remain divided.)… (But perhaps the “best” of them was a Marathi one, though it clearly showed a best sort of a learning coming from also the Western music. I will share it the next time.)]

[As usual, may be, another revision [?]… Is it due? Yes, one was due. Have edited streamlined the main post, and then, also added a long update on 12th December 2017, as noted above.]

# Fluxes, scalars, vectors, tensors…. and, running in circles about them!

0. This post is written for those who know something about Thermal Engineering (i.e., fluid dynamics, heat transfer, and transport phenomena) say up to the UG level at least. [A knowledge of Design Engineering, in particular, the tensors as they appear in solid mechanics, would be helpful to have but not necessary. After all, contrary to what many UGC and AICTE-approved (Full) Professors of Mechanical Engineering teaching ME (Mech – Design Engineering) courses in SPPU and other Indian universities believe, tensors not only appear also in fluid mechanics, but, in fact, the fluids phenomena make it (only so slightly) easier to understand this concept. [But all these cartoons characters, even if they don’t know even this plain and simple a fact, can always be fully relied (by anyone) about raising objections about my Metallurgy background, when it comes to my own approval, at any time! [Indians!!]]]

In this post, I write a bit about the following question:

Why is the flux $\vec{J}$ of a scalar $\phi$ a vector quantity, and not a mere number (which is aka a “scalar,” in certain contexts)? Why is it not a tensor—whatever the hell the term means, physically?

And, what is the best way to define a flux vector anyway?

1.

One easy answer is that if the flux is a vector, then we can establish a flux-gradient relationship. Such relationships happen to appear as statements of physical laws in all the disciplines wherever the idea of a continuum was found useful. So the scope of the applicability of the flux-gradient relationships is very vast.

The reason to define the flux as a vector, then, becomes: because the gradient of a scalar field is a vector field, that’s why.

But this answer only tells us about one of the end-purposes of the concept, viz., how it can be used. And then the answer provided is: for the formulation of a physical law. But this answer tells us nothing by way of the very meaning of the concept of flux itself.

2.

Another easy answer is that if it is a vector quantity, then it simplifies the maths involved. Instead of remembering having to take the right $\theta$ and then multiplying the relevant scalar quantity by the $\cos$ of this $\theta$, we can more succinctly write:

$q = \vec{J} \cdot \vec{S}$ (Eq. 1)

where $q$ is the quantity of $\phi$, an intensive scalar property of the fluid flowing across a given finite surface, $\vec{S}$, and $\vec{J}$ is the flux of $\Phi$, the extensive quantity corresponding to the intensive quantity $\phi$.

However, apart from being a mere convenience of notation—a useful shorthand—this answer once again touches only on the end-purpose, viz., the fact that the idea of flux can be used to calculate the amount $q$ of the transported property $\Phi$.

There also is another problem with this, second, answer.

Notice that in Eq. 1, $\vec{J}$ has not been defined independently of the “dotting” operation.

If you have an equation in which the very quantity to be defined itself has an operator acting on it on one side of an equation, and then, if a suitable anti- or inverse-operator is available, then you can apply the inverse operator on both sides of the equation, and thereby “free-up” the quantity to be defined itself. This way, the quantity to be defined becomes available all by itself, and so, its definition in terms of certain hierarchically preceding other quantities also becomes straight-forward.

OK, the description looks more complex than it is, so let me illustrate it with a concrete example.

Suppose you want to define some vector $\vec{T}$, but the only basic equation available to you is:

$\vec{R} = \int \text{d} x \vec{T}$, (Eq. 2)

assuming that $\vec{T}$ is a function of position $x$.

In Eq. 2, first, the integral operator must operate on $\vec{T}(x)$ so as to produce some other quantity, here, $\vec{R}$. Thus, Eq. 2 can be taken as a definition for $\vec{R}$, but not for $\vec{T}$.

However, fortunately, a suitable inverse operator is available here; the inverse of integration is differentiation. So, what we do is to apply this inverse operator on both sides. On the right hand-side, it acts to let $\vec{T}$ be free of any operator, to give you:

$\dfrac{\text{d}\vec{R}}{\text{d}x} = \vec{T}$ (Eq. 3)

It is the Eq. 3 which can now be used as a definition of $\vec{T}$.

In principle, you don’t have to go to Eq. 3. In principle, you could perhaps venture to use a bit of notation abuse (the way the good folks in the calculus of variations and integral transforms always did), and say that the Eq. 2 itself is fully acceptable as a definition of $\vec{T}$. IMO, despite the appeal to “principles”, it still is an abuse of notation. However, I can see that the argument does have at least some point about it.

But the real trouble with using Eq. 1 (reproduced below)

$q = \vec{J} \cdot \vec{S}$ (Eq. 1)

as a definition for $\vec{J}$ is that no suitable inverse operator exists when it comes to the dot operator.

3.

Let’s try another way to attempt defining the flux vector, and see what it leads to. This approach goes via the following equation:

$\vec{J} \equiv \dfrac{q}{|\vec{S}|} \hat{n}$ (Eq. 4)

where $\hat{n}$ is the unit normal to the surface $\vec{S}$, defined thus:

$\hat{n} \equiv \dfrac{\vec{S}}{|\vec{S}|}$ (Eq. 5)

Then, as the crucial next step, we introduce one more equation for $q$, one that is independent of $\vec{J}$. For phenomena involving fluid flows, this extra equation is quite simple to find:

$q = \phi \rho \dfrac{\Omega_{\text{traced}}}{\Delta t}$ (Eq. 6)

where $\phi$ is the mass-density of $\Phi$ (the scalar field whose flux we want to define), $\rho$ is the volume-density of mass itself, and $\Omega_{\text{traced}}$ is the volume that is imaginarily traced by that specific portion of fluid which has imaginarily flowed across the surface $\vec{S}$ in an arbitrary but small interval of time $\Delta t$. Notice that $\Phi$ is the extensive scalar property being transported via the fluid flow across the given surface, whereas $\phi$ is the corresponding intensive quantity.

Now express $\Omega_{\text{traced}}$ in terms of the imagined maximum normal distance from the plane $\vec{S}$ up to which the forward moving front is found extended after $\Delta t$. Thus,

$\Omega_{\text{traced}} = \xi |\vec{S}|$ (Eq. 7)

where $\xi$ is the traced distance (measured in a direction normal to $\vec{S}$). Now, using the geometric property for the area of parallelograms, we have that:

$\xi = \delta \cos\theta$ (Eq. 8)

where $\delta$ is the traced distance in the direction of the flow, and $\theta$ is the angle between the unit normal to the plane $\hat{n}$ and the flow velocity vector $\vec{U}$. Using vector notation, Eq. 8 can be expressed as:

$\xi = \vec{\delta} \cdot \hat{n}$ (Eq. 9)

Now, by definition of $\vec{U}$:

$\vec{\delta} = \vec{U} \Delta t$, (Eq. 10)

Substituting Eq. 10 into Eq. 9, we get:

$\xi = \vec{U} \Delta t \cdot \hat{n}$ (Eq. 11)

Substituting Eq. 11 into Eq. 7, we get:

$\Omega_{\text{traced}} = \vec{U} \Delta t \cdot \hat{n} |\vec{S}|$ (Eq. 12)

Substituting Eq. 12 into Eq. 6, we get:

$q = \phi \rho \dfrac{\vec{U} \Delta t \cdot \hat{n} |\vec{S}|}{\Delta t}$ (Eq. 13)

Cancelling out the $\Delta t$, Eq. 13 becomes:

$q = \phi \rho \vec{U} \cdot \hat{n} |\vec{S}|$ (Eq. 14)

Having got an expression for $q$ that is independent of $\vec{J}$, we can now use it in order to define $\vec{J}$. Thus, substituting Eq. 14 into Eq. 4:

$\vec{J} \equiv \dfrac{q}{|\vec{S}|} \hat{n} = \dfrac{\phi \rho \vec{U} \cdot \hat{n} |\vec{S}|}{|\vec{S}|} \hat{n}$ (Eq. 16)

Cancelling out the two $|\vec{S}|$s (because it’s a scalar—you can always divide any term by a scalar (or even  by a complex number) but not by a vector), we finally get:

$\vec{J} \equiv \phi \rho \vec{U} \cdot \hat{n} \hat{n}$ (Eq. 17)

In Eq. 17, there is this curious sequence: $\hat{n} \hat{n}$.

It’s a sequence of two vectors, but the vectors apparently are not connected by any of the operators that are taught in the Engineering Maths courses on vector algebra and calculus—there is neither the dot ($\cdot$) operator nor the cross $\times$ operator appearing in between the two $\hat{n}$s.

But, for the time being, let’s not get too much perturbed by the weird-looking sequence. For the time being, you can mentally insert parentheses like these:

$\vec{J} \equiv \left[ \left( \phi \rho \vec{U} \right) \cdot \left( \hat{n} \right) \right] \hat{n}$ (Eq. 18)

and see that each of the two terms within the parentheses is a vector, and that these two vectors are connected by a dot operator so that the terms within the square brackets all evaluate to a scalar. According to Eq. 18, the scalar magnitude of the flux vector is:

$|\vec{J}| = \left( \phi \rho \vec{U}\right) \cdot \left( \hat{n} \right)$ (Eq. 19)

and its direction is given by: $\hat{n}$ (the second one, i.e., the one which appears in Eq. 18 but not in Eq. 19).

5.

We explained away our difficulty about Eq. 17 by inserting parentheses at suitable places. But this procedure of inserting mere parentheses looks, by itself, conceptually very attractive, doesn’t it?

If by not changing any of the quantities or the order in which they appear, and if by just inserting parentheses, an equation somehow begins to make perfect sense (i.e., if it seems to acquire a good physical meaning), then we have to wonder:

Since it is possible to insert parentheses in Eq. 17 in some other way, in some other places—to group the quantities in some other way—what physical meaning would such an alternative grouping have?

That’s a delectable possibility, potentially opening new vistas of physico-mathematical reasonings for us. So, let’s pursue it a bit.

What if the parentheses were to be inserted the following way?:

$\vec{J} \equiv \left( \hat{n} \hat{n} \right) \cdot \left( \phi \rho \vec{U} \right)$ (Eq. 20)

On the right hand-side, the terms in the second set of parentheses evaluate to a vector, as usual. However, the terms in the first set of parentheses are special.

The fact of the matter is, there is an implicit operator connecting the two vectors, and if it is made explicit, Eq. 20 would rather be written as:

$\vec{J} \equiv \left( \hat{n} \otimes \hat{n} \right) \cdot \left( \phi \rho \vec{U} \right)$ (Eq. 21)

The $\otimes$ operator, as it so happens, is a binary operator that operates on two vectors (which in general need not necessarily be one and the same vector as is the case here, and whose order with respect to the operator does matter). It produces a new mathematical object called the tensor.

The general form of Eq. 21 is like the following:

$\vec{V} = \vec{\vec{T}} \cdot \vec{U}$ (Eq. 22)

where we have put two arrows on the top of the tensor, to bring out the idea that it has something to do with two vectors (in a certain order). Eq. 22 may be read as the following: Begin with an input vector $\vec{U}$. When it is multiplied by the tensor $\vec{\vec{T}}$, we get another vector, the output vector: $\vec{V}$. The tensor quantity $\vec{\vec{T}}$ is thus a mapping between an arbitrary input vector and its uniquely corresponding output vector. It also may be thought of as a unary operator which accepts a vector on its right hand-side as an input, and transforms it into the corresponding output vector.

6. “Where am I?…”

Now is the time to take a pause and ponder about a few things. Let me begin doing that, by raising a few questions for you:

Q. 6.1:

What kind of a bargain have we ended up with? We wanted to show how the flux of a scalar field $\Phi$ must be a vector. However, in the process, we seem to have adopted an approach which says that the only way the flux—a vector—can at all be defined is in reference to a tensor—a more advanced concept.

Instead of simplifying things, we seem to have ended up complicating the matters. … Have we? really? …Can we keep the physical essentials of the approach all the same and yet, in our definition of the flux vector, don’t have to make a reference to the tensor concept? exactly how?

(Hint: Look at the above development very carefully once again!)

Q. 6.2:

In Eq. 20, we put the parentheses in this way:

$\vec{J} \equiv \left( \hat{n} \hat{n} \right) \cdot \left( \phi \rho \vec{U} \right)$ (Eq. 20, reproduced)

What would happen if we were to group the same quantities, but alter the order of the operands for the dot operator?  After all, the dot product is commutative, right? So, we could have easily written Eq. 20 rather as:

$\vec{J} \equiv \left( \phi \rho \vec{U} \right) \cdot \left( \hat{n} \hat{n} \right)$ (Eq. 21)

What could be the reason why in writing Eq. 20, we might have made the choice we did?

Q. 6.3:

We wanted to define the flux vector for all fluid-mechanical flow phenomena. But in Eq. 21, reproduced below, what we ended up having was the following:

$\vec{J} \equiv \left( \phi \rho \vec{U} \right) \cdot \left( \hat{n} \otimes \hat{n} \right)$ (Eq. 21, reproduced)

Now, from our knowledge of fluid dynamics, we know that Eq. 21 seemingly stands only for one kind of a flux, namely, the convective flux. But what about the diffusive flux? (To know the difference between the two, consult any good book/course-notes on CFD using FVM, e.g. Jayathi Murthy’s notes at Purdue, or Versteeg and Malasekara’s text.)

Q. 6.4:

Try to pursue this line of thought a bit:

$q = \vec{J} \cdot \vec{S}$ (Eq. 1, reproduced)

Express $\vec{S}$ as a product of its magnitude and direction:

$q = \vec{J} \cdot |\vec{S}| \hat{n}$ (Eq. 23)

Divide both sides of Eq. 23 by $|\vec{S}|$:

$\dfrac{q}{|\vec{S}|} = \vec{J} \cdot \hat{n}$ (Eq. 24)

“Multiply” both sides of Eq. 24 by $\hat{n}$:

$\dfrac{q} {|\vec{S}|} \hat{n} = \vec{J} \cdot \hat{n} \hat{n}$ (Eq. 25)

We seem to have ended up with a tensor once again! (and more rapidly than in the development in section 4. above).

Now, looking at what kind of a change the left hand-side of Eq. 24 undergoes when we “multiply” it by a vector (which is: $\hat{n}$), can you guess something about what the “multiplication” on the right hand-side by $\hat{n}$ might mean? Here is a hint:

To multiply a scalar by a vector is meaningless, really speaking. First, you need to have a vector space, and then, you are allowed to take any arbitrary vector from that space, and scale it up (without changing its direction) by multiplying it with a number that acts as a scalar. The result at least looks the same as “multiplying” a scalar by a vector.

What then might be happening on the right hand side?

Q.6.5:

Recall your knowledge (i) that vectors can be expressed as single-column or single-row matrices, and (ii) how matrices can be algebraically manipulated, esp. the rules for their multiplications.

Try to put the above developments using an explicit matrix notation.

In particular, pay particular attention to the matrix-algebraic notation for the dot product between a row- or column-vector and a square matrix, and the effect it has on your answer to question Q.6.2. above. [Hint: Try to use the transpose operator if you reach what looks like a dead-end.]

Q.6.6.

Suppose I introduce the following definitions: All single-column matrices are “primary” vectors (whatever the hell it may mean), and all single-row matrices are “dual” vectors (once again, whatever the hell it may mean).

Given these definitions, you can see that any primary vector can be turned into its corresponding dual vector simply by applying the transpose operator to it. Taking the logic to full generality, the entirety of a given primary vector-space can then be transformed into a certain corresponding vector space, called the dual space.

Now, using these definitions, and in reference to the definition of the flux vector via a tensor (Eq. 21), but with the equation now re-cast into the language of matrices, try to identify the physical meaning the concept of “dual” space. [If you fail to, I will sure provide a hint.]

As a part of this exercise, you will also be able to figure out which of the two $\hat{n}$s forms the “primary” vector space and which $\hat{n}$ forms the dual space, if the tensor product $\hat{n}\otimes\hat{n}$ itself appears (i) before the dot operator or (ii) after the dot operator, in the definition of the flux vector. Knowing the physical meaning for the concept of the dual space of a given vector space, you can then see what the physical meaning of the tensor product of the unit normal vectors ($\hat{n}$s) is, here.

Over to you. [And also to the UGC/AICTE-Approved Full Professors of Mechanical Engineering in SPPU and in other similar Indian universities. [Indians!!]]

A Song I Like:

[TBD, after I make sure all LaTeX entries have come out right, which may very well be tomorrow or the day after…]

In the recent couple of weeks, I had not found much time to check out blogs on a very regular basis. But today I did find some free time, and so I did do a routine round-up of the blogs. In the process, I came across a couple of interesting posts by Prof. Dheeraj Sanghi of IIIT Delhi. (Yes, it’s IIIT Delhi, not IIT Delhi.)

The latest post by Prof. Sanghi is about achieving excellence in Indian universities [^]. He offers valuable insights by taking a specific example, viz., that of the IIIT Delhi. I would like to leave this post for the attention of [who else] the education barons in Pune and the SPPU authorities. [Addendum: Also this post [^] by Prof. Pankaj Jalote, Director of IIIT Delhi.]

Prof. Sanghi’s second (i.e. earlier) post is about the current (dismal) state of the CS education in this country. [^].

As someone who has a direct work-experience in both the IT industry as well as in teaching in mechanical engineering departments in “private” engineering colleges in India, the general impression I seem to have developed seemed to be a bit at odds with what was being reported in this post by Prof. Sanghi (and by his readers, in its comments section). Of course, Prof. Sanghi was restricting himself only to the CS graduates, but still, the comments did hint at the overall trend, too.

So, I began writing a comment at Prof. Sanghi’s blog, but, as usual, my comment soon grew too big. It became big enough that I finally had to convert it into a separate post here. Let me share these thoughts of mine, below.

As compared to the CS graduates in India, and speaking in strictly relative terms, the mechanical engineering students seem to be doing better, much better, as far the actual learning being done over the 4 UG years is concerned. Not just the top 1–2%, but even the top 15–20% of the mechanical engineering students, perhaps even the top quarter, do seem to be doing fairly OK—even if it could be, perhaps, only at a minimally adequate level when compared to the international standards.

… No, even for the top quarter of the total student population (in mechanical engineering, in “private” colleges), their fundamental concepts aren’t always as clear as they need to be. More important, excepting the top (may be) 2–5%, others within the top quarter don’t seem to be learning the art of conceptual analysis of mathematics, as such. They probably would not always be able to figure out the meaning of even a simplest variation on an equation they have already studied.

For instance, even after completing a course (or one-half part of a semester-long course) on vibrations, if they are shown the following equation for the classical transverse waves on a string:

$\dfrac{\partial^2 \psi(x,t)}{\partial x^2} + U(x,t) = \dfrac{1}{c^2}\dfrac{\partial^2 \psi(x,t)}{\partial t^2}$,

most of them wouldn’t be able to tell the physical meaning of the second term on the left hand-side—not even if they are asked to work on it purely at their own convenience, at home, and not on-the-fly and under pressure, say during a job interview or a viva voce examination.

However, change the notation used for second term from $U(x,t)$ to $S(x,t)$ or $F(x,t)$, and then, suddenly, the bulb might flash on, but for only some of the top quarter—not all. … This would be the case, even if in their course on heat transfer, they have been taught the detailed derivation of a somewhat analogous equation: the equation of heat conduction with the most general case, including the possibly non-uniform and unsteady internal heat generation. … I am talking about the top 25% of the graduating mechanical engineers from private engineering colleges in SPPU and University of Mumbai. Which means, after leaving aside a lot of other top people who go to IITs and other reputed colleges like BITS Pilani, COEP, VJTI, etc.

IMO, their professors are more responsible for the lack of developing such skills than are the students themselves. (I was talking of the top quarter of the students.)

Yet, I also think that these students (the top quarter) are at least “passable” as engineers, in some sense of the term, if not better. I mean to say, looking at their seminars (i.e. the independent but guided special studies, mostly on the student-selected topics, for which they have to produce a small report and make a 10–15 minutes’ presentation) and also looking at how they work during their final year projects, sure, they do seem to have picked up some definite competencies in mechanical engineering proper. In their projects, most of the times, these students may only be reproducing some already reported results, or trying out minor variations on existing machine designs, which is what is expected at the UG level in our university system anyway. But still, my point is, they often are seen taking some good efforts in actually fabricating machines on their own, and sometimes they even come up with some good, creative, or cost-effective ideas in their design- or fabrication-activities.

Once again, let me remind you: I was talking about only the top quarter or so of the total students in private colleges (and from mechanical engineering).

The bottom half is overall quite discouraging. The bottom quarter of the degree holders are mostly not even worth giving a post X-standard, 3 year’s diploma certificate. They wouldn’t be able to write even a 5 page report on their own. They wouldn’t be able to even use the routine metrological instruments/gauges right. … Let’s leave them aside for now.

But the top quarter in the mechanical departments certainly seems to be doing relatively better, as compared to the those from the CS departments. … I mean to say: if these CS folks are unable to write on their own even just a linked-list program in C (using pointers and memory allocation on the heap), or if their final-year projects wouldn’t exceed (independently written) 100+ lines of code… Well, what then is left on this side for making comparisons anyway? … Contrast: At COEP, my 3rd year mechanical engineering students were asked to write a total of more than 100 lines of C code, as part of their routine course assignments, during a single semester-long course on FEM.

… Continuing with the mechanical engineering students, why, even in the decidedly average (or below average) colleges in Mumbai and Pune, some kids (admittedly, may be only about 10% or 15% of them) can be found taking some extra efforts to learn some extra skills from the outside of our pathetic university system. Learning CAD/CAM/CAE software by attending private training institutes, has become a pretty wide-spread practice by now.

No, with these courses, they aren’t expected to become FEM/CFD experts, and they don’t. But at least they do learn to push buttons and put mouse-clicks in, say, ProE/SolidWorks or Ansys. They do learn to deal with conversions between different file formats. They do learn that meshes generated even in the best commercial software could sometimes be not of sufficiently high quality, or that importing mesh data into a different analysis program may render the mesh inconsistent and crash the analysis. Sometimes, they even come to master setting the various boundary condition options right—even if only in that particular version of that particular software. However, they wouldn’t be able to use a research level software like OpenFOAM on their own—and, frankly, it is not expected of them, not at their level, anyway.

They sometimes are also seen taking efforts on their own, in finding sponsorships for their BE projects (small-scale or big ones), sometimes even in good research institutions (like BARC). In fact, as far as the top quarter of the BE student projects (in the mechanical departments, in private engineering colleges) go, I often do get the definite sense that any lacunae coming up in these projects are not attributable so much to the students themselves as to the professors who guide these projects. The stories of a professor shooting down a good project idea proposed by a student simply because the professor himself wouldn’t have any clue of what’s going on, are neither unheard of nor entirely without merit.

So, yes, the overall trend even in the mechanical engineering stream is certainly dipping downwards, that’s for sure. Yet, the actual fall—its level—does not seem to be as bad as what is being reported about CS.

My two cents.

Today is India’s National Science Day. Greetings!

Will stay busy in moving and getting settled in the new job. … Don’t look for another post for another couple of weeks. … Take care, and bye for now.

[Finished doing minor editing touches on 28 Feb. 2017, 17:15 hrs.]