I'm quite new to Mathematica and so still trying to work out how to use some of its syntax and functions. I have a function for the free energy of a generic system with two order parameters. I am then creating a table with the constants r and g ranging from -100 to 100 in steps of 1. This is shown below in the code:

func[r_, g_, u1_, u2_, u12_, \[Phi]1_, \[Phi]2_] := 1/2 r (\[Phi]1^2 + \[Phi]2^2) + 1/2 g (\[Phi]2^2 - \[Phi]1^2) + u1 \[Phi]1^4 + u2 \[Phi]2^4 + u12 \[Phi]1^2 \[Phi]2^2
regime1 = Table[{func[r, g, 10, 10, 50, \[Phi]1, \[Phi]2], r, g, \[Phi]1, \[Phi]2}, {r, -100, 100, 1}, {g, -100, 100, 1}]

I then get a 2D matrix with each element as a list. This list consists of: the function with the set of parameters passed therein, and then elements for the value of r and the value of g that was passed.

I wanted to map over the first element in each list in the matrix so as to find the minimum values of /[Phi]1 and /[Phi]2 using the /@ syntax and wanted to use the FindMinimum function. I was wondering whether anyone could help me to do this.

  • $\begingroup$ It is not totally clear what you want. Maybe FindMinimum @@@ regime1[[All, 1, {1, 4, 5}]] is what you look for? $\endgroup$ Commented Apr 18, 2019 at 12:14
  • $\begingroup$ @HenrikSchumacher Thanks for the reply. Basically I wanted to obtain a list of the minima in terms of /[Phi]1 and /[Phi]2 along with which values of r and g were being applied. $\endgroup$ Commented Apr 18, 2019 at 12:23

1 Answer 1

n = 10;
regime1 = Table[{func[r, g, 10, 10, 50, ϕ1, ϕ2], r,g, ϕ1, ϕ2}, {r, -n, n, 1}, {g, -n, n, 1}];

f = X \[Function] {X[[2]], X[[3]]} -> FindMinimum[X[[1]], Evaluate[X[[4]]], Evaluate[X[[5]]]];
results = Map[f, regime1, {2}];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.