Iteration of values to satisfy an inequality

Iteration of values to satisfy an inequality - The first given value "d" must be adjusted until reaching the maximum value that satisfies the inequ - Messages

#1 Posted: 5/31/2023 12:21:54 PM
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 likes in 11 posts.

Group: User

Continuing with the iterations
Now I have an initial value "d", this value must be adjusted to satisfy the inequality between two functions that depend on this value "d": V.u≤ϕ*V.c
I want to find the maximum value of "d".
If the initial value of "d" does not satisfy the inequality, that is, V.u> ϕV.c, the value "d" must be increased by 0.05 and if the inequality V.u≤ϕ*V.c is fulfilled, the value must be decreased of "d" by 0.05 until the maximum value of "d" that satisfies the inequality is found. I attach a file of the different ways I tried to get the results but being a neophyte in the use of smath studio I still don't understand what I'm failing.

ITERACION2.sm (22 KiB) downloaded 24 time(s).
#2 Posted: 6/1/2023 4:01:21 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Continuing with the iterations


As it looks, it is a suite ... best not to switch to different thread.
Can you be more descriptive of the objective on the document.
Cheers ... Jean.

#3 Posted: 6/1/2023 11:32:56 PM
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 likes in 11 posts.

Group: User

Wrote

Wrote

Continuing with the iterations


As it looks, it is a suite ... best not to switch to different thread.
Can you be more descriptive of the objective on the document.
Cheers ... Jean.



I already solved the iteration, here the final file
If any improvements can be made to it with the "for" command or something similar, I would appreciate the suggestion.
IterRevFinal.sm (21 KiB) downloaded 38 time(s).
#4 Posted: 6/2/2023 8:48:49 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I already solved the iteration, here the final file
If any improvements can be made to it with the "for" command or something similar,
I would appreciate the suggestion.


1. I don't like min/max as they have undocumented utilities.
2. Complete Bolean suggested.
3. Once done, isolate/store
Good job. Cheers ... Jean.

IterRevFinal.sm (22 KiB) downloaded 21 time(s).
#5 Posted: 6/2/2023 1:59:36 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

If any improvements can be made to it with the "for" command or something similar, I would appreciate the suggestion.
IterRevFinal.sm (21 KiB) downloaded 38 time(s).



Hola Orlando. This is a for loop version of you algorithm. I prefer this over while loops in root solver and other iterative algorithms, as is explained in the attached.

IterRevFinal_for_loop.sm (34 KiB) downloaded 32 time(s).

Best regards.
Alvaro.
#6 Posted: 6/2/2023 6:08:14 PM
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 likes in 11 posts.

Group: User

Wrote

Wrote

If any improvements can be made to it with the "for" command or something similar, I would appreciate the suggestion.
IterRevFinal.sm (21 KiB) downloaded 38 time(s).



Hola Orlando. This is a for loop version of you algorithm. I prefer this over while loops in root solver and other iterative algorithms, as is explained in the attached.

IterRevFinal_for_loop.sm (34 KiB) downloaded 32 time(s).

Best regards.
Alvaro.



The way you solve this iteration with the "for" command is more efficient, excellent!
Even so, there is something that needs to be restricted or conditioned and it is the following: when the initial value of "d" is greater than the first value that meets the inequality, the variable "d" continues to be the initial value, that is: if d= 60 cm satisfies the iteration, but if the initial value is d=80cm the iteration results in 80cm because it satisfies the inequality.
But I want the final value to converge to this "first value" that satisfies the inequality, whether it is very small and iterates to 60cm or much larger and reduces to 60cm.

Thank you very much in advance for your interest in this post.
#7 Posted: 6/2/2023 7:01:23 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

... Even so, there is something that needs to be restricted or conditioned and it is the following: when the initial value of "d" is greater than the first value that meets the inequality, the variable "d" continues to be the initial value, that is: if d= 60 cm satisfies the iteration, but if the initial value is d=80cm the iteration results in 80cm because it satisfies the inequality.
But I want the final value to converge to this "first value" that satisfies the inequality, whether it is very small and iterates to 60cm or much larger and reduces to 60cm.



Hi. Maybe you can try something like in the attached.

IterRevFinal_for_loop.sm (35 KiB) downloaded 39 time(s).

Best regards.
Alvaro.

  • New Posts New Posts
  • No New Posts No New Posts