archive-com.com » COM » E » EFG2.COM

Total: 878

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • DO BEGIN FOR j 1 TO High x i DO BEGIN IF x j x j 1 THEN BEGIN Temporary x j x j x j 1 x j 1 Temporary END END END IF Odd High x range is 0 to High x High x 1 elements THEN BEGIN When High x is Odd there are an even number of elements in array Define median as average of two

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/MathFunctions/MedianInteger.TXT (2016-02-14)
    Open archived version from archive



  • loop outputs values in the range 1 m1 1 for s2 seeds in the range 1 m2 1 the loop outputs values in the range 1 m2 1 In other words after using all possible seed values the minimum value I got for s1 is 1 and its maximum value is m1 1 and similarly for s2 The ranges of values for s1 and s2 are then the same as those for their seeds Knowing this it is easy to deduce the range of the other variables Here s then is my implementation of L Ecuyer s 1988 random number generator The 1991 algorithm The work described above was done more or less in vain since while reading Pierre L Ecuyer and Shue Tezuka Structural properties for two classes of combined generators Mathematics of Computation 57 1991 735 746 I learned that by changing the numerical values in CMLCG1988 it is possible ot obtain according to the authors a LCG which has a lattice structure of slightly better quality and with much more noise The new numerical values to be used are The 1999 algorithms The algorithms I found in combmrg2 ps P L Ecuyer Good parameter sets for combined multiple recursive random number generators Figs I II III and Table VIII are however by far the best ones rem This PostScript file is available at http www iro umontreal ca lecuyer papers html In the article the code is written in C but it is really easy to translate it 0 0 then p1 p1 a14 m1 p1 p1 a14 s11 k SciRound p1 m1 p1 p1 k m1 if p1 0 0 then p2 p2 a23 m2 p2 p2 a23 s22 k SciRound p2 m2 p2 p2 k m2 if p2 p21 then Result p12 p21 norm else

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/MathFunctions/AndreRatel_RandomNotes.txt (2016-02-14)
    Open archived version from archive


  • to decide whether it returns an integer or floating point extended result For an integer result RandInt in System PAS is called For an extended result RandExt in System PAS is called Here are the assembly language routines from System PAS procedure RandInt asm EAX Range EAX Result IMUL EDX RandSeed 08088405H INC EDX MOV RandSeed EDX MUL EDX MOV EAX EDX end procedure RandExt const two2neg32 double 1 0 10000 10000 2 32 asm FUNCTION RandExt Extended IMUL EDX RandSeed 08088405H INC EDX MOV RandSeed EDX FLD two2neg32 PUSH 0 PUSH EDX FILD qword ptr ESP ADD ESP 8 FMULP ST 1 ST 0 end RandSeed can be set directly or through a call to Randomize In Ray Lishner s Delphi in a NutShell he says Delphi uses a pseudorandom number generator PRNG with a cycle of 2 32 Although adequate for simple simulations it is not suitable for use in encrption or other areas where you need a high quality PRNG I don t know whether your auditors will like that statement or not For alternative random number generators try Fast BASM implementation of the Mother of all Pseudo Random Number Generators as proposed by well known random

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/MathFunctions/random.txt (2016-02-14)
    Open archived version from archive


  • Dr J D Collins wrote Duncan Murdoch wrote One other translation error you should use Random not Random 1 The latter always gives 0 Actually not true Random 1 and Random are identical as shown by the following extract from Delphi help The Random function returns a random number within the range 0 Range If Range is not specified the result is a real type random number within the range

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0521d.txt (2016-02-14)
    Open archived version from archive


  • coprocessor 11 Oct 1990 INTERFACE TYPE RealType DOUBLE PROCEDURE SetSeeds a1 a2 a3 INTEGER FUNCTION Random INTEGER FUNCTION RandomInteger maxval INTEGER INTEGER 0 maxval FUNCTION Uniform REAL 0 0 1 0 IMPLEMENTATION VAR k INTEGER s1 INTEGER 1 32362 s2 INTEGER 1 31726 s3 INTEGER 1 31656 z INTEGER PROCEDURE SetSeeds a1 a2 a3 INTEGER BEGIN s1 a1 s2 a2 s3 a3 END SetSeeds FUNCTION Random INTEGER see p 748

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/MathFunctions/RANDOM16.TXT (2016-02-14)
    Open archived version from archive


  • have at least a 23 bit mantissa efg 12 Aug 1988 modified for math coprocessor 10 Oct 1990 INTERFACE TYPE RealType DOUBLE PROCEDURE SetSeeds a1 a2 LongINT FUNCTION Random LongINT FUNCTION RandomInteger maxval LongINT LongINT 0 maxval FUNCTION Uniform RealType 0 0 1 0 IMPLEMENTATION VAR k LongINT s1 LongINT 1 2147483562 s2 LongINT 1 2147483398 z LongINT PROCEDURE SetSeeds a1 a2 LongINT BEGIN s1 a1 s2 a2 END SetSeeds

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/MathFunctions/RANDOM32.TXT (2016-02-14)
    Open archived version from archive


  • sum sq Real BEGIN main sum x 0 sum sq 0 FOR i 1 to length DO BEGIN sum x sum x x i sum sq sum sq x i x i END mean sum x length std dev sqrt sum sq sqr sum x length length 1 END procedure meanstd PROCEDURE newton1 VAR x Real CONST tol 1 0E 6 max 20 VAR fx dfx dx x1 Real i Integer BEGIN newton error false i 0 REPEAT i i 1 x1 x func x fx dfx IF dfx 0 0 THEN BEGIN error true x 1 0 writeln chr 7 ERROR slope zero END ELSE BEGIN dx fx dfx x x1 dx writeln x x fx fx dfx dfx END UNTIL error OR i max OR abs dx max THEN BEGIN writeln chr 7 ERROR no convergence in max loops error true END END newton PROCEDURE newton2 VAR x Real CONST tol 1 0E 6 VAR fx dfx dx x1 Real BEGIN newton error false REPEAT x1 x func x fx dfx IF dfx 0 0 THEN BEGIN error true x 1 0 writeln chr 7 ERROR slope zero END ELSE BEGIN dx fx dfx x x1 dx writeln x x fx fx dfx dfx END UNTIL error OR abs dx blank OR max 1 FOR i 1 to max DO write out i writeln FOR i 1 to max DO out i blank blank next line END outlin procedure setup index Integer setup the plus and asterisk for printing CONST star plus VAR i Integer BEGIN i pscale y index out i plus IF not yonly THEN BEGIN add ycalc too i pscale ycalc index out i star END END setup BEGIN body of plot IF m 0 THEN plot y and ycalc vs x BEGIN n m yonly false END ELSE plot only y vs x BEGIN n m yonly true END space out alternate lines lines 2 n 1 1 writeln xlow x 1 xhigh x n ymax y 1 ymin ymax xscale xhigh xlow lines 1 signxs 1 0 IF xscale ymax THEN ymax y i IF not yonly THEN BEGIN IF ycalc i ymax THEN ymax ycalc i END if yonly END yscale ymax ymin linel 1 ys10 yscale 10 ylabel 1 ymin y axis FOR i 1 to 4 DO ylabel i 1 ylabel i ys10 ylabel 6 ymax FOR i 1 to linel DO out i blank blank line setup 1 l 1 xlabel xlow iskip false FOR i 2 to lines DO set up a line BEGIN xnext xlow xscale i 1 IF iskip THEN writeln ELSE BEGIN l l 1 WHILE x l xnext 0 5 xscale signxs 0 0 THEN iskip true ELSE BEGIN iskip false xlabel xnext setup l setup print line END END for loop outlin xhigh last line write FOR i 1 to 6 DO write writeln write FOR i 1 to 6 DO write ylabel i 9 1 blank writeln writeln END PLOT function randg

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/MathFunctions/mathe.pas (2016-02-14)
    Open archived version from archive


  • from original VB code by Rod Stephens At least it wasn t shudder C procedure TForm1 RotateAngle Angle integer var Theta cosTheta sinTheta Single cx cy Single Center X Y sfrom y sfrom x Single Real number ifrom y ifrom x Integer Integer version to y to x Integer weight x weight y array 0 1 of Single weight Single new red new green Integer new blue Integer total red total green Single total blue Single ix iy Integer pb pc pRGBArray begin Screen Cursor crHourGlass CopyMe ud b Copy to the undo bitmap CopyMe tBufr b Copy to the internal buffer bitmap Calculate the sine and cosine of theta for later Theta Angle Pi 180 sinTheta Sin Theta cosTheta Cos Theta cx b Width 2 Center of rotation for x cy b Height 2 Center of rotation for y Perform the rotation for to y 0 to b Height 1 do begin for to x 0 to b Width 1 do begin Find the location from x from y that rotates to position to x to y sfrom x cx to x cx cosTheta to y cy sinTheta ifrom x Trunc sfrom x sfrom y cy to x cx sinTheta to y cy cosTheta ifrom y Trunc sfrom y Calculate the weights if sfrom y 0 then begin weight y 1 sfrom y ifrom y weight y 0 1 weight y 1 end else begin weight y 0 sfrom y ifrom y weight y 1 1 weight y 0 end if sfrom x 0 then begin weight x 1 sfrom x ifrom x weight x 0 1 weight x 1 end else begin weight x 0 sfrom x ifrom x Weight x 1 1 weight x 0 end if ifrom x b Width 1 then ifrom x ifrom x

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0328.txt (2016-02-14)
    Open archived version from archive