MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Converting ANSO ISO Decimal BASIC to Mathematica 7

  • To: mathgroup at
  • Subject: [mg101900] Converting ANSO ISO Decimal BASIC to Mathematica 7
  • From: BenT <brtubb at>
  • Date: Wed, 22 Jul 2009 06:21:47 -0400 (EDT)

Although I've been using Mathemataica since version 3, more off than
on, skipping versions 4 and 6, I got to use v6 for about a year under
under a complimentary license, which after expiring more than
motivated me to at least budget for and get the v7 Home Edition now.

My learning curve has been slow and high, depending on the free time I
have to devote to using it besides my regular work. I've primarily
been a user of True BASIC and more recently Decimal BASIC for many
years otherwise.

I believe that I and many other hobbyist BASIC programmers would
practically benefit a great deal from anyone having the time to show
program conversions between BASIC and Mathematica. To that end, I
propose any and all Mathematica programmers study the following
example in Decimal BASIC (which is mostly compatible with the ANSI ISO
Full BASIC standard implementation) and any/all different methods for
achieving the same "ends" to achieve the same result would be very
helpful. The program is included with the intstallation of Decimal
BASIC 7.2.8 (, and is
called "Pascal.BAS".

LET modulus=6
LET Nmax=162

DIM c(Nmax,Nmax)
FOR n=0 TO NMax
   LET c(n,0)=1
   LET c(n,n)=1
FOR n=0 TO NMax
   FOR r=1 TO n-1
      LET c(n,r)=MOD(c(n-1,r-1)+c(n-1,r),modulus)
   NEXT r

SET BITMAP SIZE (Nmax+1)*4+1,(NMax+1)*3+1
SET WINDOW -(NMax+1)/2,(NMax+1)/2,NMax+1,0
FOR n=0 TO NMax
   FOR r=0 TO n
      SET AREA COLOR c(n,r)
      DRAW rect WITH SHIFT(r-n/2, n)
   NEXT r

PLOT AREA : -0.5,0; 0.5,0; 0.5,1; -0.5,1

The above program defaults to a 641x641 pixel bitmap in Decimal
BASIC's Output Window. Best wishes to anyone "brave" enough to attempt
this, I hope, educational as well as challenging task.

Benjamin Tubb
brtubb at
Mathematica 7 User

  • Prev by Date: Re: patterns
  • Next by Date: Re: Product::write : Tag List is Protected Error
  • Previous by thread: Clearer code
  • Next by thread: simulating the tab keystroke in front end in InputField