A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 P.7.

Slides:



Advertisements
Similar presentations
Introduction to 2-Dimensional Motion
Advertisements

Introduction to 2-Dimensional Motion
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 P.5.
IS660Z Programming Games Using Visual Basic Overview of Cannonball.
Visual Basic: ballistics
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 P.10.
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 S.24.
CBA #1 Review Graphing Motion 1-D Kinematics Projectile Motion Circular Motion Gravity Graphing Motion 1-D Kinematics Projectile Motion Circular.
PHY 2048C General Physics I with lab Spring 2011 CRNs 11154, & Dr. Derrick Boucher Assoc. Prof. of Physics Sessions 6-7, Chapter 7.
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 P.13.
Two Dimensional Dynamics
Graphing Sine and Cosine. Graphing Calculator Mode— Radians Par Simul Window— –X min = -1 –X max = 2  –X scale =  /2 Window— –Y min = -3 –Y max = 3.
Graphing Sine and Cosine. Video Graphing Calculator Mode— Radians Par Simul Window— –X min = -1 –X max = 2  –X scale =  /2 Window— –Y min = -3 –Y max.
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 P.6.
Welcome to Work/Energy/Power JEOPARDY KEYBOARDING.
Projectile Motion. 2 components of all projectile motion: Horizontal component (vx) is constant. Vertical component (vy) is affected by gravity.
Projectile Motion Type I Type II. Projectile Motion Any object that has been given an initial thrust, then moves only under the force of gravity. The.
A Projectile from a Cliff. Practice Quiz 3 # 10 A cannon is at the top of a cliff, 150 meters high. The cannon fires a shell at an angle of 20° above.
Graph the function y = |4 cos x|
Projectile motion: Steps to solve popular problems. Scenario 1a: Given velocity shot horizontally off a cliff with a height. Can find time using d y =
What about this??? Which one is false?. Aim & Throw where????
Introduction to 2-Dimensional Motion. 2-Dimensional Motion Definition: motion that occurs with both x and y components. Each dimension of the motion can.
CBA #1 Review Graphing Motion 1-D Kinematics
PROJECTILE MOTION.
1 A Core Course on Modeling Enter: ACCEL basics running a script Time in ACCEL the { … } operator examples Week 3 – Time for Change.
Chapter 4 Trigonometric Functions
Chapter 1 Computing Tools Analytic and Algorithmic Solutions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Animation and Double-Buffering. The animation methods described here are based on standard techniques of double-buffering applicable to most high-level.
Kinematics in 2-Dimensional Motions. 2-Dimensional Motion Definition: motion that occurs with both x and y components. Example: Playing pool. Throwing.
CP Projectile Test Answers 1. Which of the following best represents a graph of horizontal position as a function of time for balls launched horizontally.
Projectile Motion Horizontally Launched Projectiles Projectiles Launched at an Angle A.S – Due Friday, 11/14 Text Reference: chapter 3.
Models in NetLogo Day 3 COLQ 201 Multiagent modeling Harry Howard Tulane University.
Projectile Motion CCHS Physics. Projectile Properties?
Projectile motion.
Physics 221 Chapter 4 Equations in 2-D v = dr / dt r = x i + y j v = dx/dt i + dy/dt j a = dv / dt Note: These are vector equations!
Why is speed scalar and velocity vector. Speed is only a number
Copyright Sautter Motion in Two Dimension - Projectiles Projectile motion involves object that move up or down and right or left simultaneously.
Chapter 1 Computing Tools Analytic and Algorithmic Solutions Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Projectiles (2D) A projectile is any object that is in a state of freefall, or in other words an object that is only acted upon by the force of gravity.
CRSD Technology Training Tony Judice. Quick Access Toolbar – can be modifiedSave as… allows you to save the file to a different location and also as an.
Projectile motion diagram Questions concerning previous slide What is the point of this picture? vx & vy are independent Determining muzzle velocity Determining.
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 S.12.
Section 4.5 Graphs of Sine and Cosine Functions. The Graph of y=sin x.
EXAMPLE 4 Derive a trigonometric model Soccer Write an equation for the horizontal distance traveled by a soccer ball kicked from ground level (h 0 = 0)
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 S.2.
A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 S.29.
Introduction to 2D Motion
6.2 General projectile motion
What is projectile motion? The only force acting on the objects above is the force of the Earth.
Aim: How can we solve angular Projectile problems?
2 DIMENSIONAL KINEMATICS
Physics Lesson 6 Projectile Motion
Lecture 7: Forces and Motion in TWO Dimensions Read: Ch. 4.3 – 4.6
Projectile Motion Modelling assumptions
Roadrunner Facts Roadrunners are prey for hawks, house cats, raccoons, snakes, and skunks, not coyotes! Roadrunners can attain speeds of 17 mph. A roadrunner.
What is projectile motion?
Unit 3: Projectile Motion
Two Dimensional Kinematics
Two Dimensional Dynamics
King Fahd University of Petroleum & Minerals
Introduction to 2-Dimensional Motion
Translations of Trigonometric Graphs.
EXAM NEXT CLASS All through Day 1 of GT physics..
Non-Horizontally Launched Projectiles
P R O J E C T I L s V Vy Vx.
Introduction to 2-Dimensional Motion
Displacement, speed, velocity, acceleration and momentum
Introduction to 2D Projectile Motion
> < > < ≥ ≤ Shot at 90% Larger Smaller Larger
Projectiles at an Angle
Presentation transcript:

