Skip to main content
15-Moonstone
April 4, 2024
Solved

Sensitive starting values

  • April 4, 2024
  • 1 reply
  • 1861 views

A friendly hello,
In the attached calculation it is easy to see from the angle sums (they must be 180°) that coarser starting values produce less precise results. Are there settings in MC14 that achieve good calculation results even with coarser starting values? Currently, the iteration can only be made successful in the sense of a fixed point equation with almost exact starting values.

Best answer by Werner_E

Its not always a good idea to set the convergence tolerance CTOL to a value too small. It may result (as in your case) that no solutions are found with bad guess values.

Setting CTOL to its default value 10^-3 gives us results even with coarse guesses, as you can see.

Werner_E_1-1712251523058.png

Of course numerical inaccuracies are inevitable, especially for some bad conditioned approaches.

In your case its sure better to solve the constraint and insert it into the objective function.

Then "Maximize" sure gives a numerical result much closer to the exact one which you also can get using the zero of the derivative.

Werner_E_3-1712252556388.png

 

 

1 reply

25-Diamond I
April 4, 2024

You have just one equation but want to maximize the area by modifying two variables (x and s). Irritating that you use x for the name name the y-coordinate of point A 😉  But then, x is also the x-coordinate of D ...

 

You try to maximize a function with two independent (which IMHO is wrong, see below) variables x and s. Chances are that the corresponding surface has a lot of different local maximas and so it may strongly depend on the guess values which one you get.

 

IMHO the length s=BC  cannot be chosen independently from x as s depends on x. Look at the right angled triangle OCA with the cathets x and x+s/2 and the hypotenuse 19 and apply Pythagoras.

So we get:

Werner_E_3-1712229714657.png

BTW, the original task of @ttokoro  (area given with 60) can now also be solved that way:

Werner_E_0-1712228928305.png

 

BTW you may also change the task and ask for the area of ABC where the length AB is minimal 😉 This modified task has the same solution because when AB is minimal, the area ABC is maximal.

 

Here is a little animation showing area ABC, length AB and length BC as well as the geometry depending on the value chosen for x=OA=OD.

Tri-Ani.gif

Mathcad 15 file attached.

 

 

15-Moonstone
April 4, 2024

Thank you for the detailed explanations and especially for the graphical representations. But I'm afraid that I didn't formulate my question clearly enough and that there is therefore a misunderstanding. Regardless of the geometric background (the problem is quite easy to solve and is currently not the topic), my concern is the following:
Given is a function in two variables that has to be maximized under a secondary condition. The MC calculus requires starting values for the solution in the solution block. If these are chosen too far away from the solution, as in the present case, a very inaccurate numerical solution is created. And this is surprising when, after solving the constraint for x and inserting it into the function f(s,x) to be maximized as a function h(s) (see attached file), you get a curve with an obviously easily recognizable maximum and a larger monotonic environment (respectively left and right). The gradient method should then also tolerate coarser starting values when approximating on both sides in order to lead to a numerically precise solution.
I previously had similar problems in more complicated optimization tasks in multiple variables with multiple constraints. These can usually be solved by adjusting the TOL and CTOL.

Werner_E25-Diamond IAnswer
25-Diamond I
April 4, 2024

Its not always a good idea to set the convergence tolerance CTOL to a value too small. It may result (as in your case) that no solutions are found with bad guess values.

Setting CTOL to its default value 10^-3 gives us results even with coarse guesses, as you can see.

Werner_E_1-1712251523058.png

Of course numerical inaccuracies are inevitable, especially for some bad conditioned approaches.

In your case its sure better to solve the constraint and insert it into the objective function.

Then "Maximize" sure gives a numerical result much closer to the exact one which you also can get using the zero of the derivative.

Werner_E_3-1712252556388.png