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

MathGroup Archive 2010

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

Search the Archive

is there an 'issue' with putting Notation[] command inside a Module[]?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113527] is there an 'issue' with putting Notation[] command inside a Module[]?
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Mon, 1 Nov 2010 05:00:55 -0500 (EST)
  • Reply-to: nma at 12000.org

I really like the Notation package. I use it now, but very carefully and 
for very limited purpose, just to index my vectors and matrices by replacing

f[[i]]    by    f_i    <==== This is subscript, not underscore
A[[i,j]]  by    f_i,j  <==== This is subscript, not underscore


So that the code is more clear, no need to enter double brackets any 
more, and no need to remember escape sequences for [[ ]] or to count 
Brackets. Many problems went away with this notation.

But for the last 2 hrs, I have been struggling to find what was the 
problem with the code. It was working fine, but I started getting 
strange errors. Sometimes when I use  A[[i,j]] but not A_i,j the problem 
went away, even though the notation was clear and correct.

When I finally moved the Notation command outside the Module, then the 
problems went away.

I had it originally like this:

------------------------
foo[]:=Module[{f},
Notation[  f_i <==>  f[[i]] ];
.....

    f_5= etc.....

]
------------------

I was getting recursion error messages, and other weird errors.

When I replaced the above with

------------------------
Notation[  f_i <==>  f[[i]] ];
foo[]:=Module[{},

    f_5= etc.....

]
------------------

I wanted to put the Notation[]; inside the module, since that is where 
my variable are, and I do not like to use the global name space if I can 
help it.

Here is a screen shot, showing the Notations I was using and now I had 
to move them outside the Module where the variables are :(

http://12000.org/tmp/notation/strange_notation_issue.png

Any one knows if there is a problem with using Notation inside a Module 
or Block and such? I do not think it is a hidden character issue. So I 
think it is just Notation did not like being inside a Module? But why 
Recursions limit exceeded errors?

thanks,
--Nasser






  • Prev by Date: Re: Assertions in Mathematica?
  • Next by Date: Re: Assertions in Mathematica?
  • Previous by thread: Re: Condensed syntax
  • Next by thread: Balance point of a solid