       • To: mathgroup at smc.vnet.net
• Subject: [mg65828] Calculating contradicts plotting
• From: Nandan Joshi <nandan.joshi at phys.uni.goettingen.de>
• Date: Mon, 17 Apr 2006 02:29:25 -0400 (EDT)
• Organization: GWDG, Goettingen
• 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.
Thanx very much in advance!

Regards,
nandan

--
Where the statue stood
Of Newton with his prism and silent face,
The marble index of a mind for ever
Voyaging through strange seas of Thought, alone.
--- Williams Wordsworth on Newton

My website:
http://www.nandan.name

Visit my blogs at:
http://calculi.wordpress.com

```

• Prev by Date: List programming, speed improvement
• Next by Date: Re: Transfer function animation
• Previous by thread: calculating contradicts plotting
• Next by thread: List programming, speed improvement