Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
33
Task/Euler-method/FutureBasic/euler-method.basic
Normal file
33
Task/Euler-method/FutureBasic/euler-method.basic
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
double local fn Cooling( t as double, temp as double )
|
||||
return -0.07 * (temp - 20 )
|
||||
end fn = 0.0
|
||||
|
||||
void local fn Euler( y as double, stepSize as int, endTime as double )
|
||||
int t = 0
|
||||
NSLog( @"\n Step %2d: \b", stepSize )
|
||||
while ( t <= endTime )
|
||||
if ( t % 10 == 0 ) then NSLog( @" %7.3f \b", y )
|
||||
y += stepSize * fn Cooling( t, y )
|
||||
t += stepSize
|
||||
wend
|
||||
end fn
|
||||
|
||||
void local fn Analytic
|
||||
NSLog( @" Time: \b" )
|
||||
for int t1 = 0 to 100 step 10
|
||||
NSLog( @" %8d\b", t1 )
|
||||
next
|
||||
NSLog( @"\nAnalytic: \b" )
|
||||
for int t2 = 0 to 100 step 10
|
||||
NSLog( @"%9.3f\b", 20 + 80 * exp(-0.07 * t2 ) )
|
||||
next
|
||||
end fn
|
||||
|
||||
fn Analytic
|
||||
fn Euler( 100.0, 2.0, 100.0 )
|
||||
fn Euler( 100.0, 5.0, 100.0 )
|
||||
fn Euler( 100.0, 10.0, 100.0 )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue