Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Orlando  
#1 Posted : 31 May 2023 18:21:54(UTC)
Orlando

Rank: Newbie

Groups: Registered
Joined: 17/05/2023(UTC)
Posts: 9
Peru
Location: Lima

Continuing with the iterations Good
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

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jean Giraud  
#2 Posted : 01 June 2023 22:01:21(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Orlando Go to Quoted Post
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.

Offline Orlando  
#3 Posted : 02 June 2023 05:32:56(UTC)
Orlando

Rank: Newbie

Groups: Registered
Joined: 17/05/2023(UTC)
Posts: 9
Peru
Location: Lima

Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: Orlando Go to Quoted Post
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).
Offline Jean Giraud  
#4 Posted : 02 June 2023 14:48:49(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Orlando Go to Quoted Post
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).
Offline Razonar  
#5 Posted : 02 June 2023 19:59:36(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: Orlando Go to Quoted Post
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.
Offline Orlando  
#6 Posted : 03 June 2023 00:08:14(UTC)
Orlando

Rank: Newbie

Groups: Registered
Joined: 17/05/2023(UTC)
Posts: 9
Peru
Location: Lima

Originally Posted by: Razonar Go to Quoted Post
Originally Posted by: Orlando Go to Quoted Post
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.
Offline Razonar  
#7 Posted : 03 June 2023 01:01:23(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: Orlando Go to Quoted Post
... 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.

Users browsing this topic
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.