home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / 93win / data1.cab / Advanced_Math_Samples / normif < prev    next >
Encoding:
Text File  |  2005-03-02  |  1.3 KB  |  58 lines

  1. 10    CLEAR SCREEN
  2. 20    LOADSUB ALL FROM "..\mathlib\Mathlib.hts"
  3. 30    GINIT
  4. 40    Function$="Norminf"
  5. 50    REAL Studscore(1:5)
  6. 60    X_left=0
  7. 70    X_right=6! students
  8. 80    Y_bottom=0
  9. 90    Y_top=20! scores
  10. 100   X_tick=1
  11. 110   Y_tick=1
  12. 120   Precision=1
  13. 130! build array
  14. 140   RANDOMIZE
  15. 150   FOR Loop=1 TO 5
  16. 160     Studscore(Loop)=INT(RND*10)+1
  17. 170   NEXT Loop
  18. 180   PRINT Function$,"example"
  19. 190   PRINT "x, y"
  20. 200   MOVE 50,95
  21. 210   LABEL "Student scores out of"
  22. 220   MOVE 70,90
  23. 230   LABEL 10
  24. 240   MOVE 60,15
  25. 250   LABEL "Student"
  26. 260   VIEWPORT 40,120,20,90
  27. 270   WINDOW X_left,X_right,Y_bottom,Y_top
  28. 280   FRAME
  29. 290   AXES X_tick,Y_tick
  30. 300   PEN 7
  31. 310! Draw graph
  32. 320   FOR Loop=X_left+1 TO X_right-1 STEP Precision
  33. 330     PLOT Loop,Studscore(Loop)
  34. 340     IF Loop MOD X_tick=0 THEN
  35. 350       PRINT Loop,Studscore(Loop)
  36. 360     END IF
  37. 370   NEXT Loop
  38. 380! Draw labels
  39. 390   CSIZE 3
  40. 400   PEN 1
  41. 410   FOR Loop=X_left TO X_right STEP X_tick
  42. 420     MOVE Loop,0
  43. 430     LABEL Loop
  44. 440   NEXT Loop
  45. 450   FOR Loop=Y_bottom TO Y_top STEP Y_tick
  46. 460     MOVE 0,Loop
  47. 470     LABEL Loop
  48. 480   NEXT Loop
  49. 490! Draw Function$
  50. 500   PEN 4
  51. 510   Norminf=FNNorm(Studscore(*))
  52. 520   PLOT X_left,Norminf
  53. 530   PLOT X_right,Norminf
  54. 540   PRINT
  55. 550   PRINT Function$&": ",Norminf
  56. 560   DELSUB FNAi TO END
  57. 570   END
  58.