Lieber Martin,
> ein sicher triviales Problem:
>
> In[5]:=
> A={{1,2},{3,4}}
> Out[5]=
> {{1,2},{3,4}}
> In[6]:=
> A[[i,j]]/.i->1/.j->2
> Part::"pspec":
> "Part specification i is neither an integer nor a list of
> integers."
> Part::"pspec":
> "Part specification j is neither an integer nor a list of
> integers."
> Out[6]=
> 2
>
> Woher kommt diese Fehlermeldung? Sie stoert zwar in diesem Beispiel nicht,
Wie waer's mit:
sunny% math
Mathematica 3.0 for Solaris
Copyright 1988-97 Wolfram Research, Inc.
-- Motif graphics initialized --
In[1]:= A = {{1, 2}, {3, 4}}
Out[1]= {{1, 2}, {3, 4}}
In[2]:= ReleaseHold[Hold[A[[i, j]]] /. {i -> 1, j -> 2}]
Out[2]= 2
(Das Hold um A[[i, j]] verhindert, dass A[[i, j] bzw. Part[A, i, j] sofort
ausgefuehrt wird -- denn Part braucht konkrete ganze Zahlen, keine Symbole
wie i und j. i und j werden also erst durch 1 und 2 ersetzt, dann wird
durch ReleaseHold das Hold aufgehoben und A[[1, 2]] evaluiert.)
Viele Gruesse,
Arnd
--
Arnd Roth
Abteilung Zellphysiologie
Max-Planck-Institut fuer Medizinische Forschung
Postfach 10 28 30, D-69028 Heidelberg
email: roth@XXXXXXX.de
|