BASIC Programs on HP 50G
|
03-11-2014, 03:29 PM
(This post was last modified: 03-11-2014 03:33 PM by churichuro.)
Post: #28
|
|||
|
|||
RE: BASIC Programs on HP 50G
examp #1: area of circle, here use the stack!
D=POP A=D*D*PI/4 PRINT "AREA=";A PUSH A END examp #2: from C bible the program Celsius lower=0 upper=300 step1=20 fahr=lower while fahr<=upper celsius=(5.0/9.0)*(fahr-32.0) print fahr,celsius fahr=fahr+step1 Wend end examp #3: Int. SIMPSON ver 1. print "Integral por el metodo SIMPSON" input "lim. inf=",a input "lim. sup=",b input "# intervalos=",c h=(b-a)/c x=a gosub 1000 i=f for m=1 to c/2 x=x+h gosub 1000 i=i+f*4 x=x+h gosub 1000 i=i+f*2 next x=b gosub 1000 i=i-f print "i=";i*h/3 end 1000 f=x^3+x^2-x-1 return end examp #4: use DATA and READ instructions print "Ejemplo de datas" read x,y,z$ print "X=";x print "Y=";y print "Z=";z$ data 10, 25.4, "hola!!!" end examp #5: here the user can write an equation for X and is evaluate INPUT "X = ",X INPUT "EQ=",E$ PRINT VAL(E$) END examp #6: int. SIMPSON ver 2. print "Integral por el metodo SIMPSON" print "Ecuacion en funcion de x" input "ejemplo: x^3+x^2-x-1 :",e$ input "limite inf=",a input "limite sup=",b input "# intervalos=",c print "resolviendo para : f=";e$ h=(b-a)/c x=a f=val(e$) i=f for m=1 to c/2 x=x+h f=val(e$) i=i+f*4 x=x+h f=val(e$) i=i+f*2 next x=b f=val(e$) i=i-f print "i=";i*h/3 end |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 21 Guest(s)