A core Course on Modeling Introduction to Modeling 0LAB0 0LBB0 0LCB0 0LDB0 P.7

Dynamic Models: dealing with time Examples of recursive functions (ACCEL demo’s) Contents cannon ball simulation combat simulation prey-predator system billiards simulation

Cannon ball simulation x y  y(t) = v y t + gt 2 /2 x(t) = v x t y(t) = 0, so t = 2 v y / g Then x = 2 v x v y / g  2 (cos  sin  ) / g  2 (cos  sin  ) / g = sin 2  /g = sin 2  /g Maximize x of impact:  = 45 o But what in case of damping?

airDamp=slider(0.005,0,0.03) dt=slider(0.1,0.02,40.0) phi=slider(0,0,1.5) plotBall=descartes( [[locations:[fill:'interior',x:r.x,y:r.y,rad:2.5]]]) ) px=r.x g= groundDamp=0.02 v=0.55 boom=(r{1}.vx< ) newVx=r{1}.vx*(1-velDamp*dt) newVy=r{1}.vy+(g-velDamp*r{1}.vy)*dt newX=min(r{1}.x+dt*r{1}.vx,100) newY=max(r{1}.y+dt*r{1}.vy,0) r=if(boom,startR,simR) simR=['x':newX,'y':newY,'vx':newVx,'vy':newVy] startR=['x':0,'y':20,'vx':v*cos(phi),'vy':v*sin(phi)] velDamp=if(r{1}.y>0,airDamp,groundDamp) boom indicates that a new shot will be fired: this happens if the cannon ball has stopped moving the new horizontal speed newVx is a little bit smaller than the previous value the new horzontal location newX is found by integrating the horizontal speed; limit to the right border of the screen the new vertical location newY is found by integrating the vertical speed; limit to the lower border of the screen (‘the ground’) if boom is true, initiate a new shot startR ; otherwise use the simulated location simR simR is an aggregated concept with properties newX, newY, newVx and newVy A shot has its initial speed vx and vy determined by the angle of the canon, phi. The damping on the air is different from the damping on the ground Cannon ball simulation the new vertical speed newVy is g*dt larger than the previous value, corrected for damping

Combat simulation

The initial army sizes e1_0 and e2_0 and the relative strengths lambda_1 and lambda_2 can be adjusted with the sliders as long as the check box p is checked. The battle starts with unchecking checkbox p. p=check(true) e1=if(p,e1_0,max(0,e1{1}-lambda_2*e2{1})) e2=if(p,e2_0,max(0,e2{1}-lambda_1*e1{1})) lambda_1=slider(0.01,0,0.02) lambda_2=slider(0.01,0,0.02) e1_0=slider(100,0,500) e2_0=slider(100,0,500) res=descartes([graph1,graph2]) graph1=[ locations:[x:[mode:'intp'],y:[mode:'shift',value:e1/5],rad:1,fcol_r:255,fill:'interior'] ] graph2=[ locations:[x:[mode:'intp'],y:[mode:'shift',value:e2/5],rad:1,fcol_g:255,fill:'interior'] ] p determines if the battle if running e1 follows from the user-set value e1_0 or from Lanchester’s law, depending on p e2 follows from the user-set value e2_0 or from Lanchester’s law, depending on p lambda_1 is the relative strength of army, controlled by the user lambda_2 is the relative strength of army 2, controlled by the user e1_0 is the initial size of army 1, controlled by the user e_20 is the initial size of army 2, controlled by the user This causes the two graphs being plotted graph1 plots the value of e1 as a function of time graph2 plots the value of e2 as a function of time Combat simulation

