Partpspec: in Nminimize method

  • Thread starter parzio
  • Start date
  • Tags
    Method
In summary, the conversation discusses the use of subscripts in Mathematica and the difficulties that they can present. The user is trying to minimize deviations in a matrix, but encounters errors due to the use of subscripts. The expert advises either becoming skilled in using work-arounds or avoiding the use of subscripts altogether.
  • #1
parzio
4
0
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??
 

Attachments

  • Untitled-22.bmp
    135.9 KB · Views: 448
Last edited:
Physics news on Phys.org
  • #2
parzio said:
Does someone explain me why I obtain these errors??

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.
 

What is "Partpspec" in the Nminimize method?

"Partpspec" is a parameter in the Nminimize method that stands for "partial specification". It is an optional argument that allows you to specify a subset of variables or parameters that you want to optimize, while holding the remaining variables or parameters constant.

How is "Partpspec" used in the Nminimize method?

"Partpspec" is used as an input in the Nminimize method, along with other required arguments such as the objective function and initial values for the variables or parameters. It allows you to specify a list of variables or parameters that you want to optimize, while keeping the others constant.

What is the purpose of "Partpspec" in the Nminimize method?

The purpose of "Partpspec" is to provide more flexibility and control in the optimization process. It allows you to focus on optimizing a specific subset of variables or parameters, while keeping the other variables or parameters fixed at certain values. This can be useful in situations where you have prior knowledge or constraints on certain variables or parameters.

Can "Partpspec" be used to optimize multiple subsets of variables or parameters in the Nminimize method?

Yes, "Partpspec" can be used to optimize multiple subsets of variables or parameters in the Nminimize method. You can specify a list of subsets, each with their own set of variables or parameters, and the Nminimize method will optimize them simultaneously while keeping the remaining variables or parameters constant.

Are there any limitations to using "Partpspec" in the Nminimize method?

There are a few limitations to using "Partpspec" in the Nminimize method. First, the subsets of variables or parameters must be disjoint, meaning they cannot share any common variables or parameters. Additionally, the subsets must be continuous, meaning you cannot skip over any variables or parameters in the optimization process. Finally, the subsets must be specified in the same order as the original variables or parameters.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
993
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Replies
6
Views
1K
  • Introductory Physics Homework Help
Replies
15
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
741
  • Classical Physics
Replies
12
Views
2K
Replies
1
Views
2K
Back
Top