Rank: Member Groups: Registered
Joined: 12/04/2022(UTC) Posts: 11 Location: Guadalajara
|
Dear all: I am new to Smath Studio, great software! Even I am new to its usage, I am trying quite complicated calculations I guess. I am putting the following lines: As you can see, I am using Maxima plugin and the Maxima function ev() to substitute values in the symbolic variable. I have some specific questions: 1.) Is there an alternative way to do this kind of calculations without using the Maxima plugin? 2.) v is a system of values, each value is an equality, is there an automatic way to generate a system of values? Thank to all the people that could help. Edited by user 13 April 2022 01:37:09(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,988 Was thanked: 1124 time(s) in 721 post(s)
|
I can't open your image. From what you describe, you might want to use the substitution function at() from Custom Functions plugin. at.sm (23kb) downloaded 17 time(s). |
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Attach your Smath document.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/04/2022(UTC) Posts: 11 Location: Guadalajara
|
Sorry about the image, now the image is visible. What I want is to iterate over a set o values to substitute in a variable a store the results in a variable, something like this: Is there a way to do this substitutions in an iterative way?. I mean: using a set of programming lines? In this worksheet I copied and pasted the lines to perform the iterations, but in a general problem solving it is desirable to iterate automatically. Edited by user 13 April 2022 02:06:57(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/04/2022(UTC) Posts: 11 Location: Guadalajara
|
Here is the Worksheet: Worksheet1.sm (11kb) downloaded 8 time(s).
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/04/2022(UTC) Posts: 11 Location: Guadalajara
|
Thank you Martin Kraska, at works fine and is what I needed.
It seems that to iterate I have to declare the sys vector by myself, isn't it?
Thanks a lot!
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Mario Acevedo What I want is to iterate over a set o values to substitute in a variable a store the results in a variable, something like this: An iterative process is a solving process. As you say, you just want to plug something from command line.
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/04/2022(UTC) Posts: 11 Location: Guadalajara
|
wow!, this is what I was looking for!!!, THANK YOU very much Jean Giraud!
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/12/2011(UTC) Posts: 319 Location: italy Was thanked: 109 time(s) in 93 post(s)
|
I take inspiration from Jean, but I use the Vectorize function and I forget the size of U
FunzioniVettori.sm (7kb) downloaded 11 time(s).sergio
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
Pay attention! The definition of M(r) doesn't make much sense.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: PompelmoTell I take inspiration from Jean, but I use the Vectorize function and I forget the size of U Superb Sergio ... added in the main document.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,128 Was thanked: 509 time(s) in 339 post(s)
|
An algorithm can also be used. It may be simpler by this way. Regards Worksheet1_algorithm.sm (5kb) downloaded 9 time(s).
|
|
|
|
Rank: Member Groups: Registered
Joined: 12/04/2022(UTC) Posts: 11 Location: Guadalajara
|
Nice implementation!!
Just a question, does the S variable had to be declared and dimensioned previous to its use?
I will try the code asap!
Thank you !
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 21/10/2016(UTC) Posts: 84
Was thanked: 21 time(s) in 17 post(s)
|
You should always define variables used as arrays in function before assigning elements. Worksheet1_algorithm.sm (9kb) downloaded 4 time(s).
|
1 user thanked MarB for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Mario Acevedo Just a question, does the S variable had to be declared and dimensioned previous to its use ? No, it sets by itself within the for loop. Wise to clear within the algo ... U:=0 That will avoid interaction with else U above document. Algo style is an immense companion in Smath. Personally, I use it as much as possible, it enables the local command line. Cheers ... Jean. Maths algo style MATRIX in_extenso.sm (6kb) downloaded 1 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,128 Was thanked: 509 time(s) in 339 post(s)
|
Originally Posted by: MarB You should always define variables used as arrays in function before assigning elements. MarB is dead right. Array variables should be considered carefully if they will be redefined multiple times. Or they can be undefined and named uniquely. I tend to name variables in functions this way. You can find below how I would name your functions variables. Pretends mess of misusage. Regards
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,648 Location: Italy Was thanked: 1331 time(s) in 876 post(s)
|
Originally Posted by: Mario Acevedo Just a question, does the S variable had to be declared and dimensioned previous to its use? It isn't required but it is good practice. If the variable name already exists you might fall in some unexpected cases when the dimensions are different. In addition to the above suggestions, you can use also a Clear(S) as initializer. |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
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.