Predator - prey simulation

bf=slider(1.5,0,5) br=slider(3,0,5) df=slider(1,0,5) dr=slider(1,0,5) dt=slider(0.15,0.01,0.2) reset=button() p=descartes([gboth,gfox,grab ]) plf=f plr=r r=if((time<2)||reset,150,max(0.01,r{1}+dt*(br*r{1}-dr*f{1}*r{1}))) f=if((time<2)||reset,150,max(0.01,f{1}+dt*(bf*f{1}*r{1}-df*f{1}))) gboth=[ locations:[fill:'interior',rad:5,x:[mode:'shift',value:10+3*f],y:[mode:'shift',value:10+3*r]]] ] gfox=[ locations:[y:[mode:'intp'],x:[mode:'shift',10+3*f]],edges:[thickness:5,col_r:255] ] grab=[ 'x:{mode:intp},y:{mode:shift,ref:1},width:{value:5},col_b:{value:255}',10+3*[r] ] time=time{1}+1 Predator - prey simulation

x-coordinate of the green dots: number of foxes as function of time y-coordinate of the green dots: number of rabits as function of time orange curve: number of foxes as function of time, time proceeding upwards blue curve: number of rabits as function of time, time proceeding to the right Predator - prey simulation

Billiards simulation vrvrvrvr v' r vwvwvwvw v' w rrrr  w = -  r =  =:  =:   = (v w -v r,  )  = (v w -v r,  )  ; ||  ||=1: a unit vector connecting the two centres of the balls

vrvrvrvr v' r vwvwvwvw v' w rrrr  w = -  r =  =:  =:   = (v w -v r,  )  = (v w -v r,  ) Proof: Energy conservation: v r 2 +v w 2 =(v r +  ) 2 +(v w -  ) 2, hence v r 2 +v w 2 =(v r +  ) 2 +(v w -  ) 2, hence 0=(2  (v r,  )+  2 )+(-2  (v w,  )+  2 ), hence  = (v w -v r,  ), QED  ; ||  ||=1: a unit vector connecting the two centres of the balls Billiards simulation

vrvrvrvr v' r vwvwvwvw v' w rrrr  w = -  r =  =:  =:   = (v w -v r,  )  = (v w -v r,  ) v' r =v r +(v w -v r,  )  v' w =v w +(v r -v w,  )   ; ||  ||=1: a unit vector connecting the two centres of the balls Billiards simulation

