Post Reply 
help: euler() prg on home mode
05-30-2017, 04:18 PM (This post was last modified: 06-07-2017 03:06 PM by compsystems.)
Post: #3
RE: help: euler() prg on home mode
Thanks toml_12953, but the file euler1.hppprgm does not clean the terminal view why?

Version calling an external function v(t)
PHP Code:
// file euler2.hppprgm
// version simple MODO HOME (NUM)
local g;c;m;t;
local vi;ti;vf;tf;iteration;

local v(t)
BEGIN
    
return vi+(g-(c/m)*vi)*(t-ti);
END;

export euler2()
BEGIN
  purge
(g,c,m,t,vi,ti,vf,tf);
  
g:=9.81c:=12.5m:=68.1;
  
vi:=0;
  
ti:=0;
  
iteration:=1;
  print; 
// clear terminal view (output)
  
print("press [↓] for next iteration" );
  print(
"euler2");
  print(
"press [on] for exit" );
  
wait(1);   
  FOR 
tf FROM 0 TO 10 STEP 2 DO
    print; 
// clear terminal view (output)
    
print("iteration = "+iteration);
    
vf:=v(tf);
    print(
"vi = "+vi+" m/s");
    print(
"ti = "+ti+" s");
    print(
"tf = "+tf+" s");
    print(
"vf("+tf+") = "+vf+" m/s");
    print(
"");
    
vi:=vf;
    
ti:=tf;
    
iteration:=iteration+1
    
wait();
  
END;
  print(
"Iterations finished" );
  return(
"Done");
END

Some alternative way for file euler2.hppprgm but without call an external function v(t) and not #cas...end prgm, I think the CAS() command is required
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: help: euler() prg on home mode - compsystems - 05-30-2017 04:18 PM



User(s) browsing this thread: 1 Guest(s)