MathGroup Archive 1990

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

Search the Archive

supressing argument evaluation by function Part

  • To: mathgroup at yoda.ncsa.uiuc.edu
  • Subject: supressing argument evaluation by function Part
  • From: uunet!splash.Princeton.EDU!rsarava (R Saravanan)
  • Date: Tue, 13 Mar 90 12:46:20 EST

I have been trying to define a formula using the variable "lamsq", which is
a list to be defined later. When I give the following input lines to
Mathematica- 

  lhs = { { -(k^2 + lamsq[[n]]), lamsq[[n]] },
          { lamsq[[n]], -(k^2 + lamsq[[n]]) } }
         
  rhs = { { -(k^2 + lamsq[[n]]) u1[[n]], lamsq[[n]] u1[[n]] },
          { lamsq[[n]] u2[[n]], -(k^2 + lamsq[[n]]) u2[[n]] } }
         
  cmatrix[k_,n_] = Inverse[lhs] . rhs

I get the following error messages-

Part::selectform: 
   Part specification n is neither an integer nor a list of
     nonzero integers.
Part::selectform: 
   Part specification n is neither an integer nor a list of
     nonzero integers.
Part::selectform: 
   Part specification n is neither an integer nor a list of
     nonzero integers.
General::stop: 
   Further output of Part::selectform
     will be suppressed during this calculation.

Although the end result (i.e. "cmatrix") turns out to be what I want, I would 
like to avoid these error messages. Basically, I would like to prevent the
function "Part" from evaluating the argument "n". One way out may be
to define "lamsq" to be a function, rather than a list. But in my problem,
"lamsq" actually happens to be a list of 33 numbers, and I would like
to avoid defining auxiliary functions, unless I really have to. Does
anybody have any comments/suggestions?

Saravanan     <rsarava at splash.princeton.edu>



  • Prev by Date: Speeding up Mathematica
  • Next by Date: Re: Speeding Computations
  • Previous by thread: Re: Speeding up Mathematica
  • Next by thread: Re: Speeding Computations