SMath Studio Forum
»
SMath Studio
»
Questions
»
Evaluate expression for a variable(s) set to a number
Rank: Advanced Member Groups: Registered
Joined: 03/03/2014(UTC) Posts: 418 Was thanked: 125 time(s) in 96 post(s)
|
Hi All,
So I am using Smath Studio for personal projects (I am converting from Mathematica that I no longer have access to).
Here is a very simple task i need to do and yet after 30 minutes of search I still do not know how to achieve it:
Say I have g=h+j-k+100
How do I evaluate g for h = 1, j=2, k=3?
I have found that if g=j+2, setting g(j)=g will do the trick for one variable only: g(1)=3, while g=j+2.
In mathematica it would be as simple as g/.{h->1,j->2,k->3}
This would come in very useful if you would want to evaluate function that has more than one variable.
Many thanks!
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 03/03/2014(UTC) Posts: 418 Was thanked: 125 time(s) in 96 post(s)
|
Thank you ioan92! That is really what I needed.
Also what would be the best tutorial you can recommend on SMATH? Either English or Russian.
Thanks!
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,980 Was thanked: 1120 time(s) in 718 post(s)
|
The FunctionsExtensions plugin provides the at() substitution function with special operator formatting. This exploits the symbolic storage of the expression in the variable g. File Attachment(s): at.sm (9kb) downloaded 22 time(s). mkraska attached the following image(s): |
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 03/03/2014(UTC) Posts: 418 Was thanked: 125 time(s) in 96 post(s)
|
That looks very interesting as well, will experiment. Thanks! Edited by user 11 April 2014 01:00:46(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 03/03/2014(UTC) Posts: 418 Was thanked: 125 time(s) in 96 post(s)
|
Hi everyone!, Not sure if this would be a bug but at() function does not seem to work while evaluating fuctions that include Min() or Max(). See workbook and photo attached. Thanks! File Attachment(s): sm1.sm (10kb) downloaded 21 time(s). Alex M. attached the following image(s):
|
2 users thanked Alex M. for this useful post.
|
on 18/04/2014(UTC), on 19/04/2014(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,980 Was thanked: 1120 time(s) in 718 post(s)
|
Confirmed. This is bug of Min() and Max(). Apparently they always try to return a numeric result, regardles of what the optimization setting is. If they would return themselves with evaluated/preprocessed arguments, at() would work, as the example with max() shows. mkraska attached the following image(s): |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,639 Location: Italy Was thanked: 1323 time(s) in 873 post(s)
|
Thanks, added in BTS: SS-114. Best regards, Davide |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
1 user thanked Davide Carpi for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,639 Location: Italy Was thanked: 1323 time(s) in 873 post(s)
|
DoneDavide Carpi attached the following image(s): |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
Evaluate expression for a variable(s) set to a number
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.