MathGroup Archive 1998

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

Search the Archive

Mathematica bug when resolving Contex-names


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11198] Mathematica bug when resolving Contex-names
  • From: ozan@matematik.su.se (Ozan Vktem)
  • Date: Mon, 2 Mar 1998 23:10:52 -0500
  • Organization: Department of Mathematics, Stockholm University

Hi,

  I actually have two questions/bug reports. The first one about
resolving Contex-names and the other about handling ticks. Please also
e-mail any answers/replies to  
   ozan.oktem@foreningssparbanken.se

Question 1: Bug in the way Mathematica handels Contex-names? 
 I can't get Mathematica to load packages and resolve Contex-names 
 in a proper way. Let me illustrate the problem with a simple example: 
 We start by creating three packages, "a.m", "b.m" and "c.m". 
 All reside in the following directory (I use Win NT 4.0 with 
 Mathematica 3.01):
    C:\users\default\Mathematica\3.0\AddOns\Applications\test
 The package "a.m" is given by
      BeginPackage["test`A`"] 
      procA::usage = "some text"
      Begin["`Private`"] 
            procA[x_] := x;
      End[] 
      EndPackage[] 
 The package "b.m", which uses the package "a.m", is given by
   BeginPackage["test`B`"]
   procB::usage = "Some text about the routine"
   Begin["`Private`"]
   Needs["test`A`"]
      procB[x_]:=procA[x]+1
   End[]
   EndPackage[]
 Finally, the package "c.m", which uses the package "b.m", is given by
   BeginPackage["test`C`"]
   procC::usage = "Some text about the routine"
   Begin["`Private`"]
   Needs["test`B`"]
      procC[list_]:=procB[x]-1
   End[]
   EndPackage[]
 
 Now, in a Mathematica notebook, let's type
   In[1]:= <<test`a`
   In[2]:= procA[x]
   Out[2]:= x
 and everything works fine. Also, restarting the kernel and typing 
   In[1]:= <<test`b`
   In[2]:= procB[x]
   Out[2]:= 1+x
 shows that everything works as expected. However, restarting the
 kernel and typing 
   In[1]:= <<test`c`
   In[2]:= procC[x]
   Out[2]:= test`C`Private`x
 shows that something is wrong! It seems that Mathematica can not
 resolve Contexe-names more than one level. Is this a bug or am 
 I doing something wrong? Any suggestions are welcomed.
 
Question 2: Bug in the way Mathematica handels ticks?  I can not
understand 
  the way Mathematica handels ticks in plotting graphics. The following 
  example illustrates the problem:
  Ex1: In[1]:=testlist=Table[j,{j,1,5}];
     
In[2]:=ListPlot[testlist,Ticks->{{{1,"A"},{2.7,"B"},{5,"C"}},Automatic}]
  If things were according to the Mathematica book, I would have the
tickmark "A" 
  under x=1 on the x-axis, "B" under x=2.7 on the x-axis and "C" under
x=5 
  on the x-axis. However, only the ticks for "B" and "C" appear! Even
more 
  confusing is the following example:
  Ex2: In[1]:=testlist=Table[j,{j,1,5}];
     
In[2]:=ListPlot[testlist,Ticks->{{{1,"A"},{2.7,"B"},{5,"C"}},Automatic},

                    PlotRange->{{0,5},Automatic}]
  Then all ticks appear in their proper places. Thus, the placement of 
  ticks seems to depend on the PlotRange settings! This is not mentioned

  in the Mathematica book. Does anybody know exactly how this dependence
is? 
  In example 1 above, why is the tickmark "C" placed correctly but "A"
is not? 
  Both ticks are at the end of the PlotRange which is [0,5].
  Finally consider the following example:
  Ex3: In[1]:=testlist=Table[j,{j,1,5}];
     
In[2]:=ListPlot[testlist,Ticks->{{{1,"A"},{2.7,"B"},{5,"C"}},Automatic},

                    PlotRange->{{0.25,5},Automatic}]
  Still, "A" is not placed under x=1, even though the PlotRange is
[0.25,5], 
  i.e. it contains x=1 which is the position for the ticlmark "A".

-- 
To get random signatures put text files into a folder called 3Random
Signatures2 into your Preferences folder.



  • Prev by Date: Re: lattice definition: help
  • Next by Date: algebraic solutions
  • Prev by thread: Re: A Bug in Flatten?
  • Next by thread: Re: Mathematica bug when resolving Contex-names