       • To: mathgroup at smc.vnet.net
• Subject: [mg65825] calculating contradicts plotting
• From: Nandan Joshi <calculi at gmail.com>
• Date: Mon, 17 Apr 2006 02:29:22 -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.

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: Re: mathematica programming
• Next by Date: Re: Re: bug in Partition?
• Previous by thread: Re: Re: Named Formats? (followup question)