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 - Poruke

#1 Objavljeno: 31. 5. 2023. 12:21:54
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 svidjanja u 11 postova.

Grupa: 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,21 KiB) preuzeto 1435 put(ova).
#2 Objavljeno: 1. 6. 2023. 16:01:21
Jean Giraud

Jean Giraud

983 svidjanja u 6.866 postova.

Grupa: 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 Objavljeno: 1. 6. 2023. 23:32:56
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 svidjanja u 11 postova.

Grupa: 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,04 KiB) preuzeto 1433 put(ova).
#4 Objavljeno: 2. 6. 2023. 08:48:49
Jean Giraud

Jean Giraud

983 svidjanja u 6.866 postova.

Grupa: 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,87 KiB) preuzeto 1405 put(ova).
#5 Objavljeno: 2. 6. 2023. 13:59:36
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: 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,04 KiB) preuzeto 1433 put(ova).



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,12 KiB) preuzeto 1466 put(ova).

Best regards.
Alvaro.
#6 Objavljeno: 2. 6. 2023. 18:08:14
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 svidjanja u 11 postova.

Grupa: 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,04 KiB) preuzeto 1433 put(ova).



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,12 KiB) preuzeto 1466 put(ova).

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 Objavljeno: 2. 6. 2023. 19:01:23
Alvaro

Alvaro

1.139 svidjanja u 1.805 postova.

Grupa: 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,01 KiB) preuzeto 1458 put(ova).

Best regards.
Alvaro.

  • Novi postovi
  • Nema novih postova