comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: endless loop problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: endless loop problem [message #68953] Sun, 06 December 2009 18:21 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Dec 6, 11:20 pm, Elkunn <wasit.weat...@gmail.com> wrote:
> On Dec 6, 5:52 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> pp writes:
>
>> .
>
>>> L does not change because you are calculating the same thing over and
>>> over again. L only depends on EC[0] and EC[1], and neither changes
>>> when you go through the loop. So if L does not happen to be
>>> <1.2840277, the loop will never end.
>
>> And it is not likely that it will *ever* be 1.2840277!
>
>>   http://www.dfanning.com//math_tips/sky_is_falling.html
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.dfanning.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> I should have given more explanations on this. L changes over each
> iteration. There is no problem. I missed one letter, here is the
> corrected one.
>     ;E1 = Unit vector, known
>     ; Z is  known matrix
>     REPEAT BEGIN
>         EC = Z##E1
>         L = sqrt(EC[0]+EC[1])
>         E1 = EC/L
>         print,L
>         ;Keep going until nothing is moved.
>     ENDREP UNTIL L LT 1.2840277
>
> I am struggling to find eigenvalues and eigenvectors manually, instead
> of IDL routines.
>
> I think it might be a problem as David pointed out. But there should
> be a value less than or greater than that value, right?
> Thanks

In that case, your problem is either that L never gets smaller than
that value, or it varies slowly enough that it only seems it will
never get there. If in fact it never gets smaller than that limit, it
is either a problem with the algorithm (meaning that iterating that
way, with that starting point, L will never get below that value), or
it is a precision problem (meaning that at some point the steps become
too small to change the big value L has).

To diagnose it, what is probably more useful than just printing L at
each step would be to also print its variation, since it may just be
smaller than is visible with the default number of digits print uses.
Something like:

L=0d0
REPEAT BEGIN
EC = Z##E1
old_L=L
L = sqrt(EC[0]+EC[1])
E1 = EC/L
print,L,L-old_L
;Keep going until nothing is moved.
ENDREP UNTIL L LT 1.2840277
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Why doesn't IDL know the borders of Kazakhstan?
Next Topic: ASSOC vs SHMMAP vs POINT_LUNs vs READ_BINARY?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 09:00:56 PDT 2025

Total time taken to generate the page: 0.72050 seconds