File: bahnen.e

package info (click to toggle)
euler 1.61.0-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 5,164 kB
  • sloc: ansic: 24,761; sh: 8,314; makefile: 141; cpp: 47; php: 1
file content (17 lines) | stat: -rw-r--r-- 210 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function bahn (x,u,dt,n)
res=[x];
loop 1 to n;
ax=x;
x=x+u*dt+ax*dt^2/2;
u=u+ax*dt;
res=res_[x];
end;
return res;
endfunction

n=100;
res=bahn(1,0,1/n,n)';
xplot(1:n+1,res);
res[n+1],
cosh(1)