The QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads
 

Well, to me, the peak seems to be the highest possible value. Am I doing something wrong?

by (Login MCalkins)
Moderator

I wrote a program to find the peak, using your formula. It seems to peak the higher I go. Change stp to work in different increments. 99.99999999999996% seems peak with lousy double precision.
I'm not sure why my results contradict yours, unless I'm using the wrong x value or t1 value, but it doesn't seem to make a difference.
Regards,
Michael

CLS
DEFDBL A-Z
c = 300000
stp = 1 'change this value to adjust step
lower = c - stp * 1000
upper = c - stp
t1 = 1
best = 0
x = 1
FOR v = lower TO upper STEP stp
 t2 = (t1 - v / c ^ 2 * x) / SQR(1 - v ^ 2 / c ^ 2)
 'find highest t2 value in range
 IF t2 > best THEN best = cur: btrk = v
NEXT v
PRINT t1; t2; best; btrk; STR$((btrk / c) * 100); "%"

Posted on May 4, 2005, 9:10 PM

Respond to this message   

Return to Index


Response TitleAuthor and Date
Re: Well, to me, the peak seems to be the highest possible value. Am I doing something wrong?Walrus on May 4
 Thanks for the help. I made improvements, but something still seems wrong. on May 5
  Re: Thanks for the help. I made improvements, but something still seems wrong.Walrus on May 7
   *ok on May 7

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums