0

I optimized a function and I want to use the value.

The answer I got is [4.77011197468878567, [alpha = 1.43792823465135400]] and I want to use the alpha for plotting but I don't know how to extract it.

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jun 18 '22 at 23:35

1 Answers1

0
ans := Optimization:-Minimize(...);

  ans := [4.77011197468878567, [alpha = 1.43792823465135400]];

ans[2];

   [alpha = 1.43792823465135400]

You can utilize that with the eval command, to evaluate-at-a-point (ie, substitute, mathematically).

eval(alpha, ans[2]);
    1.43792823465135400

expr := cos(alpha^2*x);

                 2
expr := cos(alpha  x)

eval(expr, ans[2]);

 cos(2.067637609 x)

acer
  • 5,293