Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages12>
Options
Go to last post Go to first unread
Offline forziwka  
#1 Posted : 28 April 2021 22:47:54(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Hi, guys
I need help for my graduation work, i need to use maximize function in Smath Studio, but i have no idea how to do it :'( :'( :'( :'( :'( :'( :'( :'( :'( .
Is there a plugin for maximize / minimize functions in Smath Studio?

Edited by moderator 30 April 2021 17:11:30(UTC)  | Reason: moved to QUESTIONS (not a bug)

Online overlord  
#2 Posted : 29 April 2021 04:58:15(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 376
Turkey

Was thanked: 103 time(s) in 76 post(s)
Originally Posted by: forziwka Go to Quoted Post
Hi, guys
I need help for my graduation work, i need to use maximize function in Smath Studio, but i have no idea how to do it :'( :'( :'( :'( :'( :'( :'( :'( :'( .
Is there a plugin for maximize / minimize functions in Smath Studio?

You can write your own functions.
maximize and minimize are peak points of slope.
Take derivative of equation, solve it.
Check the examples below.

Regards

maximize_minimize.sm (17kb) downloaded 16 time(s).

maximize_minimize with different solvers.sm (29kb) downloaded 16 time(s).

maximize_minimize.png

Edited by user 29 April 2021 05:02:37(UTC)  | Reason: Not specified

thanks 1 user thanked overlord for this useful post.
on 29/04/2021(UTC)
Offline forziwka  
#3 Posted : 29 April 2021 15:00:50(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

I have a program in MathCad,the problem is that the marshmallow recipe is being optimized here,

I need a maximization function to find the maximum value of each ingredient.

sbalansir. + organoleptika zefira - f-cii Ketle.xls (21kb) downloaded 4 time(s).

the exel file contains the values ​​of each marshmallow component that are used in the task.

sbalansir. + organoleptika zefira - f-cii Ketle.xmcd (251kb) downloaded 5 time(s).

The whole problem is that the function K(x) is six-dimensional and there is no idea how to find its derivatives.

I need to do the same in Smath Studio, but there are no Given / Maximize / Minimize functions in Smath,

I don't know how to implement this.

Here is everything that I could implement in Smath from the Mathcad file.

diplomnayaRabota.sm (34kb) downloaded 10 time(s).

p.s If something is not clear, ask, I will try to answer.
Sorry for my bad eng Good

Edited by user 29 April 2021 15:05:01(UTC)  | Reason: Not specified

Offline Razonar  
#4 Posted : 29 April 2021 15:22:32(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 752
Uruguay

Was thanked: 404 time(s) in 258 post(s)
Originally Posted by: forziwka Go to Quoted Post


p.s If something is not clear, ask, I will try to answer.


Hi, can you upload a pdf instead the mathcad xmcd file, please?

Best regards.
Alvaro.
Offline forziwka  
#5 Posted : 29 April 2021 15:56:41(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Razonar Go to Quoted Post
Originally Posted by: forziwka Go to Quoted Post


p.s If something is not clear, ask, I will try to answer.


Hi, can you upload a pdf instead the mathcad xmcd file, please?

Best regards.
Alvaro.



everything is written in Russian, if you have any questions, I will explain.

Mathcad - sbalansir. + organoleptika zefira - f-cii Ketle.pdf (246kb) downloaded 11 time(s).
Offline forziwka  
#6 Posted : 29 April 2021 16:18:43(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: overlord Go to Quoted Post
Originally Posted by: forziwka Go to Quoted Post
Hi, guys
I need help for my graduation work, i need to use maximize function in Smath Studio, but i have no idea how to do it :'( :'( :'( :'( :'( :'( :'( :'( :'( .
Is there a plugin for maximize / minimize functions in Smath Studio?

You can write your own functions.
maximize and minimize are peak points of slope.
Take derivative of equation, solve it.
Check the examples below.

Regards

maximize_minimize.sm (17kb) downloaded 16 time(s).

maximize_minimize with different solvers.sm (29kb) downloaded 16 time(s).

maximize_minimize.png


Unfortunately, this does not work with my function, because it is more complex than yours.
Offline gallyon1  
#7 Posted : 29 April 2021 17:44:59(UTC)
gallyon1

Rank: Newbie

Groups: Registered
Joined: 21/02/2021(UTC)
Posts: 6
Russian Federation

Why are denominators 0? B2j≠B1j. Am i wrong?
Online overlord  
#8 Posted : 29 April 2021 18:16:06(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 376
Turkey

Was thanked: 103 time(s) in 76 post(s)
Originally Posted by: forziwka Go to Quoted Post
Unfortunately, this does not work with my function, because it is more complex than yours.

Here is the first solution for your graphics. Rest are in the example.
This is an ugly and fast solution compiled in a haste.
I am pretty sure someone in the forum will come with a more classy method.

Regards

diplomnayaRabota_rev.sm (41kb) downloaded 9 time(s).

2021-04-29_18-12.png

Edited by user 29 April 2021 18:24:13(UTC)  | Reason: Not specified

thanks 1 user thanked overlord for this useful post.
on 29/04/2021(UTC)
Offline forziwka  
#9 Posted : 29 April 2021 18:38:37(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: forziwka Go to Quoted Post
Originally Posted by: overlord Go to Quoted Post
Originally Posted by: forziwka Go to Quoted Post
Unfortunately, this does not work with my function, because it is more complex than yours.

Here is the first solution for your graphics. Rest are in the example.
This is an ugly and fast solution compiled in a haste.
I am pretty sure someone in the forum will come with a more classy method.

Regards

diplomnayaRabota_rev.sm (41kb) downloaded 3 time(s).

2021-04-29_18-12.png



Thanks for your feedback Good , but I need to calculate maximize from the function K(x),
not from y(j, x).

Check this pdf Mathcad file:
Mathcad - sbalansir. + organoleptika zefira - f-cii Ketle.pdf (246kb) downloaded 8 time(s).

After the function K (x), the vector x is given as the initial approximation
and after that the Given and Miximize functions are used for the K(x) function.
I need to get vector X in Smath.
p.s sorry for my bad eng Confusion


Offline forziwka  
#10 Posted : 30 April 2021 12:31:24(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Jean Giraud Go to Quoted Post
Graphs are doctored and more, but can't sanity more
Cheers ...Jean

diplomnayaRabota.sm (46kb) downloaded 12 time(s).


Thanks for your corrections Good , but the main question was how to get this vector X without the Given and Maximize functions,

because it's obtained from these functions: "X: = Maximize (K, x) ?

1.png
Online overlord  
#11 Posted : 30 April 2021 13:24:17(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 376
Turkey

Was thanked: 103 time(s) in 76 post(s)
Originally Posted by: forziwka Go to Quoted Post
Thanks for your corrections Good , but the main question was how to get this vector X without the Given and Maximize functions,

because it's obtained from these functions: "X: = Maximize (K, x) ?

That is a total different solver. Smath don't have it integrated.
Maple software has it as Maximize() and Minimize() but plugin doesn't parse it under linux.
At least I couldn't do it with maple plugin.

Maxima can solve that kind of equations with maximize_lp() and minimize_lp().
You have to load(simplex) before using this two functions.
Maybe maxima plugin could work but I can't try it, need a windows user to try it.
I use maxima under terminal, maxima plugin doesn't work with linux.

Regards.
Offline forziwka  
#12 Posted : 30 April 2021 15:03:36(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: forziwka Go to Quoted Post
but the main question was how to get this vector X without the Given and Maximize functions,
because it's obtained from these functions: "X: = Maximize (K, x) ?

The bloc solver Given ... Find, Minerr, Maximize, Minimize
is Mathsoft proprietary specific to Mathcad. No such equivalent Smath.
Given/Minerr for fitting model function to data set is done otherwise
in Smath via Conjugate Gradient ... same or even better.
If there is another way of doing in Smath, expect Designers to help.
Sorry Collab, can't help directly on that ... Jean.


:'(

I tried to do this for a simple function through the "roots" function, and in the end I found the maximum,

finding the maximum for a simple function.sm (13kb) downloaded 10 time(s).

but there are no ideas how to do this for K (X), since it depends on 6 arguments of the vector x.

Is it possible to somehow implement the same algorithm in my task?

Edited by user 30 April 2021 15:36:54(UTC)  | Reason: Not specified

Offline forziwka  
#13 Posted : 01 May 2021 13:42:10(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: forziwka Go to Quoted Post
Is it possible to somehow implement the same algorithm in my task ?

The Ancestor of the savant solve is the TKsolve.
The designers of TKsolve are the Founders of Mathsoft/Mathcad.
No Mathcad gurus succeeded to crack the bloc, probably crypted deep.



It's a pity that this method is not solved. Sad
Offline Razonar  
#14 Posted : 01 May 2021 22:57:32(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 752
Uruguay

Was thanked: 404 time(s) in 258 post(s)
Hi. There are no minimizers in SMath, with the probable exception of a library in Maxima that can be read and executed, as Overlod point.

However, a kind of minimizer can be implemented as shown in the attached, and incidentally, obtain a solution (just a little bit) better than Mathcad's.

diplomnayaRabota_nleqsol.sm (84kb) downloaded 24 time(s).

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 02/05/2021(UTC)
Offline forziwka  
#15 Posted : 03 May 2021 14:00:05(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Razonar Go to Quoted Post
Hi. There are no minimizers in SMath, with the probable exception of a library in Maxima that can be read and executed, as Overlod point.

However, a kind of minimizer can be implemented as shown in the attached, and incidentally, obtain a solution (just a little bit) better than Mathcad's.

diplomnayaRabota_nleqsol.sm (84kb) downloaded 24 time(s).

Best regards.
Alvaro.


Thank you so much for your work. I appreciate it. Wink
Offline forziwka  
#16 Posted : 04 May 2021 14:14:35(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Razonar Go to Quoted Post
Hi. There are no minimizers in SMath, with the probable exception of a library in Maxima that can be read and executed, as Overlod point.

However, a kind of minimizer can be implemented as shown in the attached, and incidentally, obtain a solution (just a little bit) better than Mathcad's.

diplomnayaRabota_nleqsol.sm (84kb) downloaded 24 time(s).

Best regards.
Alvaro.


Hi, I didn't really understand how you made such a function for the previous maximize problem,
I wanted to ask you to help me solve a simpler problem on this topic.

Milk shake optimization.sm (18kb) downloaded 2 time(s).

pdf Mathcad file:

Mathcad - mag.2020 Aleksandr Baranov Optimizacija molochnogo koktejjlja.pdf (100kb) downloaded 14 time(s).

In this program, I need to repeat everything in the same way as in the screenshots of MathCad, i attached them to Smath.

I would be very grateful if you could help me.Blush

If you have any questions, ask, I will answer them.

Edited by user 04 May 2021 19:32:44(UTC)  | Reason: Not specified

Offline forziwka  
#17 Posted : 04 May 2021 17:41:17(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: forziwka Go to Quoted Post
In this program, I need to repeat everything in the same way as in the screenshots of MathCad, I attached them to Smath

Horrible screen shot, nothing to see for understanding.
Seemingly, you have a system to solve ... something like Butler.

Solve Given_Find [CO2_6179 Butler].sm (163kb) downloaded 5 time(s).


I'll try to make a pdf Mathcad file.
Some formulas simply dont fit into the full sheet and go beyond the boundaries.
Offline forziwka  
#18 Posted : 04 May 2021 19:33:46(UTC)
forziwka


Rank: Member

Groups: Registered
Joined: 28/04/2021(UTC)
Posts: 12
Russian Federation
Location: Krasnodar

Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: forziwka Go to Quoted Post
Some formulas simply don't fit into the full sheet and go beyond the boundaries.

Your Mathcad document is surely badly dressed.


like it turned out to make pdf
Mathcad - mag.2020 Aleksandr Baranov Optimizacija molochnogo koktejjlja.pdf (100kb) downloaded 14 time(s).
Offline Razonar  
#19 Posted : 04 May 2021 23:08:24(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 752
Uruguay

Was thanked: 404 time(s) in 258 post(s)
Originally Posted by: forziwka Go to Quoted Post

Hi, I didn't really understand how you made such a function for the previous maximize problem,


Hi. Point is: how to solve that in SMath? Because SMath haven't maximizer, and what you have near to that is al_nleqsolve, you can read that in this way: How to use a traditional solver for seek a maximum with constraints?

So, you have a function K(x) with x element of R^6, a guess xo and the guess value for the maximum K(xo). First, write Check(x), for restrict x for the constraints. Next, because numerical solvers for roots needs the evaluation of the change in the target value, assume that you are looking for the zero of f(x) = K(x) - (1+p)*Ko, where p is some percent increment over Ko. Why? Because you guess that xo it's a good solution, so, Ko = K(xo) "must" to be a good guess for the maximum. The Maximize ad hoc function it's just the implementation for that: here the trick is use K(Check(x)) instead K(x). You can try to change the p-value for get the best answer that you can.

Originally Posted by: forziwka Go to Quoted Post


In this program, I need to repeat everything in the same way as in the screenshots of MathCad, i attached them to Smath.

I would be very grateful if you could help me.Blush

If you have any questions, ask, I will answer them.


The Mathcad's screenshots are perfect. Here you have a little difference: the restrictions involving another function Kc(x), but it's very similar, and need to write CheckX for x and CheckKc for Kc(x). The trick for CheckKc(x): No one, but three:

First, return some information to the solver about how the things are going. Instead of return 0 or 1, return 0 for Kc is in the good interval, and +/- normi(x) if not.
Second, include CheckKc(CheckX(x)) as second row in the target function for try to get zeros on both components.
Third, include CheckKc in the exit condition for the main loop.

Milk shake optimization nleqsol.sm (1,444kb) downloaded 16 time(s).


Hope that's helps.
Best regards.

Alvaro.

Edited by user 04 May 2021 23:10:07(UTC)  | Reason: Not specified

thanks 1 user thanked Razonar for this useful post.
on 05/05/2021(UTC)
Offline Davide Carpi  
#20 Posted : 05 May 2021 01:21:08(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,390
Man
Italy
Location: Italy

Was thanked: 1195 time(s) in 787 post(s)
You might try even these

GoldenSectionSearch.sm (22kb) downloaded 98 time(s).
GradientDescent.sm (17kb) downloaded 73 time(s).
NCGM.sm (20kb) downloaded 69 time(s).
LevenbergMarquardt.sm (46kb) downloaded 98 time(s).
NewtonMethod.sm (19kb) downloaded 107 time(s).
NelderMead.sm (34kb) downloaded 81 time(s).
GaussNewton.sm (21kb) downloaded 84 time(s).
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Users browsing this topic
2 Pages12>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.