This is the web version of EJS interface
EJS version 4.2.7
  1. Author=Fu-Kwun Hwang - Dept. of Physics, National Taiwan Normal Univ.
  2. Abstract=hwang@phy.ntnu.edu.tw
  3. CaptureTools=true
  4. DataTools=true
  5. LanguageTools=true
  6. EmersionSupport=false
  7. UseInterpreter=true
  8. AuxiliaryFiles=./inelasticcollision_pkg/inelasticcollision_zh.properties;

Intro Page

Created by Fu-Kwun Hwang

Dept. of Physics

National Taiwan Normal University

Taipei, Taiwan

http://www.phy.ntnu.edu.tw/ntnujava/

    NameValueTypeDimension
    NameValueTypeDimension
    NameValueTypeDimension
    NameValueTypeDimension

    Init Page

    t=0; xa1=xb1=xmin+size; xa2=xb2=x0; vxa1=vxb1=v; vxa2=vxb2=0;

    Evol Page

    Indep. Var. Increment
    d xa1 /dt=vxa1
    d xa2 /dt=vxa2
    d xb1 /dt=vxb1
    d xb2 /dt=vxb2
    d vxa1 /dt=-getF(xa1-xa2,vxa1-vxa2,1)/m1
    d vxa2 /dt=getF(xa1-xa2,vxa1-vxa2,1)/m2
    d vxb1 /dt=-getF(xb1-xb2,vxb1-vxb2,0)/m1
    d vxb2 /dt=getF(xb1-xb2,vxb1-vxb2,0)/m2
    SolverRungeKutta AbsoluteTolerance=0.001

    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(xa1>xa2)dxa=xa1-xa2; else dxa=0; if(xb1>xb2)dxb=xb1-xb2; else dxb=0; if(xa2>xmax && xa2>xmax && _isPlaying())_pause(); ka1=0.5*m1*vxa1*vxa1; ka2=0.5*m2*vxa2*vxa2; kb1=0.5*m1*vxb1*vxb1; kb2=0.5*m2*vxb2*vxb2; e1=ka1+ka2; e2=kb1+kb2; pa1=m1*vxa1; pa2=m2*vxa2; pb1=m1*vxb1; pb2=m2*vxb2;
    double dv; public double dvalue (double v) { if(v>0)dv=0.5; else if(v<0)dv=-0.5; else dv=0; return (int)(v*100+dv)/100.; }
    public double getF (double dx,double dv, int mode) { if(dx<0)return 0.; if(mode==0 && dv<=0){ // vxb1=vxb2; return 0; } return k*dx; }
    EJSVIEW: Click link to view it's content
    Control variables:(testing)
    double,double,double,double
    title="Frame"
    layout=border
    visible=true
    location="-1,11"
    size="716,538"
    background=DARKGRAY
    position=center
    layout=GRID:0,1,0,0
    layout=GRID:1,0,0,0
    autoscaleX=true
    autoscaleY=true
    title="elastic collison"
    titleX="t(s)"
    interiorBackground=128,192,0
    foreground=LIGHTGRAY
    x=t
    y=vxa1
    memory=nm
    maxpoints=npt
    norepeat=true
    connected=true
    color=RED
    stroke=1
    x=t
    y=vxa2
    memory=nm
    maxpoints=npt
    norepeat=true
    connected=true
    color=MAGENTA
    stroke=1.25
    x=t
    y=e1*escale
    memory=nm
    maxpoints=npt
    norepeat=true
    connected=true
    color=255,128,0
    stroke=stroke
    x=t
    y=vxa1
    pixelSize=true
    text="v1"
    elementposition=SOUTH_EAST
    lineColor=255,255,0
    fillColor=255,255,0
    x=t
    y=vxa2
    pixelSize=true
    text="v2"
    elementposition=SOUTH_EAST
    lineColor=255,255,0
    fillColor=255,255,0
    x=t
    y=e1*escale
    pixelSize=true
    text="0.5*(m_{1}*v_{1}^{2}+m_{2}*v_{2}^{2})"
    elementposition=NORTH_EAST
    lineColor=255,255,0
    fillColor=255,255,0
    autoscaleX=true
    autoscaleY=true
    title="in-elastic collision"
    titleX="t(s)"
    interiorBackground=128,192,0
    foreground=LIGHTGRAY
    x=t
    y=vxb1
    memory=nm
    maxpoints=npt
    norepeat=true
    connected=true
    color=RED
    stroke=1
    x=t
    y=vxb2
    memory=nm
    maxpoints=npt
    norepeat=true
    connected=true
    color=MAGENTA
    stroke=1.25
    x=t
    y=e2*escale
    memory=nm
    maxpoints=npt
    norepeat=true
    connected=true
    color=255,128,0
    stroke=stroke
    position=center
    autoscaleX=false
    autoscaleY=false
    minimumX=xmin
    maximumX=xmax
    minimumY=ymin
    maximumY=ymax
    square=true
    x=xb2
    y=yb
    sizeX=w
    sizeY=h
    style=RECTANGLE
    elementposition=WEST
    fillColor=200,220,208,200
    x=xa2
    y=ya
    sizeX=w
    sizeY=h
    style=RECTANGLE
    elementposition=WEST
    fillColor=LIGHTGRAY
    x=xa2+dxa
    y=ya
    sizeX=la-dxa
    sizeY=0
    radius=size2
    lineColor=255,128,0
    x=xb2+dxb
    y=yb
    sizeX=lb-dxb
    sizeY=0
    radius=size2
    lineColor=255,128,0
    x=xb1
    y=yb
    sizeX=size
    sizeY=size
    lineColor=192,255,0
    fillColor=128,192,128
    x=xa1
    y=ya
    sizeX=size
    sizeY=size
    lineColor=192,255,0
    fillColor=128,192,128
    x=xa1
    y=ya
    sizeX=vxa1
    sizeY=0
    lineColor=128,0,255
    fillColor=128,0,255
    x=xb1
    y=yb
    sizeX=vxb1
    sizeY=0
    lineColor=128,0,255
    fillColor=128,0,255
    x=xa2+w
    y=ya
    sizeX=vxa2
    sizeY=0
    lineColor=192,0,192
    fillColor=192,0,192
    x=xb2+w
    y=yb
    sizeX=vxb2
    sizeY=0
    lineColor=192,0,192
    fillColor=192,0,192
    x=xmin
    y=ymax/4
    pixelSize=true
    text="elastic collision"
    elementposition=WEST
    lineColor=255,192,0
    fillColor=255,192,0
    x=xmin
    y=ymin/4
    pixelSize=true
    text="in-elastic collision"
    elementposition=WEST
    lineColor=255,192,0
    fillColor=255,192,0
    position=south
    layout=border
    foreground=192,192,64
    position=east
    layout=HBOX
    borderType=LOWERED_ETCHED
    text="Reset"
    image=/org/opensourcephysics/resources/controls/images/reset.gif
    action=_reset()
    background=GRAY
    foreground=0,255,0
    text="init"
    enabled=_isPaused()
    action=_initialize()
    background=GRAY
    foreground=0,255,0
    variable=_isPaused
    textOn="Play"
    imageOn=/org/opensourcephysics/resources/controls/images/play.gif
    actionOn=_play()
    foreground=0,255,0
    background=GRAY
    textOff="Pause"
    imageOff=/org/opensourcephysics/resources/controls/images/pause.gif
    actionOff=_pause()
    foregroundOff=0,255,0
    backgroundOff=GRAY
    position=center
    layout=HBOX
    variable=v
    minimum=size
    maximum=size*20
    format="v=0.0"
    ticks=20
    closest=true
    enabled=_isPaused()
    dragaction=_initialize()
    position=north
    variable=m1
    minimum=1.0
    maximum=10.0
    format="m1=0.0"
    ticks=10
    closest=true
    enabled=_isPaused()
    dragaction=_initialize()
    variable=m2
    minimum=1.0
    maximum=10.0
    format="m2=0.0"
    ticks=10
    closest=true
    enabled=_isPaused()
    dragaction=_initialize()
    variable=k
    minimum=10.0
    maximum=100.0
    format="k=0.0"
    ticks=10
    closest=true
    position=south
    variable=t
    minimum=0.0
    format="time = 0.0"
    orientation=HORIZONTAL
    foreground=GRAY