1 Pages (18 items)
Variables evaluation - Symbolic to numerical substitution and evaluation - Messages
#1 Posted: 4/12/2022 4:14:10 PM
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.
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.
#2 Posted: 4/12/2022 5:04:06 PM
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 (22 KiB) downloaded 33 time(s).
at.sm (22 KiB) downloaded 33 time(s).
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Posted: 4/12/2022 6:16:56 PM
Attach your Smath document.
#4 Posted: 4/12/2022 6:51:35 PM
#5 Posted: 4/12/2022 7:41:47 PM
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.
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.
#6 Posted: 4/12/2022 8:20:21 PM
#7 Posted: 4/12/2022 8:45:20 PM
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!
It seems that to iterate I have to declare the sys vector by myself, isn't it?
Thanks a lot!
#8 Posted: 4/12/2022 9:29:50 PM
#9 Posted: 4/12/2022 11:45:16 PM
wow!, this is what I was looking for!!!, THANK YOU very much Jean Giraud!
#10 Posted: 4/13/2022 7:41:58 AM
I take inspiration from Jean, but I use the Vectorize function and I forget the size of U
FunzioniVettori.sm (6 KiB) downloaded 26 time(s).
sergio
FunzioniVettori.sm (6 KiB) downloaded 26 time(s).
sergio
#11 Posted: 4/13/2022 8:21:09 AM
#12 Posted: 4/13/2022 8:41:51 AM
WroteI take inspiration from Jean, but I use the Vectorize function and I forget the size of U
Superb Sergio ... added in the main document.
#13 Posted: 4/13/2022 9:48:44 AM
An algorithm can also be used.
It may be simpler by this way.
Regards
Worksheet1_algorithm.sm (4 KiB) downloaded 32 time(s).

It may be simpler by this way.
Regards
Worksheet1_algorithm.sm (4 KiB) downloaded 32 time(s).
#14 Posted: 4/13/2022 2:10:35 PM
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 !
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 !
#15 Posted: 4/13/2022 2:48:08 PM
You should always define variables used as arrays in function before assigning elements.
Worksheet1_algorithm.sm (8 KiB) downloaded 25 time(s).

Worksheet1_algorithm.sm (8 KiB) downloaded 25 time(s).
1 users liked this post
sergio 4/13/2022 4:00:00 PM
#16 Posted: 4/13/2022 4:04:10 PM
WroteJust 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 (5 KiB) downloaded 26 time(s).
#17 Posted: 4/13/2022 4:47:50 PM
WroteYou 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
#18 Posted: 4/13/2022 5:55:24 PM
WroteJust 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 please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 Pages (18 items)
-
New Posts
-
No New Posts