Mobile Basic
Mobile Basic
Sub main
Dim i as integer
r=b/(2.0*a)
print -r,r
xi=0
for i=0 to 30
gx=-a*xi**2.0/b-(c/b)
print gx
z=xi
if z=gx then
print i
sleep 50000
else
xi=gx
end if
end for
end sub
CICLO FOR
Sub main
Dim i as integer
for i= 1 to 100
print i
end for
end sub
CALCULO DE X
Sub main
dim i as integer
Xi=1
for i=0 to 30
Xc=(1.0/5.0)*(2*Xi)+(8.0/Xi)
print Xc
Xa=Xi
if Xa=Xc then
print i
sleep 50000
else
Xi=Xc
end if
end for
end sub
EL MAYOR ES
sub main
if a<b then
else
end if
end sub
FALSA POSICIÓN
sub main
dim i as integer
fxn=a*xn*4+b*xn3+c*xn*2+d*xn+e
fxp=a*xp*4+b*xp3+c*xp*2+d*xp+e
xc=(xp*fxn-xn*fxp)/(fxn-fxp)
fxc=a*xc*4+b*xc3+c*xc*2+d*xc+e
print xc
if xa=xc then
print i
sleep 50000
else
if fxc>0.0 then
xp=xc
fxp=fxc
else
xn=xc
fxn=fxc
end if
end if
xa=xc
end for
end sub
FOR E IF
Sub main
Dim i as integer
for i= 1 to 50
print i
if i=10 then
sleep 10000
end if
end for
end sub
FORMULA GENERAL
sub main
r=b**2-4.0*a*c
if r<0.0 then
else
x1=(-b+sqrt(r))/(2.0*a)
x2=(-b-sqrt(r))/(2.0*a)
print "x1=",x1
print "x2=",x2
end if
end sub
NEWTON RAPHSON
sub main
dim i as integer
dim gx as double
fx=a*x0*4+b*x03+c*x0*2+d*x0+e
fx1=4.0*a*x0*3+3.0*b*x0*2+2.0*c*x0+d
fx2=12.0*a*x0**2+6.0*b*x0+2.0*c
print fx
print fx1
print fx2
gx=fx*fx2/(fx1**2)
xc=x0-fx/fx1
print xc
fx=a*xc*4+b*xc3+c*xc*2+d*xc+e
fx1=4.0*a*xc*3+3.0*b*xc*2+2.0*c*xc+d
if xa=xc then
print i
sleep 50000
else
x0=xc
end if
xa=xc
end for
else
end if
xc=x0-fx/fx1
print xc
fx=a*xc*4+b*xc3+c*xc*2+d*xc+e
fx1=4.0*a*xc*3+3.0*b*xc*2+2.0*c*xc+d
if xa=xc then
print i
sleep 500000
else
x0=xc
end if
xa=xc
end for
end sub
RAÍZ DE 2
Sub main
dim i as integer
Xi=1
for i=0 to 30
Xc=(1.0/2.0)*(Xi+2.0/Xi)
print Xc
Xa=Xi
if Xa=Xc then
print i
sleep 50000
else
Xi=Xc
end if
end for
end sub
MÉTODO DE LA SECANTE
Sub main
dim i as integer
fx1=a*x1*5+b*x14+c*x13+d*x1*2+e*x1+f
fx2=a*x2*5+b*x24+c*x23+d*x2*2+e*x2+f
xc=x2-(x2-x1)*fx2/(fx2-fx1)
print xc
fxc=a*xc*5+b*xc4+c*xc3+d*xc*2+e*xc+f
if xa=xc then
print i
sleep 50000
else
x1=x2
x2=xc
end if
xa=xc
end for
end sub
VOLUMENES
sub MAIN
DIM I AS INTEGER
while i<11
IF (I = 1) THEN
v=l*l*l
PRINT "Volumen",v
ELSEIF (I = 2) THEN
v=l*b*h
PRINT "Volumen",v
ELSEIF (I = 3) THEN
v=4.0*r*r*r*3.1416/3.0
PRINT "Volumen",v
ELSEIF (I = 4) THEN
v=3.1416*h*r*r/3.0
PRINT "Volumen",v
ELSEIF (I = 5) THEN
v=3.1416*r*r*h
PRINT "Volumen",v
ELSEIF (I = 6) THEN
v=A*h
PRINT "Volumen",v
ELSEIF (I = 7) THEN
v=A*h/3.0
PRINT "Volumen",v
ELSEIF (I = 8) THEN
PRINT "EIGHT"
ELSEIF (I = 9) THEN
PRINT "NINE"
ELSE
PRINT "TEN"
END IF
sleep 7000
end while
End sub
ÁREA DEL TRIANGULO
sub main
A=b*h/2.0
end sub