This is the web version of EJS interface
EJS version 4.3.5
  1. Author=Fu-Kwun Hwang
  2. Abstract=hwang@phy.ntnu.edu.tw http://www.phy.ntnu.edu.tw/ntnujava/
  3. CaptureTools=false
  4. DataTools=false
  5. LanguageTools=false
  6. EmersionSupport=false
  7. AppletColSupport=false
  8. UseInterpreter=true
    NameValueTypeDimension
    NameValueTypeDimension

    Init Page

    t=0; if(k<1.0)k=1.0; else if(k>3.5)k=3.5; R=k*r; R2=R-size2; cta=-pi; omega=0; stage=0; vx=0; cst=0; done=false; _view.trace2.clear(); if(hmode){ x=xmin; y=ymin+size2; vx=Math.sqrt(g*R); vy=0; }

    Evol Page

    Indep. Var. Increment
    d cta /dt=omega
    d omega /dt=getAlpha(stage,cta)
    d x /dt=vx
    d y /dt=vy
    d vy /dt=cst*g
    SolverRungeKutta AbsoluteTolerance=0.00001

    Name:E,active=E,條件:Method:E,(誤差範圍E),stopatEvent=E
    E


    動作
    E

    Name:t,active=t,條件:Method:t,(誤差範圍t),stopatEvent=t
    t


    動作
    t

    Name:,active=,條件:Method:,(誤差範圍),stopatEvent=


    動作

    FixRel Page

    if(stage==0){ if(hmode){ v=vx; }else{ x=xmin+R+R2*Math.cos(cta); y=ymin+R+R2*Math.sin(cta); v=R2*omega; cf=R2*omega*omega; // cfs=1; nf=g*Math.sin(cta)-cf; } }else if(stage==1){ x=xmin+R+r2*Math.cos(cta); y=ymin+r+r2*Math.sin(cta); v=r2*omega; if(cta<0 || cta>pi){ // cfs=-1; cf=r2*omega*omega; nf=g*Math.sin(cta)-cf; }else{ cfs=1; cf=r2*omega*omega; nf=g*Math.sin(cta); } if(cta>0 &&cta<pi)nf=-nf; }else if(stage==2 ){ omega=0; v=vx; cf=0; nf=g; cta=pi/2; if(x>xmax-size){ _pause(); done=true; } }else if(stage==3){//free fall omega=0; v=Math.sqrt(vx*vx+vy*vy); cf=0; nf=0; /* if((x-xmin-R)*(x-xmin-R)+(y-ymin-r)*(y-ymin-r)>r*r){// hit the coaster stage=1; cta=Math.atan2(y-ymin-r,x-xmin-R); omega=v/r/2; if(x>xmin+R)omega=-omega; } */ if(y<ymin+size){ _pause(); done=true; } } EK=v*v/2; EU=g*(y-ymin)-size; if(stage<2 && !hmode){ vx=-v*Math.sin(cta); vy=v*Math.cos(cta); } msg="Kinetic energy="+dvalue(EK)+",Potential Energy="+dvalue(EU);

    getAlpha

    public double getAlpha (int stage,double c) { if(stage==0)return -g*Math.cos(c)/R2; if(stage==1)return -g*Math.cos(c)/r2; omega=0; return 0; } public double dvalue(double v){ return (int)(v*100+0.5)/100.; }
    EJSVIEW: Click link to view it's content
    Control variables:(testing)
    double,int
    title="Frame"
    layout=border
    visible=true
    size="784,491"
    position=center
    autoscaleX=false
    autoscaleY=false
    minimumX=xmin
    maximumX=xmax
    minimumY=ymin*1.1
    maximumY=ymax
    square=true
    background=GRAY
    x=xmin+R
    y=ymin
    sizeX=xmax-xmin
    sizeY=0
    lineColor=BLUE
    lineWidth=stroke
    x=x
    y=y
    sizeX=size
    sizeY=size
    fillColor=200,220,208,128
    lineWidth=stroke
    points=npt
    min=0
    max=pi/2
    variable="c"
    functionx="xmin+R*(1-cos(c))"
    functiony="ymin+R*(1-sin(c))"
    javaSyntax=false
    visible=!hmode
    lineColor=BLUE
    lineWidth=stroke
    points=npt
    min=0
    max=2*pi
    variable="c"
    functionx="xmin+R+r*cos(c)"
    functiony="ymin+r*(1-sin(c))"
    javaSyntax=false
    lineColor=BLUE
    lineWidth=stroke
    x=x
    y=y
    active=t>0
    norepeat=true
    connected=t>0
    x=x
    y=y
    sizeX=0
    sizeY=-g
    scalex=fc
    scaley=fc
    visible=showg
    lineColor=BLACK
    fillColor=BLACK
    lineWidth=stroke
    x=x
    y=y
    sizeX=nf*Math.cos(cta)
    sizeY=nf*Math.sin(cta)
    scalex=fc
    scaley=fc
    visible=shown
    lineColor=0,255,0,232
    fillColor=0,255,0,232
    lineWidth=stroke
    x=x
    y=y
    sizeX=-cf*cfs*Math.cos(cta)
    sizeY=-cf*cfs*Math.sin(cta)
    scalex=fc
    scaley=fc
    visible=showc
    lineColor=PINK
    fillColor=PINK
    x=0
    y=ymax
    pixelSize=true
    text=%msg%
    font=Monospaced,PLAIN,16
    elementposition=NORTH_WEST
    x=xmin-2.5*size
    y=ymin+(EU+EK)/Ecst+size*1.5
    pixelSize=true
    visible=EK>10
    text="K=m*v^{2}/2"
    font=Monospaced,BOLD,16
    elementposition=SOUTH_WEST
    lineColor=RED
    fillColor=RED
    x=x
    y=y
    sizeX=fc*g*Math.sin(cta)
    sizeY=fc*g*Math.cos(cta)
    transformation=cta
    style=RECTANGLE
    elementposition=NORTH_EAST
    lineColor=128,128,128,64
    fillColor=128,128,128,64
    x=xmin-size*2
    y=ymin+EU/Ecst
    sizeX=0
    sizeY=EK/Ecst
    visible=true
    lineColor=RED
    lineWidth=20
    x=xmin-size*2
    y=ymin
    sizeX=0
    sizeY=EU/Ecst
    lineColor=GREEN
    lineWidth=20
    x=xmin-size*2
    y=ymin+EU/Ecst+size*1.5
    pixelSize=true
    text="U=mgh"
    font=Monospaced,BOLD,16
    elementposition=SOUTH_WEST
    lineColor=GREEN
    fillColor=GREEN
    x=x
    y=y
    sizeX=vx
    sizeY=vy
    scalex=0.2
    scaley=0.2
    enabledSize=_isPaused()
    dragAction=omega=Math.sqrt(vx*vx+vy*vy); if(stage==0){ if(hmode)vy=0; else omega=omega/R; }else if(stage==1)omega=omega/r; else if(stage==2){ if(vx<0)vx=0; vy=0; }
    lineColor=RED
    fillColor=RED
    x=xmin
    y=ymin
    sizeX=R
    sizeY=0
    visible=hmode
    lineColor=BLUE
    lineWidth=stroke
    position=south
    layout=border
    position=east
    layout=GRID:1,0,0,0
    text="init"
    enabled=_isPaused()
    action=_initialize()
    variable=_isPaused
    enabled=!done
    imageOn="/org/opensourcephysics/resources/controls/images/play.gif"
    actionOn=_play()
    imageOff="/org/opensourcephysics/resources/controls/images/pause.gif"
    actionOff=_pause()
    text="step"
    enabled=_isPaused() && !done
    action=_step()
    position=center
    text="reset"
    action=_reset()
    position=center
    layout=HBOX
    variable=k
    minimum=1.0
    maximum=3.5
    format="R=0.00 r"
    ticks=251
    closest=true
    dragaction=_initialize()
    layout=HBOX
    background=WHITE
    variable=showg
    text="gravitation"
    variable=shown
    text="Normal force"
    background=WHITE
    foreground=0,255,0,232
    variable=showc
    text="centripetal force"
    background=GRAY
    foreground=PINK
    variable=fps
    minimum=2
    maximum=20
    format="fps=0"
    enabled=_isPaused()
    dragaction=_setFPS(fps)
    size="60,0"
    position=west
    variable=hmode
    text=""
    enabled=t==0
    action=if(hmode){ x=xmin; y=ymin+size2; vx=Math.sqrt(g*R); vy=0; }
    position=north
    layout=HBOX
    visible=false
    variable=stage
    minimum=0.0
    maximum=5
    format="stage=0"
    variable=cta
    minimum=-pi
    maximum=4*pi
    format="cta=0.00"
    variable=omega
    minimum=-pi
    maximum=4*pi
    format="omega=0.00"