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 : 17 May 2023 17:23:59(UTC)
Orlando

Rank: Newbie

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

I am learning how to use Smath Studio, I want to write an iteration where an increment of 0.5 is added to two declared variables "a" and "b" which are replaced in a formula and it gives me a final value "X" and the condition is that the iteration stops when the final value is equal to or less than a declared value "Y" to finally extract from the iteration array the row with the three values that meet this condition: [a b X]
I appreciate your help in advance, I am willing to donate

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

Offline Jean Giraud  
#2 Posted : 17 May 2023 19:25:27(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Show your departure work, to be more helpful.
Cheers ... Jean.

Iterate Demo.sm (48kb) downloaded 5 time(s).
Offline Orlando  
#3 Posted : 18 May 2023 01:09:05(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
Show your departure work, to be more helpful.
Cheers ... Jean.


This is the structure that I have been writing to iterate but I need to extract the row of interest, which in this example has to be less than or equal to sigma_adm_suelo, this row is the last

matrix_programming.sm (14kb) downloaded 7 time(s).
Offline Orlando  
#4 Posted : 18 May 2023 01:46:44(UTC)
Orlando

Rank: Newbie

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

Originally Posted by: Orlando Go to Quoted Post
Originally Posted by: Jean Giraud Go to Quoted Post
Show your departure work, to be more helpful.
Cheers ... Jean.


I already resolved it


matrix_programming.sm (14kb) downloaded 10 time(s).


Offline Kenny Lemens  
#5 Posted : 18 May 2023 15:27:13(UTC)
Kenny Lemens


Rank: Advanced Member

Groups: Registered
Joined: 11/01/2018(UTC)
Posts: 133
Man
United States
Location: Wisconsin

Was thanked: 61 time(s) in 38 post(s)
Greetings,

You may want to consider the use of a for loop instead of a while statement:

Copy and Paste the following into your worksheet:
Code:
line(#,for(i:1,i<10,i:i+1,line(#,#,#,#,4,1)),#,3,1)



May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo Banzai

Hotkeys: https://en.smath.com/for...rce.ashx?a=45771&b=2
Offline Orlando  
#6 Posted : 18 May 2023 16:20:07(UTC)
Orlando

Rank: Newbie

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

Originally Posted by: Kenny Lemens Go to Quoted Post
Greetings,

You may want to consider the use of a for loop instead of a while statement:

Copy and Paste the following into your worksheet:
Code:
line(#,for(i:1,i<10,i:i+1,line(#,#,#,#,4,1)),#,3,1)



May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ


The result I am looking for is that it meets the initial condition, how would I stop at the iteration that meets this condition, to be able to do it using the "for" command that you suggested and not the 10 iterations that I declare for "i"

matrix_programming_for.sm (17kb) downloaded 4 time(s).
Offline Razonar  
#7 Posted : 18 May 2023 18:01:52(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)
Hola Orlando. You can use break inside the for loop.

matrix_programming_for.sm (18kb) downloaded 6 time(s).

Best regards.
Alvaro.
Offline Kenny Lemens  
#8 Posted : 18 May 2023 18:05:01(UTC)
Kenny Lemens


Rank: Advanced Member

Groups: Registered
Joined: 11/01/2018(UTC)
Posts: 133
Man
United States
Location: Wisconsin

Was thanked: 61 time(s) in 38 post(s)
Greetings,

The 'i < 10' statement would be replaced with your criteria (ie., ≤ σ.adm_suelo). Regardless, the largest issue you have is with regards to how SMath programs; you need to follow the 'rules' of setting up programming functions within a line() group, where the last item is the value returned as a result.

Copy and paste the following into your worksheet:
Code:
C.summary:+line(C:matrix(max_rows:1,3),for(i:1,({1.075*(P.CM+P.CV)}/{B.zap_0*L.zap_0}-{6*(M.CMx+M.CVx)}/{B.zap_0*L.zap_0^2}+{6*(M.CMy+M.CVy)}/{L.zap_0*B.zap_0^2}≤σ.adm_suelo),i:i+1,line(el(C,i,1):B.zap_0,el(C,i,2):L.zap_0,el(C,i,3):{1.075*(P.CM+P.CV)}/{B.zap_0*L.zap_0}-{6*(M.CMx+M.CVx)}/{B.zap_0*L.zap_0^2}+{6*(M.CMy+M.CVy)}/{L.zap_0*B.zap_0^2},B.zap_0:B.zap_0-Δ,L.zap_0:L.zap_0-Δ,5,1)),C,3,1)


The matrix produced by C.Summary should be what you are after (I simplified the equ by removing Maxima() function calls)

May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo Banzai

Hotkeys: https://en.smath.com/for...rce.ashx?a=45771&b=2
Offline Jean Giraud  
#9 Posted : 18 May 2023 18:05:09(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Maxima is not popular in the Smath Community users.
Don't even recall a single of those decoration gyzmas.

matrix_programming (1) Ignore Maxima.sm (15kb) downloaded 5 time(s).
Offline Orlando  
#10 Posted : 18 May 2023 18:57:44(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
Maxima is not popular in the Smath Community users.
Don't even recall a single of those decoration gyzmas.

matrix_programming (1) Ignore Maxima.sm (15kb) downloaded 5 time(s).


I have a problem, the power went out and now my file does not open. What can I do, does anyone know how to restore it?

ZAPATA_AISLADA.sm (155kb) downloaded 8 time(s).
Offline Davide Carpi  
#11 Posted : 18 May 2023 19:08:04(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Hello Orlando,

Originally Posted by: Orlando Go to Quoted Post
What can I do, does anyone know how to restore it?


I'm sorry but the file is not recoverable (is filled with null characters).
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Jean Giraud  
#12 Posted : 19 May 2023 13:53:04(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Orlando Go to Quoted Post
I have a problem, the power went out and now my file does not open

Code the while loop from reconstruction.

WhileLoop.PNG

Offline Orlando  
#13 Posted : 19 May 2023 18:47:36(UTC)
Orlando

Rank: Newbie

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

ZAPATA_AISLADA - AVANCE.sm (144kb) downloaded 6 time(s).
Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: Orlando Go to Quoted Post
I have a problem, the power went out and now my file does not open

Code the while loop from reconstruction.

WhileLoop.PNG



Hello, I have already made progress with a new file, I used the "for" command and after extracting the first matrix with the values that meet the condition, I made the next iteration with another formula compare the first two columns and extract the matches next to the third column that has a different result, thanks for the help to all of you, I will continue posting new concerns and I will make my donation to smath studio
Users browsing this topic
Guest
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.