       • To: mathgroup at smc.vnet.net
• Subject: [mg65829] Calculating contradicts plotting
• From: "calculi" <calculi at googlemail.com>
• Date: Mon, 17 Apr 2006 02:29:27 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi:

This problem has occurred before, where one uses lookup functions and
it
gives the error:
Part::pspec: Part specification 1. is neither an integer nor a list of
integers. More

But in my case, the solution given there doesn't work  :-(

The extracted code is as following:
With[{PiTable = Import["MyPiTemp.dat", "Table"]}, PiFunc[i_Integer,
j_Integer] := PiTable[[i, j]]]
With[{TauTable = Import["MyTauTemp.dat", "Table"]}, TauFunc[i_Integer,
j_Integer] := TauTable[[i, j]]]

\!\(\(S1[q_]\  := \ â??\+\(l =
1\)\%\(LastTerm[r]\)\ \((\((2\ l + 1)\)\/\(l\ \((l + 1)\)\))\)
\((an[l]\
\ PiFunc[l, \ q]\  + \ bn[l]\ \ TauFunc[l, \
q])\);\)\[IndentingNewLine]

\!\(\(Iperp[q_?IntegerQ] := \ \((Abs[S1[q]])\)\^2;\)\)

Plot[Iperp[q], {q, 1, 50}]

and the errors are:
Part::pspec: Part specification 1. is neither an integer nor a list of
integers. Moreâ?¦
Plot::plnr: Iperp[q] is not a machine-size real number at q = 1..
Moreâ?¦
Plot::plnr: Iperp[q] is not a machine-size real number at q = 2.98778.
Moreâ?¦
Plot::plnr: Iperp[q] is not a machine-size real number at q = 5.15563.
Moreâ?¦

As one can see, the matrix is imported in form of table from external
file. Using "With" I made it a function inserted in S1[q], where an[l]
and bn[l] are calculated separately. If I give any integer value for
'q', S1[q] as well as Iperp[q] gives numerical value, that means it
calculates it, but by plotting gives such error? I tried writing 'Hold'
for matrix element and using ReleaseHold[Plot...] to get the argument
on
the right side evaluated first than on the left side, but in vain.

Any urgent help in this case will be appreciated.