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 Mario Acevedo  
#1 Posted : 12 April 2022 22:14:10(UTC)
Mario Acevedo


Rank: Member

Groups: Registered
Joined: 12/04/2022(UTC)
Posts: 11
Man
Mexico
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:

substitution.png

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

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

Offline mkraska  
#2 Posted : 12 April 2022 23:04:06(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,988
Germany

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).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Jean Giraud  
#3 Posted : 13 April 2022 00:16:56(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)
Attach your Smath document.
Offline Jean Giraud  
#4 Posted : 13 April 2022 00:51:35(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)
at(3) Demo.PNG
Offline Mario Acevedo  
#5 Posted : 13 April 2022 01:41:47(UTC)
Mario Acevedo


Rank: Member

Groups: Registered
Joined: 12/04/2022(UTC)
Posts: 11
Man
Mexico
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:

substitution.png

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

Offline Mario Acevedo  
#6 Posted : 13 April 2022 02:20:21(UTC)
Mario Acevedo


Rank: Member

Groups: Registered
Joined: 12/04/2022(UTC)
Posts: 11
Man
Mexico
Location: Guadalajara

Here is the Worksheet:

Worksheet1.sm (11kb) downloaded 8 time(s).
Offline Mario Acevedo  
#7 Posted : 13 April 2022 02:45:20(UTC)
Mario Acevedo


Rank: Member

Groups: Registered
Joined: 12/04/2022(UTC)
Posts: 11
Man
Mexico
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!
Offline Jean Giraud  
#8 Posted : 13 April 2022 03:29:50(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: Mario Acevedo Go to Quoted Post
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.

Command Line UNK.PNG
Offline Mario Acevedo  
#9 Posted : 13 April 2022 05:45:16(UTC)
Mario Acevedo


Rank: Member

Groups: Registered
Joined: 12/04/2022(UTC)
Posts: 11
Man
Mexico
Location: Guadalajara

wow!, this is what I was looking for!!!, THANK YOU very much Jean Giraud!

Offline PompelmoTell  
#10 Posted : 13 April 2022 13:41:58(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 319
Man
Italy
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
Offline MarB  
#11 Posted : 13 April 2022 14:21:09(UTC)
MarB


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.

Screenshot 2022-04-13 131758.png
Offline Jean Giraud  
#12 Posted : 13 April 2022 14:41:51(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: PompelmoTell Go to Quoted Post
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.
Offline overlord  
#13 Posted : 13 April 2022 15:48:44(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,128
Turkey

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).

2022-04-13_15-46.png
Offline Mario Acevedo  
#14 Posted : 13 April 2022 20:10:35(UTC)
Mario Acevedo


Rank: Member

Groups: Registered
Joined: 12/04/2022(UTC)
Posts: 11
Man
Mexico
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 !
Offline MarB  
#15 Posted : 13 April 2022 20:48:08(UTC)
MarB


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).

Screenshot 2022-04-13 194527.png
thanks 1 user thanked MarB for this useful post.
on 13/04/2022(UTC)
Offline Jean Giraud  
#16 Posted : 13 April 2022 22:04:10(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: Mario Acevedo Go to Quoted Post
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).


Offline overlord  
#17 Posted : 13 April 2022 22:47:50(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,128
Turkey

Was thanked: 509 time(s) in 339 post(s)
Originally Posted by: MarB Go to Quoted Post
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

worksheet1.png
Offline Davide Carpi  
#18 Posted : 13 April 2022 23:55:24(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1331 time(s) in 876 post(s)
Originally Posted by: Mario Acevedo Go to Quoted Post
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
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.