Plot of sinh()

Actionscript:
  1. x = stage.stageWidth / 2;
  2. y = stage.stageHeight / 2;
  3. scaleX = scaleY = 3;
  4.  
  5. var t:Number =-5;
  6. var xp:Number = 0;
  7. var yp:Number = 0;
  8.  
  9. addEventListener(Event.ENTER_FRAME, onLoop);
  10. function onLoop(evt:Event):void {
  11.      xp = t;
  12.      yp = sinh(t);
  13.      
  14.     graphics.lineStyle(0,0);
  15.     if (t == -5){
  16.         graphics.moveTo(xp, yp);
  17.     }else{
  18.         graphics.lineTo(xp, yp);
  19.     }
  20.      if (t> 5){
  21.          removeEventListener(Event.ENTER_FRAME, onLoop);
  22.      }
  23.      t+=.2;
  24. }
  25. function sinh(x:Number):Number{
  26.     return (Math.pow(Math.E, x) - Math.pow(Math.E, -x)) * 0.5;
  27. }

Just a quick plot to test the sinh() function from a few days ago...

This entry was posted in Math and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*