Category:UBASIC

(Redirected from UBasic)
UBASIC is an implementation of BASIC. Other implementations of BASIC.
UBASIC is a freeware BASIC interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing.

More information and links can be found at its Wikipedia article.

Sample Program

This simple program approximates specific derivatives:

10  Point 6 'Sets decimal display to 28 places (0+.1^27)
20  rf=#pi/180 'Degree -> Radian Conversion
30 Dc=20
100 Q=73*rf:?Chr(2):?"   F'(Q): Approximation","     Actual Value":N=1:GoSub 1000:?Using(,Dc),cos(Q):N=2:GoSub 1000:?Using(,Dc),1/Q:N=3:GoSub 1000:?Using(,Dc),#pi*Q^(#pi-1)
999 End
1000  '*** Print Sub ***
1010 ?Using(,Dc),.Fp(Q);"  ";:Return
59999  End
60000  '*** Function Assignment ***
60100 .F(N,Q):If N=1 Then Return(sin(Q)) 'Fp=cos(Q)
60102         If N=2 Then Return(log(Q)) 'Fp=1/Q
60104         If N=3 Then Return(Q^#pi) 'Fp=pi*Q^(pi-1)
60105 ?"Invalid Function Code:  N must be '1' or '2' or '3'"
60109  End
60210 .Fp(Q):dQ=#eps^0.3:Return((.F(N,Q+0.5*dQ)-.F(N,Q-0.5*dQ))/dQ)

Running as written gives:

Run
0.29237170472273672804   0.29237170472273672810
0.78487369196003179303   0.78487369196003179283
5.27771467407719816786   5.27771467407719816637
OK

Pages in category "UBASIC"

This category contains only the following page.