extract a row from an iteration

extract a row from an iteration - I need help writing this iteration - Сообщения

#1 Опубликовано: 17.05.2023 11:23:59
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 сообщений из 11 понравились пользователям.

Группа: User

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
#2 Опубликовано: 17.05.2023 13:25:27
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Show your departure work, to be more helpful.
Cheers ... Jean.

Iterate Demo.sm (47 КиБ) скачан 24 раз(а).
#3 Опубликовано: 17.05.2023 19:09:05
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 сообщений из 11 понравились пользователям.

Группа: User

Wrote

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 (13 КиБ) скачан 25 раз(а).

#4 Опубликовано: 17.05.2023 19:46:44
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 сообщений из 11 понравились пользователям.

Группа: User

Wrote

Wrote

Show your departure work, to be more helpful.
Cheers ... Jean.


I already resolved it


matrix_programming.sm (13 КиБ) скачан 33 раз(а).


#5 Опубликовано: 18.05.2023 09:27:13
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

74 сообщений из 164 понравились пользователям.

Группа: User

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:
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 BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#6 Опубликовано: 18.05.2023 10:20:07
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 сообщений из 11 понравились пользователям.

Группа: User

Wrote

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:

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 (16 КиБ) скачан 26 раз(а).
#7 Опубликовано: 18.05.2023 12:01:52
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 сообщений из 1674 понравились пользователям.

Группа: User

Hola Orlando. You can use break inside the for loop.

matrix_programming_for.sm (17 КиБ) скачан 32 раз(а).

Best regards.
Alvaro.
#8 Опубликовано: 18.05.2023 12:05:01
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

74 сообщений из 164 понравились пользователям.

Группа: User

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:
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 BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#9 Опубликовано: 18.05.2023 12:05:09
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

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 (14 КиБ) скачан 31 раз(а).
#10 Опубликовано: 18.05.2023 12:57:44
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 сообщений из 11 понравились пользователям.

Группа: User

Wrote

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 (14 КиБ) скачан 31 раз(а).



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 (154 КиБ) скачан 26 раз(а).
#11 Опубликовано: 18.05.2023 13:08:04
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Hello Orlando,

Wrote

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 please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#12 Опубликовано: 19.05.2023 07:53:04
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: User

Wrote

I have a problem, the power went out and now my file does not open


Code the while loop from reconstruction.

WhileLoop.PNG

#13 Опубликовано: 19.05.2023 12:47:36
Orlando Suclupe Santamaria

Orlando Suclupe Santamaria

0 сообщений из 11 понравились пользователям.

Группа: User

ZAPATA_AISLADA - AVANCE.sm (143 КиБ) скачан 30 раз(а).
Wrote

Wrote

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
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений