home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
MATH
/
NONLIN31.ZIP
/
MINFALL.NLR
< prev
next >
Wrap
Text File
|
1993-12-11
|
2KB
|
48 lines
/*
* An object begins a fall from position (1000,0), sliding along a frictionless
* guide to position (px,py). It then slides along another guide
* from (px,py) to position (0,1000). Find px and py that minimize descent time.
* The minimum value of the function found by Nonlin is the descent time in
* seconds. All coordinates are in centimeters.
*/
Title "Two segment path for fastest descent";
Parameter px; // X coordinate of bend
Parameter py; // Y coordinate of bend
Constrain px=.1,999; // px must be in range 0 < px < d
Constrain py=.1,999; // py must be in range 0 < py < h
Double G=980; // Acceleration of gravity = 980 cm/sec^2
Double sx=0, sy=1000; // Starting x and y coordinate
Double ex=1000, ey=0; // Ending x and y coordinate
Double d1,d2; // Length of each segment
Double a1,a2; // Acceleration along each segment
Double t1,t2; // Fall time along each segment
Double s1; // Speed at end of segment 1
/*
* Determine length of each segment.
*/
d1 = sqrt((px-sx)*(px-sx) + (py-sy)*(py-sy));
d2 = sqrt((px-ex)*(px-ex) + (py-ey)*(py-ey));
/*
* Determine acceleration for each segment (proportional to slope).
*/
a1 = G*(sy-py)/d1;
a2 = G*(py-ey)/d2;
/*
* Determine time for segment 1 (starting speed is 0).
*/
t1 = sqrt(2.*d1/a1);
/*
* Determine speed at end of segment 1.
*/
s1 = a1 * t1;
/*
* Determine time for segment 2 (speed is s1 at start of segment).
*/
t2 = (sqrt(s1*s1 + 2.*a2*d2) - s1) / a2;
/*
* Minimize the total fall time.
*/
function t1 + t2;
Data;