Skip to content

Commit 937617c

Browse files
committed
some new smaples
1 parent 96811a6 commit 937617c

File tree

3 files changed

+37
-15
lines changed

3 files changed

+37
-15
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
// -> x1 -> x2 ->
3+
4+
vo = 0.5
5+
k1 = 0.1; k2 = 0.14
6+
function ode (x, df)
7+
global vo, k1, k2
8+
df[0] = vo - k1*x[0]
9+
df[1] = k1*x[0] - k2*x[1]
10+
return df
11+
end
12+
13+
hstep = 0.1
14+
x = {0, 0}; df = {0, 0}
15+
t = 0
16+
for i = 0 to 80 do
17+
ode (x, df)
18+
x[0] = x[0] + hstep*df[0]
19+
x[1] = x[1] + hstep*df[1]
20+
t = t + hstep
21+
println (strings.format (int (10*t)/10, "%f"),
22+
", ", strings.format (x[0], "%5.4f"),
23+
", ", strings.format (x[1], "%5.6f"))
24+
end
25+
26+

Rhodus_Version_3/SampleScripts/lib.rh

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11

2-
a1 = 1.234
3-
b1 = 5.678
4-
5-
6-
function sqrt (x)
7-
return x^0.5
8-
end;
9-
10-
11-
function input (prompt)
12-
print (prompt + " ");
13-
return readString()
14-
end;
15-
16-
2+
function callme ()
3+
println ("calling lib")
4+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Stats module
2+
version = 1.0
3+
4+
// Compute the means of a list of numbers
5+
function mean (values)
6+
sum = lists.sum (values)
7+
return sum/lists.len (values)
8+
end

0 commit comments

Comments
 (0)