| Author |
Comment/Response |
Nandan Joshi
|
04/27/06 4:36pm
Hi:
The particular function in numerical form experted as table and imported again in another function, whose square should be plotted. But the following code is giving the error.
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 inserted it a function 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.
If I don't export the function in numerical form, and simply insert it in S1[q], then plot the function Iperp[q], it works perfectly. So where does the problem lie?
Any urgent help in this case will be appreciated.
Thanx very much in advance!
calculi
URL: , |
|