SMath Studio Forum
»
SMath Studio
»
Questions
»
Iteration of values to satisfy an inequality
Rank: Newbie
Groups: Registered
Joined: 17/05/2023(UTC) Posts: 9 Location: Lima
|
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 (23kb) downloaded 6 time(s).Edited by user 31 May 2023 20:52:41(UTC)
| Reason: Not specified
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: Orlando 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.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 17/05/2023(UTC) Posts: 9 Location: Lima
|
Originally Posted by: Jean Giraud Originally Posted by: Orlando 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 (22kb) downloaded 17 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,868 Was thanked: 980 time(s) in 808 post(s)
|
Originally Posted by: Orlando 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 (23kb) downloaded 3 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: Orlando If any improvements can be made to it with the "for" command or something similar, I would appreciate the suggestion. IterRevFinal.sm (22kb) downloaded 17 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 (35kb) downloaded 9 time(s).Best regards. Alvaro.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 17/05/2023(UTC) Posts: 9 Location: Lima
|
Originally Posted by: Razonar Originally Posted by: Orlando If any improvements can be made to it with the "for" command or something similar, I would appreciate the suggestion. IterRevFinal.sm (22kb) downloaded 17 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 (35kb) downloaded 9 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.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: Orlando ... 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 (36kb) downloaded 14 time(s).Best regards. Alvaro.
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
Iteration of values to satisfy an inequality
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.