Solving Maple Function Minimize Problem with Cristian

  • Context: Maple 
  • Thread starter Thread starter cva
  • Start date Start date
  • Tags Tags
    Maple
Click For Summary

Discussion Overview

The discussion revolves around using Maple to minimize a function with respect to multiple variables that are dependent on a parameter \( v \). Participants explore methods to obtain both the minimum value and the corresponding variable values that achieve this minimum.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Exploratory

Main Points Raised

  • Cristian presents a problem involving the minimization of a function \( f(A1(v), A2(v), A3(v)) \) and seeks to find the values of \( A1(v), A2(v), A3(v) \) that minimize \( f \).
  • One participant suggests using the `location=true` option in the `minimize` function to obtain the locations of the minima.
  • Cristian expresses concern that the output from `minimize` does not maintain the order of the variables, leading to confusion in retrieving the corresponding values for \( A1(v), A2(v), A3(v) \).
  • Another participant clarifies that sets in Maple do not maintain order, while lists do, which may affect how results are interpreted.
  • A suggestion is made to use the `Minimize` command from the Optimization package as an alternative approach.
  • Cristian later reports having solved the problem, explaining that the output from `minimize` contains a set that describes the relationships between the variables rather than their specific values, and provides a method to extract the values using the `subs` command.

Areas of Agreement / Disagreement

Participants generally agree on the challenges associated with variable order in Maple's output. However, there is no consensus on the best method to achieve the desired results, as multiple approaches are discussed without resolution.

Contextual Notes

Participants note limitations regarding the order of elements in sets versus lists in Maple, which may impact the interpretation of results. Additionally, the discussion reflects the complexity of handling function dependencies on parameters.

Who May Find This Useful

This discussion may be useful for users of Maple who are working on optimization problems involving functions of multiple variables, particularly those that depend on parameters.

cva
Messages
17
Reaction score
0
Hello,

I have a problem with maple. My code is like this:


f(A1(v),A2(v),A3(v))

fm:=minimize(f,A1=-1..1,A2=-1..1,A3=-1..1)

so that I obtain a fm(v). But I also need to find A1(v),A2(v),A3(v) that minimize f.

Do you know any way to do this?




Cristian
 
Physics news on Phys.org
Use the location=true option for minimize, that is put

fm:=minimize(f,A1=-1..1,A2=-1..1,A3=-1..1, location=true);

by the way, if you need to know something of this nature, there's a reasonable chance of finding it in the help docs for whatever Maple command you are using. To get the help docs open for a Maple command,
like "minimize" put type

?minimize

at your Maple prompt.
 
Thanks for your reply. My problem is that all these variables are function of v. and I need to have the dependence A1(v),A2(v) and A3(v).
fm:=minimize(..., location=true) gives an array , but unfortunatley ,aple does not keep the order of the variables, every time is different.

For example:

fm[1] := 0.2075577438e-1, {[{A2 = 0.3304115674e-2, A3 = -.5155123546, A1 = 0.9409892271e-1}, 0.2075577438e-1]}
fm[2] := 0.2074929592e-1, {[{At = 0., A1 = .5315345998, A2 = 0.9928747436e-1}, 0.2074929592e-1]}
What I need is fm(v) and A1(v), ... for which correspondening to fm(v).


Cristian
 

Attachments

Thanks for your reply. My problem is that all these variables are function of v. and I need to have the dependence A1(v),A2(v) and A3(v).
fm:=minimize(..., location=true) gives an array , but unfortunatley ,aple does not keep the order of the variables, every time is different.

For example:

fm[1] := 0.2075577438e-1, {[{A2 = 0.3304115674e-2, A3 = -.5155123546, A1 = 0.9409892271e-1}, 0.2075577438e-1]}
fm[2] := 0.2074929592e-1, {[{At = 0., A1 = .5315345998, A2 = 0.9928747436e-1}, 0.2074929592e-1]}
What I need is fm(v) and A1(v), ... for which correspondening to fm(v).


Cristian
 
A set in Maple uses {}'s while a list uses []'s, Maple will not keep the order of objects placed in sets (e.g., if, in Maple, you put Set:={a,b,c};, then Maple may display Set={c,a,b}, or any other arrangement as it pleases), but order is maintained in a list by Maple ((e.g., if, in Maple, you put List:=[a,b,c];, then Maple will always display List=[a,b,c]).
 
You might also try using the Minimize command in the Optimization package:

>with(Optimization);

>?Minimize

should get you started.
 
Thanks for the answers.


Cristian
 
Hello,

Meanwhile I was able to solve the problem.

The ouptput of fm:=minimize(..., location=true) is an array which contains the value of minima and a set like in the eq down.

fm[1] := 0.2075577438e-1, {[{A2 = 0.3304115674e-2, A3 = -.5155123546, A1 = 0.9409892271e-1}, 0.2075577438e-1]}

In fact the set {[{A2 = 0.3304115674e-2, A3 = -.5155123546, A1 = 0.9409892271e-1}, is not giving values to A1,A2,A3 is just the rule that those variables have to obey in oredr to have minima. The values can be extracted with the help of the command subs, like this

subs({[{A2 = 0.3304115674e-2, A3 = -.5155123546, A1 = 0.9409892271e-1},[A1,A2,A3]) .
The rule is applied to the variables.
 

Similar threads

Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K