cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Symbol math Prime and Mathcad 15

ValeryOchkov
24-Ruby IV

Symbol math Prime and Mathcad 15

I'm trying to parse a test function https://en.wikipedia.org/wiki/Himmelblau%27s_function using symbolic math. It has one local maximum, four global minimums and four saddle points.
Why does Prime's symbolic math only output the minimums? Mattcad 15 symbolic engine produces the traditional answer - absolutely accurate and absolutely indigestible.
Thanks for any response and comments. Attached files.

15-Portret-Minimize.png20-Solve-Error.png21-Plot- Min-Ma-SP.png

13 REPLIES 13


@ValeryOchkov wrote:

IMattcad 15 symbolic engine produces the traditional answer - absolutely accurate and absolutely indigestible.

"absolutely indigestible" ???

Not, if you add "assume, ALL=real"

Werner_E_1-1644499302437.png

BTW, you should show as partial derivative - at least in MC15 we can do that.

 

"absolutely accurate"

Unfortunately - No. (0; 0) is not a solution!

 

 

If you want to to SEE the result in Prime, you would have to add "simplify" or "simplify, max" and to get rid of the vanishingly small imaginary part you can use Ro:=Re(Ro). Its not nice to have to do that, but at least its a workaround.

Werner_E_2-1644499678118.png

 

 

Sorry, but the system has 9 real roots not 4 or 5 roots!


@ValeryOchkov wrote:

Sorry, but the system has 9 real roots not 4 or 5 roots!


You don't have to be sorry 😉

On contrary to Prime, Mathcad 15 tries at least to bring you the missing 5 solutions, too, but it fails to solve the fifth order equation exact symbolically

Werner_E_0-1644511591759.png

Interestingly you can try to solve this equation symbolically in a separate region and Mathcads symbolic switches to float mode and gives you the five real solutions for the y-ccordinates:

Werner_E_1-1644511710582.png

I have no idea why Mathcad wrongly returns (0; 0)  as additional solution if we add the "assume, ALL=real" constraint. 😞

 

Of course you get all nine solutions in one go if you force the symbolic in float mode. This time also MC15 runs into numerical inaccuracies and returns tiny imaginary parts wihch you have to et rid of.

Werner_E_2-1644513240650.png

 

It would be interesting to see if MC11 with Maple can do a better job here (concerning exact symbolic solutions).

In case Luc is willing to give it a try, I attach the relevant parts in MC11 format.

 

LucMeekes
23-Emerald III
(To:ValeryOchkov)

Mathcad 11/Maple:

LucMeekes_1-1644517451859.png

(It's red because the numeric processor complains, because of the brackets surrounding the symbolic evaluation).

Means we have 9 solution pairs for x,y. The x's are:

LucMeekes_2-1644517509155.png

The y's are:

LucMeekes_3-1644517532554.png

And numerical approximation gives:

LucMeekes_5-1644518133736.png

 

Success!
Luc

 

Werner_E
25-Diamond I
(To:LucMeekes)

Interesting! So MC11/Maple switches to float mode partially when it can't solve part of an equation in pure symbolics.

Its irritating that the exact solutions are the ones with a small imaginary part when evaluated numerically.

I guess that a symbolic evaluation with float could avoid that (actually it doesn't in MC15).

 

Tanks Luc!
Maple 2021

Maple.png

The picture made with MC15 does not at all resemble the Prime pic you posted in your initial post (its not included in the Prime file you posted).

I tried to tidy up your worksheet an experienced a very unusual effect.

When I change the algorithm for "minimize" from "Quasi Newton" to "Conjugate Gradients", minimize fails for three points inside the program, but when I call it outside the program, no error occurs.

Has anybody an explanation for this?

EDIT: Yes, me! 🙂 The matrix indices are not the x- and y-values of the points. So outside of the program I was calling the function with the wrong input values. Thats the simple explanation why no error was thrown - silly me!

Werner_E_0-1644584322155.png

BTW, in case anybody is interested: Its not the solve block which fails for these three points but the problem is that the result of the solve block is too inaccurate and does not match to the precalculated value rounded to three decimals:

Werner_E_2-1644585236847.png

 

MC15 sheet attached

 

Werner_E
25-Diamond I
(To:Werner_E)

If you change the program to not just look for the minima but for all nine solutions for both derivaties be zero, you get a nice modern art pic.

Here I used "Find" with the LM-algorithm

Werner_E_0-1644525214178.png

 

Telepathy!

I just thought about the portrait of the nine roots of a system of two equations with two unknowns, when Werner immediately drew it and added nine bullet holes. Pushkin has a story on this subject The Shot (Pushkin) - Wikipedia

Thanks!

My pictures - left Conjugate Gradient, right Quasi-Newton. Find ten differences!

16-Portret-Minimize-Conjugate Gradient.png

fxy-4-color.png

PS

We will have the symbol of partial derivation in Prime 8.

Henri Matisse "Dance"Henri Matisse "Dance"Valery Ochkov "Math Dance"Valery Ochkov "Math Dance"

With the function!

Do you know f(x, y) needs more than 2 colors?

Himmelblau-f-d-d-2-colors.png

Announcements

Top Tags