MathGroup Archive 2002

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

Search the Archive

Re: Not quite a Swell FLOOP

  • To: mathgroup at
  • Subject: [mg37446] Re: Not quite a Swell FLOOP
  • From: "Ersek, Ted R" <ErsekTR at>
  • Date: Wed, 30 Oct 2002 00:50:49 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Steven Hatton was wondering about OOP support in Mathematica.  

You are correct in that Mathematica doesn't have built-in support of OOP.  I
also don't care much for Dr. Maeder's OOP package.  However, I am only a
beginner with OOP, so my assessment may not be accurate.
If you are going to become proficient with Mathematica you need to let go of
your OOP way of doing things, and learn the Mathematica way.  Mathematica
actually has a beautiful and powerful language, but you need to learn how to
use it.  I give some useful examples below.  What would be needed to do
these things in another language or some other math software?

Here I find all {x,y} pairs with (y>5) and return {x, y, x^2+y^2}.  Notice
the mixed data types.

data={{12,2},{3,4},{2,2 Pi},{7,13.4},{3,22},{11,2},{10,9},{6,9.3}};

{{2, 2*Pi, Sqrt[4 + 4*Pi^2]}, {7, 13.4, 15.1182}, {3, 22, Sqrt[493]}, {10,
9, Sqrt[181]}, {6, 9.3, 11.0675}}

Next I define a function that takes any numeric value.  
Here (z) has no numeric value so f[z] is undefined. Again notice the mixed
data types.


{f[z], 10, 1 + 4*Pi^2, 21.25, -4 + 12*I}

Mathematica has a rich set of functions that let you perform various useful
Here I take a long list and break it into a set of smaller lists.  We can
get many variations of this by giving Partition other arguments.


{ {1, 2*Pi, 3 + x, 4}, {4, 5, 6 - x, 7}, {7, 8*x, 9, 10}, 
  {10, 11, 12, 13},{13, 14, 15, 16}, {16, 17, 18, 19}, 
  {19, 20, 21, 22}, {22, 23, 24, 25}, {25, 26, 27, 28}


In addition to the examples above 
   - Mathematica has a tremendous amount of mathematical knowledge built-in.
   - With Mathematica doing and calculations with high precision is trivial.
   - With Mathematica calculations involving integers with thousands, or
millions of digits is trivial.

    Ted Ersek

Download my latest Mathematica Tips, Tricks from
  or from

  • Prev by Date: Re: Re: random derangement
  • Next by Date: Re: Combination/Permutation questions
  • Previous by thread: DrawGraphics Figure-8 && CPU Strangeness
  • Next by thread: Commutative Algebra Group