home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / misc / math / mathgrap.sit / MathGrapher / stack.txt < prev   
Encoding:
Text File  |  1989-07-28  |  10.8 KB  |  422 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 7
  11. -- first background id: 3368
  12. -- card count: 26
  13. -- first card id: 3642
  14. -- list block id: 11937
  15. -- print block id: 0
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 3
  19. -- free size: 8224 bytes
  20. -- total size: 139264 bytes
  21. -- stack block size: 10240 bytes
  22. -- created by hypercard version: 0x01208000
  23. -- compacted by hypercard version: 0x01228000
  24. -- modified by hypercard version: 0x01228000
  25. -- opened by hypercard version: 0x01228000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0x8888888888888888
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on OpenStack
  69.   global functionMenu
  70.   global XtickInterval,YtickInterval,userlevel
  71.   global XaxisScale, YaxisScale
  72.   global Yaxis,Xaxis,lineDensity,dataBrush,olduserlevel
  73.   -- Set the userlevel to the proper usage
  74.   put the userlevel into olduserlevel
  75.   if the userlevel < 3 then
  76.     set the userlevel to 3
  77.   end if
  78.   -- Makes sure stack has the essentials
  79.   if  the version < 1.2 then
  80.     answer "Please use HyperCard version 1.2 or higher." with "Go Home"
  81.     go home
  82.   end if
  83.   -- These are the routines for the Functions menu
  84.   put NewMenu("Functions","Polynomials","Trigonometric","Exponential", "Logarithmic","Hyperbolic","Custom") into functionMenu
  85.   -- This seems to prevent the moving button on card 1
  86.   --  from burning a hole in the persons disk by constantly
  87.   --   changing the loc of the button
  88.   set userModify to false
  89.   wait for 5 ticks
  90.   set userModify to true
  91.   if lineDensity is empty then
  92.     set lockscreen to true
  93.     push card
  94.     go to card "Graph Options"
  95.     send "MouseUp" to btn id 19 of card "Graph Options"
  96.     send "MouseUp" to btn id 35 of card "Graph Options"
  97.     pop card
  98.   end if
  99.   if XtickInterval is empty then put 25 into XtickInterval
  100.   if YaxisScale is empty then put 1 into YaxisScale
  101.   if YtickInterval is empty then put 25 into YTickInterval
  102.   if XaxisScale is empty then put 1 into XaxisScale
  103. end OpenStack
  104.  
  105. on CloseStack
  106.   global olduserlevel,userlevel,functionMenu
  107.   set the userlevel to olduserlevel
  108.   put DeleteMenu(functionMenu) into functionMenu
  109. end CloseStack
  110.  
  111. on SetPaint
  112.   -- Temporarily sets paint tools to the way I want them
  113.   global linesize,oldlinesize
  114.   global brush,oldbrush
  115.   global centered,oldcentered
  116.   put the linesize into oldlinesize
  117.   put the brush into oldbrush
  118.   put the centered into oldcentered
  119.   set the centered to false
  120.   set the linesize to 1
  121. end SetPaint
  122.  
  123. on OldSetPaint
  124.   -- Puts the tools back the way I found them
  125.   global linesize,oldlinesize
  126.   global brush,oldbrush
  127.   global centered,oldcentered
  128.   set the brush to oldbrush
  129.   set the linesize to oldlinesize
  130.   set the centered to oldcentered
  131. end OldSetPaint
  132.  
  133. on idle
  134.   -- Resets the Functions menubar incase it has been wiped
  135.   global functionMenu, lastTick
  136.   if (the ticks-lastTick)>120 then
  137.     put the ticks into lastTick
  138.     ShowMenu(functionMenu)
  139.   end if
  140.   pass idle
  141. end idle
  142.  
  143. on help
  144.   put empty into msg
  145.   hide msg
  146.   answer "What do you need help with?" with "This Stack" or "HyperCard"
  147.   if it is "This Stack" then
  148.     go to card "H1"
  149.     exit to HyperCard
  150.   else pass help
  151. end help
  152.  
  153. on doMenu menuitem
  154.   -- This lets the person choose the custom help cards or Hyp Help
  155.   if menuitem is "Help" then
  156.     answer "What do you need help with?" with "This Stack" or "HyperCard"
  157.     if it is "This Stack" then
  158.       go to card "H1"
  159.       exit to HyperCard
  160.     else go to stack "Help"
  161.   end if
  162.   if menuitem contains "Delete" then
  163.     play "Awww" tempo 25 "c"
  164.   end if
  165.   if menuitem contains "Info" then
  166.     play "click" tempo 100 "c"
  167.   end if
  168.   if menuitem is "Polynomials" then
  169.     alterPop
  170.     go to card "Polynomials"
  171.     exit to HyperCard
  172.   end if
  173.   if menuitem is "Trigonometric" then
  174.     alterPop
  175.     go to card "Trigonometric"
  176.     exit to HyperCard
  177.   end if
  178.   if menuitem is "Exponential" then
  179.     alterPop
  180.     go to card "Exponential"
  181.     exit to HyperCard
  182.   end if
  183.   if menuitem is "Logarithmic" then
  184.     alterPop
  185.     go to card "Logarithmic"
  186.     exit to HyperCard
  187.   end if
  188.   if menuitem is "Hyperbolic" then
  189.     alterPop
  190.     go to card "Hyperbolic"
  191.     exit to HyperCard
  192.   end if
  193.   if menuitem is "Custom" then
  194.     alterPop
  195.     go to card "Custom"
  196.     exit to HyperCard
  197.   end if
  198.   pass doMenu
  199. end doMenu
  200.  
  201. on alterPop
  202.   pop card into temp
  203.   if temp contains "home" then
  204.     push card
  205.   else push temp
  206. end alterPop
  207.  
  208. on StartUp
  209.   -- This is a little bit of a band aid function
  210.   -- to make sure the stack works.
  211.   put "function f x" & return & "   return x" & return & " end f" into texty
  212.   set the script of background id 2686 to texty
  213.   put "f(x) = x" into cd fld "Function Name" of card "GRaph Paper"
  214.   pass StartUp
  215. end StartUp
  216.  
  217. function csc x
  218. -- This performs the Cosecant function
  219. global blowup
  220. if sin(x) = 0 then
  221.   put "The Cosecant is not defined for multiples of Pi." into blowup
  222.   return 9999999999999999999999999999999999999999999999999999
  223.   exit csc
  224. end if
  225. return 1/sin(x)
  226. end csc
  227.  
  228. function sec x
  229. -- This performs the Secant function
  230. global blowup
  231. if cos(x) = 0 then
  232.   put "The Secant is not defined for multiples of Pi + Pi/2." into blowup
  233.   return 9999999999999999999999999999999999999999999999999999
  234.   exit sec
  235. end if
  236. return 1/cos(x)
  237. end sec
  238.  
  239. function cot x
  240. -- This performs the Cotangent function
  241. global blowup
  242. if sin(x) = 0 then
  243.   put "The Cotangent is not defined for multiples of Pi." into blowup
  244.   return 9999999999999999999999999999999999999999999999999999
  245.   exit cot
  246. end if
  247. return 1/tan(x)
  248. end cot
  249.  
  250. function asin x
  251. -- This performs the ArcSine function
  252. global blowup
  253. if abs(x) ΓëÑ 1 then
  254.   put "The ArcSine is not defined for |x| ΓëÑ 1." into blowup
  255.   return 9999999999999999999999999999999999999999999999999999
  256.   exit asin
  257. end if
  258. return atan(x/sqrt(1-x^2))
  259. end asin
  260.  
  261. function acos x
  262. -- This performs the ArcCosine function
  263. global blowup
  264. if abs(x) ΓëÑ 1 or x=0 then
  265.   put "The ArcCosine is not defined for |x| ΓëÑ 1 or x = 0." into blowup
  266.   return 9999999999999999999999999999999999999999999999999999
  267.   exit acos
  268. end if
  269. return atan(sqrt(1-x^2)/x)
  270. end acos
  271.  
  272. function acot x
  273. -- This performs the ArcCotangent function
  274. global blowup
  275. if x=0 then
  276.   put "The ArcCotangent is not defined for x = 0." into blowup
  277.   return 9999999999999999999999999999999999999999999999999999
  278.   exit acot
  279. end if
  280. return atan(1/x)
  281. end acot
  282.  
  283. function acsc x
  284. -- This performs the ArcCosecant function
  285. global blowup
  286. if abs(x) Γëñ 1 then
  287.   put "The ArcCosecant is not defined for |x| ΓëÑ 1 or x = 0." into blowup
  288.   return 9999999999999999999999999999999999999999999999999999
  289.   exit acsc
  290. end if
  291. return acot(sqrt(x^2-1))
  292. end acsc
  293.  
  294. function asec x
  295. -- This performs the ArcSecant function
  296. global blowup
  297. if abs(x) Γëñ 1 then
  298.   put "The ArcSecant is not defined for |x| ΓëÑ 1 or x = 0." into blowup
  299.   return 9999999999999999999999999999999999999999999999999999
  300.   exit asec
  301. end if
  302. return atan(sqrt(x^2-1))
  303. end asec
  304.  
  305. function sinh x
  306. -- Hyperbolic Sine
  307. -- Good for all values of x
  308. return (exp(x) - exp(-x))/2
  309. end sinh
  310.  
  311. function cosh x
  312. -- Hyperbolic Cosine
  313. -- Good for all values of x
  314. return (exp(x) + exp(-x))/2
  315. end cosh
  316.  
  317. function tanh x
  318. -- Hyperbolic Tangent
  319. -- Good for all values of x
  320. return sinh(x)/cosh(x)
  321. end tanh
  322.  
  323. function csch x
  324. -- Hyperbolic Cosecant
  325. global blowup
  326. if x = 0 then
  327.   put "The Hyperbolic Cosecant is not defined for x = 0." into blowup
  328.   return 9999999999999999999999999999999999999999999999999999
  329.   exit csch
  330. end if
  331. return 1/sinh(x)
  332. end csch
  333.  
  334. function sech x
  335. -- Hyperbolic Secant
  336. -- Good for all values of x
  337. return 1/cosh(x)
  338. end sech
  339.  
  340. function ctnh x
  341. -- Hyperbolic Cotangent
  342. global blowup
  343. if x = 0 then
  344.   put "The Hyperbolic Cotangent is not defined for x = 0." into blowup
  345.   return 9999999999999999999999999999999999999999999999999999
  346.   exit ctnh
  347. end if
  348. return cosh(x)/sinh(x)
  349. end ctnh
  350.  
  351. function asinh x
  352. -- Inverse Hyperbolic Sine
  353. -- Good for all x
  354. return ln (x + sqrt(x^2 + 1))
  355. end asinh
  356.  
  357. function acosh x
  358. -- Inverse Hyperbolic Cosine
  359. global blowup
  360. if x < 1 then
  361.   put "The Inverse Hyperbolic Cosine is not defined for x < 1." into blowup
  362.   return 9999999999999999999999999999999999999999999999999999
  363.   exit acosh
  364. end if
  365. return ln (x + sqrt(x^2 - 1))
  366. end acosh
  367.  
  368. function atanh x
  369. -- Inverse Hyperbolic Tangent
  370. global blowup
  371. if abs(x) >= 1 then
  372.   put "The Inverse Hyperbolic Tangent is not defined for |x| > 1." into blowup
  373.   return 9999999999999999999999999999999999999999999999999999
  374.   exit atanh
  375. end if
  376. return ln((1+x)/(1-x))/2
  377. end atanh
  378.  
  379. function acsch x
  380. -- Inverse Hyperbolic Cosecant
  381. global blowup
  382. if x = 0 then
  383.   put "The Inverse Hyperbolic Cosecant is not defined for x = 0." into blowup
  384.   return 9999999999999999999999999999999999999999999999999999
  385.   exit acsch
  386. end if
  387. return ln(1/x+sqrt(1+x^2)/abs(x))
  388. end acsch
  389.  
  390. function asech x
  391. -- Inverse Hyperbolic Secant
  392. global blowup
  393. if x Γëñ 0 or x ΓëÑ 1 then
  394.   put "The Inverse Hyperbolic Secant is not defined for x Γëñ 0 or x > 1." into blowup
  395.   return 9999999999999999999999999999999999999999999999999999
  396.   exit asech
  397. end if
  398. return ln((1+sqrt(1-x^2))/x)
  399. end asech
  400.  
  401. function actnh x
  402. -- Inverse Hyperbolic Cotangent
  403. global blowup
  404. if abs(x) Γëñ 1 then
  405.   put "The Inverse Hyperbolic Cotangent is not defined for |x| Γëñ 1." into blowup
  406.   return 9999999999999999999999999999999999999999999999999999
  407.   exit actnh
  408. end if
  409. return ln((x+1)/(x-1))/2
  410. end actnh
  411.  
  412. function log x
  413. global blowup
  414. if x <= 0 then
  415.   put "The Logarithm cannot take nonpositive numbers!" into blowup
  416.   return 9999999999999999999999999999999999999999999999999999
  417.   exit log
  418. end if
  419. return .4342944819*ln(x)
  420. end log
  421.  
  422.