Re: c = inverse(sqrt(epsilon nought *mu nought))
- From: e p chandler <epc8@xxxxxxxx>
- Date: 18 May 2007 07:09:19 -0700
On May 17, 8:39 pm, Wade Ward <zaxf...@xxxxxxxxx> wrote:
On May 15, 6:53 pm, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
Wade Ward <zaxf...@xxxxxxxxx> wrote:
...x = 0.0_dp
I added the above, but not without compiler complaint with respect to
*where* the statements go. When I put them before:
position(RI,RJ,RK)=....
, it creates the following error:
: error 381 - POSITION is not an array.
When I place it right after that block, it compiles fine. What gives?
Well, the compiler is right. Position isn't an array. It is intended to
be a statement function, as the comment above it notes.
Statement functions have loist of quirks, which is why many people,
myself included, don't recommend using them in new code. I won't even
try to list all the quirks. It would take way too long (and I'd miss a
bunch of them unless I spent a few hours checking first).
Statement functions are syntactically very easy to confuse with
assignment statements. One result of that is that the compiler can get
confused also. If you have something that isn't a valid statement
function, you can get an error message from the compiler trying to
interpret it as an assignment. That's what happened here. The compiler
guessed that this might be intended as an assignment to an element of an
array named position, but there is no such array declared, so you get an
error message.
It isn't a valid statement function when you put the x=0.0_dp before it
because x=0.0_dp is an executable statement. Statement functions must be
in the specification part - i.e. before any executable statements.
What puzzles me is why you even have x in this code. It seems to have
nothing to do with the rest of the code; nothing ever references it.
Since it doesn't have anything to do with the rest of the code, it is a
bit hard to suggest sensibly what to do with it.
Statement functions? That's a new one. I'll have a look at MR&C.
x was set to the LHS of statement that involved U0 and E0. Since it
was buried in 6k of stuff that I didn't know how to trim out, it's
understandable that a person would miss the statement, which was:
x = (E0*U0)**(-.5)
EO was 10**-7 * 4pi and UO was 10**-9/36 pi . In the product, the
pi's cancel leaving the inverse square root of (10**-16 * 1/9). Both
are perfect squares, ergo
x= 1/(10**-8 * 1/3) which leaves x at 3 x 10**8. The speed of light
is as much of a constant as a person can imagine.
--
Wade Ward
Perhaps it might help to look at the text where these examples may
have originated. Based on the exercise numbers of two programs cited
and chapter titles (finite difference and method of moments) along
with Appendix D (it covers solution of simultaneous equations), I
suspect these may have come from "Numerical Techniques in
Electromagnetics", Matthew N. O. Sadiku, 2000, CRC Press, ISBN
0849313953. [Thanks to Google book search.]
This still leaves un-resolved this program's problems with out-of-
bounds references to arrays. In addition, there is quite a bit of
archaic code.
In the end, I believe that you need some knowledge of the problem
domain to get a handle on this program. (Sorry, not my field at
all. :-))
-- elliot
.
- Follow-Ups:
- Re: c = inverse(sqrt(epsilon nought *mu nought))
- From: Wade Ward
- Re: c = inverse(sqrt(epsilon nought *mu nought))
- References:
- c = inverse(sqrt(epsilon nought *mu nought))
- From: Wade Ward
- Re: c = inverse(sqrt(epsilon nought *mu nought))
- From: Richard Maine
- Re: c = inverse(sqrt(epsilon nought *mu nought))
- From: Wade Ward
- c = inverse(sqrt(epsilon nought *mu nought))
- Prev by Date: Re: Simple DO loops
- Next by Date: Re: Integral of the bivariate normal distribution over an offset circle
- Previous by thread: Re: c = inverse(sqrt(epsilon nought *mu nought))
- Next by thread: Re: c = inverse(sqrt(epsilon nought *mu nought))
- Index(es):