balls=vSequence(0,nBalls) cX=cursorX() cY=cursorY() help=check(false) queueHit=cursorB() rhoBall=slider(2,0.8,5.0) PR=descartes([plotTable,plotShadow,plotBalls,plotHighLight,plotQueue,plo tQueue2]) collDamp=0.6 dT=0.8 eThreshold=0.5 halfWay=50 mBall=5 maxX=40 maxY=25 minX=-40 minY=-25 nBalls=3 rollDamp=0.994 col=['red':[255,255,255],'grn':[0,255,255],'blu':[0,255,0]] cpl=#(i,balls,cplOneBall(i),vAppend) cplOneBall(i)=#(j,balls,cond(touch(i,j),['close':true,'force':(mpt(i,j)/ m1m2tt(i,j))*tMat[i][j]],['close':false,'force':0]),vAppend) eKin=#(i,balls,vDot(p[i],p[i])/(2*m[i]),add) f=#(i,balls,forceOnOneBall(i),vAppend) forceOnOneBall(i)=#(j,balls,cond(cpl[i][j].close,cpl[i][j].force,0),add) gameState=cond((eKin{1}<eThreshold)&&!queueHit,'hit',cond(queueHit,'roll ','hit')) m=#(i,balls,mBall,vAppend) m1m2tt(i,j)=(m[i]+m[j])*vDot(tMat[i][j],tMat[i][j]) mpt(i,j)=-2*vDot(m[j]*p{1}[i]-m[i]*p{1}[j],tMat[i][j]) p=if(gameState=='roll',rollDamp*wallCollide(p{1}+f),[['x':0,'y':0],['x': r{1}[1].x-queueX,'y':r{1}[1].y-queueY],['x':0,'y':0]]) plotBalls=[locations:[fill:'interior',data:#(i,balls,[x:halfWay+r[i].x,y :halfWay+r[i].y,fcol_r:col.red[i],fcol_g:col.grn[i],fcol_b:col.blu[i] ],vAppend),rad:rhoBall]] plotHighLight=[locations:[fill:'interior',data:#(i,balls,[x:halfWay+0.1* rhoBall+r[i].x,y:halfWay+0.5*rhoBall+r[i].y],vAppend),rad:0.375*rhoBa ll,fcol_r:255,fcol_g:255,fcol_b:255]] plotQueue=[locations:[icon:'none',data:halfWay+[[x:queueX,y:queueY],[x:r {1}[1].x,y:r{1}[1].y]]],edges:[col_r:0,col_g:0,col_b:0,thickness:0.6, shape:if(gameState=='hit','line','none'),data:[[b:0,e:1]]]] plotQueue2=[locations:[icon:'none',data:halfWay+[[x:10*(r{1}[1].x- queueX)+queueX,y:10*(r{1}[1].y- queueY)+queueY],[x:r{1}[1].x,y:r{1}[1].y]]],edges:[col_g:100,col_r:0, thickness:0.2,shape:if((gameState=='hit')&& help,'line','none'),data:[[b:0,e:1]]]] plotShadow=[locations:[fill:'interior',data:#(i,balls,[x:halfWay- 0.15*rhoBall+r[i].x,y:halfWay- 0.5*rhoBall+r[i].y],vAppend),fcol_r:0,fcol_g:0,fcol_b:0,fcol_a:0.5,ra d:rhoBall]] plotTable=[locations:[icon:'vBar',fill:'interior',x:50,y:25,width:80,hei ght:50,fcol_r:0,fcol_g:128]] queueX=cX-halfWay queueY=cY-halfWay r=if(gameState=='roll',r{1}+dT*p/m,cond(time==1,#(i,balls,['x':halfWay*( random()-0.5),'y':0.5*halfWay*(random()-0.5)],vAppend),r{1})) rho=#(i,balls,rhoBall,vAppend) tMat=#(i,balls,tMatOneBall(i),vAppend) tMatOneBall(i)=#(j,balls,tVec(i,j),vAppend) tVec(i,j)=r{1}[j]-r{1}[i] time=time{1}+1 touch(i,j)=((vNormEuclid(tMat[i][j])<(rho[i]+rho[j]))&&(i!=j)&&vDot(tMat [i][j],p{1}[i]/m[i]-p{1}[j]/m[j])>0) wallCollide(a)=wallCollideLeft(wallCollideRight(wallCollideBottom(wallCo llideTop(a)))) wallCollideBottom(a)=#(i,vDom(a),cond((r{1}[i].y>(minY+rho[i]))||(a[i].y >0),a[i],['x':collDamp*a[i].x,'y':-collDamp*a[i].y]),vAppend) wallCollideLeft(a)=#(i,vDom(a),cond((r{1}[i].x>(minX+rho[i]))||(a[i].x>0 ),a[i],['x':-collDamp*a[i].x,'y':collDamp*a[i].y]),vAppend) wallCollideRight(a)=#(i,vDom(a),cond((r{1}[i].x<(maxX- rho[i]))||(a[i].x<0),a[i],['x':- collDamp*a[i].x,'y':collDamp*a[i].y]),vAppend) wallCollideTop(a)=#(i,vDom(a),cond((r{1}[i].y<(maxY- rho[i]))||(a[i].y<0),a[i],['x':collDamp*a[i].x,'y':- collDamp*a[i].y]),vAppend) … plus a further handfull of details Billiards simulation