MathGroup Archive 2004

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

Search the Archive

Re: Uniform design

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48727] Re: Uniform design
  • From: ab_def at prontomail.com (Maxim)
  • Date: Fri, 11 Jun 2004 03:53:29 -0400 (EDT)
  • References: <c8pu2d$kq9$1@smc.vnet.net> <200405251118.HAA03729@smc.vnet.net> <c945gq$r7e$1@smc.vnet.net> <c96i8k$il6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

There are some common problems with standard Mathematica add-on
packages, which can be demonstrated taking just one add-on module,
Graphics`InequalityGraphics`, as an example. First of all, add-ons
often make some assumptions that can be totally unobvious to the user.
Thus InequalityPlot replaces LessEqual/GreaterEqual with strict
inequalities. This means that

InequalityPlot[Max[x, Min[y, 0]] <= 0, {x, -1, 1}, {y, -1, 1}]

will fill only the third quadrant and miss the second quadrant. Since
the documentation doesn't mention this 'feature', the user will of
course view it as a bug. Also the user should realize that only parts
of the boundary are being shown: the output of

InequalityPlot3D[x y z > 0, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]

can be confusing, because it shows only z faces. Next, add-ons often
use nonstandard syntax conventions:

InequalityPlot[x^2 + y^2 < 1, {x}, {y},
  BoundaryStyle -> AbsoluteThickness[3]]
InequalityPlot[x^2 + y^2 < 1, {x}, {y},
  BoundaryStyle -> {{AbsoluteThickness[3]}}]

Both formats won't work, because BoundaryStyle expects a simple list
and nothing else. PlotStyle, Prolog and other options of the standard
Mathematica plotting functions accept any nesting of lists. Although
there are some ambiguities there too: will {Hue[0]} expand into
{Hue[0],grprim} or {{Hue[0]},grprim}? Because of this,

Show[FullGraphics[
  Plot[x, {x, 0, 1}, Prolog -> {Hue[0]}]]]

will display two different plots -- originally the line is drawn in
red, but after the FullGraphics transformation it will be black.

Next, input checking seems not to be tested as carefully as for kernel
functions:

InequalityPlot[x^2 + y^2 < 1, {x}, {y}, PlotPoints -> 1]
InequalityPlot3D[x^2 + y^2 + z^2 < 1, {x}, {y}, {z}, PlotPoints -> 0]

This will just give a lot of warning messages; moreover, in the second
case the warnings only indicate that 'something went wrong' and don't
help to understand the actual problem.

Add-ons often don't make any effort to deal with potentially
problematic issues, such as zero testing (is ArcTan[11/2]/ArcCot[2]-3
the exact zero?). Reduce in Mathematica 5.0 tries to deal with such
problems in a uniform way, generating General::ncomp warning when
necessary. But the add-ons typically don't try to detect potential
problems with 'singular' input data:

InequalityPlot[
  N[0 < y < Sqrt[2] &&
    Sqrt[5 + 2*Sqrt[6]] < x < y + Sqrt[3]],
  {x}, {y}]

InequalityPlot[
  0 < y < Sqrt[2] &&
  y + Sqrt[3] < x < Sqrt[5 + 2*Sqrt[6]],
  {x}, {y}]

The first one again generates a lot of warnings which only indicate
some internal inconsistencies and doesn't display any plot (an invalid
graphics object is generated); the second example takes up about 1Gb
of memory, after which Mathematica kernel crashes on my machine.
Perhaps it is also the question of keeping the add-ons up to date:
InequalityPlot seems to be using obsolete cylindrical decomposition
routines rather than new and more robust functionality of Reduce.

Finally, there are again some issues having to do with parsing. For
example, what is the general structure of a Mathematica graphics
object? You have to look at several different places in the
documentation to piece all the information together, and the add-on
packages often miss some possibilities as well: try to pass graphics
containing Scaled to any of the functions that perform graphics
transformations (such as Shadow or Project from Graphics`Graphics3D`)
and with high probability you'll receive warnings and invalid output:

Shadow[Graphics3D[Polygon[
{Scaled[{1, 0, 0}], Scaled[{0, 1, 0}], Scaled[{0, 0, 1}]}]]]

The output contains invalid objects like Scaled[{0, 0, 1}]-0.5.

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: Re: LogIntegral^(-1)
  • Next by Date: RE: [Off Topic] Re: Re: What is zero divided by zero?
  • Previous by thread: Re: Merging lists if an element in each partially matches?
  • Next by thread: RE: [Off Topic] Re: Re: What is zero divided by zero?