Euler method: Difference between revisions

Added Xbasic
(Added various BASIC dialects (Applesoft BASIC, BASIC256, Chipmunk Basic, Gambas, GW-BASIC, MSX Basic, QBasic, True BASIC and Yabasic))
(Added Xbasic)
 
Line 825:
{{out}}
<pre>Same as QBasic entry.</pre>
 
==={{header|XBasic}}===
{{trans|BASIC256}}
{{works with|Windows XBasic}}
<syntaxhighlight lang="qbasic">PROGRAM "Euclidean rhythm"
VERSION "0.0001"
IMPORT "xma"
 
DECLARE FUNCTION Entry ()
DECLARE FUNCTION Euler (paso)
 
FUNCTION Entry ()
PRINT "Time ";
tiempo! = 0.0
DO WHILE tiempo! <= 100.1
PRINT FORMAT$ ("#######", tiempo!);
tiempo! = tiempo! + 10.0
LOOP
PRINT
 
PRINT "Dif eq ";
tiempo! = 0.0
DO WHILE tiempo! <= 100.1
temperatura! = 20.0 + (100.0 - 20.0) * EXP(-0.07 * tiempo!)
PRINT FORMAT$ ("####.##", temperatura!);
tiempo! = tiempo! + 10.0
LOOP
PRINT
 
Euler(2)
Euler(5)
Euler(10)
END FUNCTION
 
FUNCTION Euler (paso)
tiempo! = 0
temperatura! = 100.0
PRINT FORMAT$ ("Step ## ", paso);
 
DO WHILE tiempo! <= 100
IF (tiempo! MOD 10) = 0 THEN PRINT FORMAT$ ("####.##", temperatura!);
temperatura! = temperatura! + SINGLE(paso) * (-0.07 * (temperatura! - 20.0))
tiempo! = tiempo! + paso
LOOP
PRINT
END FUNCTION
END PROGRAM</syntaxhighlight>
 
==={{header|Yabasic}}===
2,122

edits