Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Partpspec: in Nminimize method

  1. Jan 22, 2012 #1
    Hi guys!

    I am trying to acquire some experience in Mathematica and goal programming.
    In the example shown in the attached image I am trying to minimize the deviations in order to obtain the first row matrix value nearest to 10.

    In this case I should obtain x11=5 , n1=5 and p1 =0 instead of i receive these errors:

    Part::pspec: Part specification Subscript[x, 1,1] is neither an integer nor a list of integers. >>
    Part::pspec: Part specification 0.6524678079740285` is neither an integer nor a list of integers. >>
    NMinimize::bcons: The following constraints are not valid. >>

    Does someone explain me why I obtain these errors??

    Attached Files:

    Last edited: Jan 22, 2012
  2. jcsd
  3. Jan 22, 2012 #2
    Partly because you are trying to use subscripts.

    Again and again and again people come here or to other forums and say "I'm using subscripts in this Mathematica problem and it doesn't work, what do I do?"

    Again and again and again the answer is either become sufficiently skilled that you understand how to use the tricks and work-arounds needed to get subscripts to work in Mathematica OR just quit trying to use subscripts and make your life much easier.

    Much of published mathematical notation is inconsistent at one or more levels and depends on the reader being mathematically mature enough to know what the author intended. Mathematica is not mature enough to know what you intend. Mathematica depends on you being sufficiently Mathematica mature to know how to write in a way that Mathematica will understand.

    Subscripts are not "first class citizens" in Mathematica notation and cannot be used anywhere any other symbol can be used if you expect to get the same results. But new Mathematica users see that subscripts are available and have no idea of the difficulties that these can deliver.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook