Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: packages/notation/errors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83216] Re: packages/notation/errors
  • From: Matthew Fairtlough <matthew at fairtlough.net>
  • Date: Thu, 15 Nov 2007 05:38:02 -0500 (EST)
  • References: <200703140849.DAA24994@smc.vnet.net> <etg42j$ihs$1@smc.vnet.net>

This is an issue I've run into as well.  I declared some notation in a 
notebook and used the notation to make definitions.  The definitions 
worked beautifully within the notebook but the .m file automatically 
written generated syntax errors on loading and on looking at it, the 
notations were not being correctly interpreted.  So it was not possible 
to generate a package out of the original file, as I had wanted.  I 
decided to make all my definitions without the notation and use that to 
generate a package.  After loading it, it is possible to introduce the 
notation.  I am not sure if it is wise to include any notation material 
in packages.  My point is that you don't need to have two packages in 
use to find problems with using notations in packages.

On a related point, is it (ever?) legitimate to get the initialisation 
cells written out to a .m file automatically and then simply to load the 
file into another notebook in the front end using << ?  Or should one 
always make the proper package declarations?

If you get any further with finding out what is going on I'll certainly 
be interested to know.  I'm quite fond of my notations...

My notations were not too complex but I don't think posting them here is 
possible.

Matthew Fairtlough.

Christopher Arthur wrote:
> Try this as an experiment:
> 
> In one package define an infix notation on 
> Subscript[\[SubsetEqual,"c"]] and give it any name you like, say, 
> ClosedSubset.  In another package, put in one statement that actually 
> uses the notation.  Be sure to put in the Needs as necessary.  I bet 
> you'll find that Mathematica won't interpret the new operator unless 
> you run the first package in another front-end window first; the 
> Needs[] call is insufficent.
> 
> Chris Arthur
> 
> Quoting Chris Chiasson <chris at chiasson.name>:
> 
>> This probably has something to do with the contexts of the variables
>> to which your notations are attached.
>>
>> It would be instructive for us to see the notations you have defined.
>>
>> On 3/14/07, Christopher Arthur <caa0012 at unt.edu> wrote:
>>> Mathematica's Package/Context hierarchy implication is impressive in
>>> that it would seem to provide a way to stay organized with larger code
>>> projects.  Unfortunately, getting it to work as expected is confusing,
>>> especially when using the Utilities`Notation`.
>>>
>>> Suppose that you have two packages, called Math`Notation and
>>> Math`Statements.  In the former you define your notation, and in the
>>> latter you put it into use.  Now according to the documentation, all
>>> you need to do to get this to work is put at statement like this at the
>>> start of Math`Statements`
>>>
>>> BeginPackage["Math`Statements`",{"Math`Notation`"}]
>>> ...
>>>
>>> But in fact this does not have the desireed effect.  Mathematica croaks
>>> on all the non-standard notation that you defined.  The only way to
>>> ensure that it won't croak is to load manually into the Kernel your
>>> notation package.  Can someone work this out?
>>>
>>> Christopher Arthur
>>> Student, Mathematics
>>> University of North Texas
>>>
>>>
>>
>> -- 
>> http://chris.chiasson.name/
>>
> 
> 
> 
> Christopher Arthur
> Student, Mathematics
> University of North Texas
> 


  • Prev by Date: Re: DelaunayTriangulation[] output
  • Next by Date: Re: DelaunayTriangulation[] output
  • Previous by thread: Dot product of tensors is not computed in parallel
  • Next by thread: Help needed with new Export (v. 6)