Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


2 Pages12>
Options
Go to last post Go to first unread
Offline avanturist  
#1 Posted : 03 May 2017 15:25:52(UTC)
avanturist

Rank: Newbie

Groups: Registered
Joined: 24/04/2017(UTC)
Posts: 9

Was thanked: 2 time(s) in 2 post(s)
Simple question: how to assign a symbol to the result of symbolical evaluation? Sorry have not found the answer.

E.g. I have some function f(x).
I want to assign another function g(x) to the result of symbolical evaluation of df(x)/dx.

If I assign g(x) to df(x)/dx and make symbolical evaluation, I get correct result, but g(x) is still assigned to df(x)/dx.

Of course, I can symbolically evaluate df(x)/dx and copy the result to the definition of g(x), but then g(x) will not change if the function f(x) changes.

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

Offline Jean Giraud  
#2 Posted : 03 May 2017 17:04:44(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)
Hello Adventurist !

Welcome to the Smath Community. I don't understand completely
your "assign question". Mybe the answer is in there ?

Jean

ODE_Laplace Read First.sm (38kb) downloaded 42 time(s).

ODE_Laplace 1rst [Type 1].sm (26kb) downloaded 26 time(s).

ODE_Laplace 2nd [Type 3].sm (24kb) downloaded 26 time(s).

ODE_Laplace 1rst [Type 2].sm (25kb) downloaded 23 time(s).
Offline avanturist  
#3 Posted : 03 May 2017 18:41:23(UTC)
avanturist

Rank: Newbie

Groups: Registered
Joined: 24/04/2017(UTC)
Posts: 9

Was thanked: 2 time(s) in 2 post(s)
testassign.sm (15kb) downloaded 25 time(s).

Sorry, have not found the answer. Attached is a sample with two functions f(x,y) and g(x,y).

testassign.png

In the sample I have just copied the result of symbolical evaluation of f(x,y) to g(x,y). How to perform this assignment directly? I need g(x,y) to be updated if input vectors change.

Easy to see that symbolical evaluation does not change f(x,y). Maple can undestand g(x,y) but not f(x,y).
Offline Jean Giraud  
#4 Posted : 03 May 2017 19:30:19(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)
... just assign like this g(x,y):=f(x,y)
shown in red Smath 6179 attached.
Does it work for you ?

Jean

testassign.sm (17kb) downloaded 24 time(s).
Offline uni  
#5 Posted : 03 May 2017 20:35:35(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
maple() function doesn't understand smath cross product symbol. It is not supported in the current version.
Russia ☭ forever
Viacheslav N. Mezentsev
Offline avanturist  
#6 Posted : 03 May 2017 22:14:56(UTC)
avanturist

Rank: Newbie

Groups: Registered
Joined: 24/04/2017(UTC)
Posts: 9

Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
... just assign like this g(x,y):=f(x,y)
shown in red Smath 6179 attached.
Does it work for you ?

Jean

Hello Jean,

no, it does not work. It assigns original f(x,y) to g(x,y) and not symbolically evaluated, see blue fields in attachment.

testassign1.sm (19kb) downloaded 25 time(s).

@Viacheslav
Hello Viacheslav, yes it is clear, that not everything can be translated to Maple, but this is also not necessary. The question is, how to use existing symbolic evaluation result.

This is necessary not only for Maple. If intermidiate evaluations are not used, with each new definition ALL previously entered definitions must be again and again evaluated.

Edited by user 03 May 2017 22:33:41(UTC)  | Reason: Not specified

Offline mkraska  
#7 Posted : 03 May 2017 22:57:46(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
This works.

testassign_Kr.sm (18kb) downloaded 19 time(s).
2017-05-03 21_54_47-SMath Studio - [testassign_Kr.sm].png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 05/05/2017(UTC)
Offline Jean Giraud  
#8 Posted : 04 May 2017 04:26:26(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: avanturist Go to Quoted Post
no, it does not work. It assigns original f(x,y) to g(x,y) and not symbolically evaluated, see blue fields in attachment


The blue is just maple()simplify(...)

The definition of "cross product" goes with the definition
of the coordinates system. There are 24 systems of coordinates.
Typically, Mathcad 11 and earlier is different than Mathematica 4.0.
I don't understand much about "cross product in Smath" whereas
Smath does not have a 3D system except for the horrible 3d QuickPlot.

Jean
Offline uni  
#9 Posted : 04 May 2017 07:34:25(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Something like this?

2017-05-04_09-26-58.png

2017-05-04_09-31-35.png
Russia ☭ forever
Viacheslav N. Mezentsev
Offline avanturist  
#10 Posted : 04 May 2017 17:08:56(UTC)
avanturist

Rank: Newbie

Groups: Registered
Joined: 24/04/2017(UTC)
Posts: 9

Was thanked: 2 time(s) in 2 post(s)
Thanks to Martin and Viacheslav for working solutions!

As I understood, there is no regular way in SMath to access already existing result of symbolic evaluation. The solutions are tricks to export the result to string/file and to import it back.

What looks irritating for me, some functions take symbol definition as input, e.g. maple() functions, other functions, like num2str() and wfile(), take the result of symbolic evaluation as input!? Is this the special property of maple() or num2str(), wfile() functions only? If not, how to determine what will given function take as input?

To my point of view, there should be a regular way to access either symbol definition or symbolic evaluation. There is a regular function eval() to get the result of numerical evaluation, why not to implement function like symbeval() to get symbolic evaluation result? Then it will be enough to write

g(x,y):=symbeval(f(x,y))
Offline Jean Giraud  
#11 Posted : 04 May 2017 18:28:45(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: avanturist Go to Quoted Post
As I understood, there is no regular way in SMath to access already existing result of symbolic evaluation. The solutions are tricks to export the result to string/file and to import it back.


There is no trick spool to file the immediate maple,
no more trick spool back wherever you want.

Jean

Maple series.sm (24kb) downloaded 22 time(s).



Offline Jean Giraud  
#12 Posted : 04 May 2017 18:46:21(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)
... apparently, there is no limits wrt maple.
Added numerical algo "include"

Jean

Genfit Algo Include.sm (14kb) downloaded 22 time(s).

Genfit Algo Include Test.sm (17kb) downloaded 22 time(s).

Maple series.sm (33kb) downloaded 20 time(s).
Offline Jean Giraud  
#13 Posted : 04 May 2017 20:34:02(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)
... as far as I understand: you request for TWO cross-product.
In fact, there are more that you can collect/spool to file.

testassign_Kr.sm (12kb) downloaded 21 time(s).
Offline avanturist  
#14 Posted : 04 May 2017 21:57:02(UTC)
avanturist

Rank: Newbie

Groups: Registered
Joined: 24/04/2017(UTC)
Posts: 9

Was thanked: 2 time(s) in 2 post(s)
Jean,

thank you for a lot of examples, but this is not about maple and not about cross-products. Also it is absolutely clear how to export/import strings or files. This is a general question for any symbolical system: how to distinguish between the symbol definition and its symbolical evaluation.

For some reason maple() and for sure some other functions take symbol definition as input. Other functions, like str2num() or wfile() use already symbolically evaluated expression (or may be they evaluate it internally?). There is no function or operator, which will say: here I want my original f(x,y) with cross products (by the way, how to write it to the file?) and here I want already symbollicaly evaluated and simplified result.

My suggestion was to implement some operator or function, like symbeval(), which returns the same as right arrow operator (Ctrl-.). Then the user can specify what exactly is passed to the function, definition, etc. Should I duplicate this to feature requests?
thanks 1 user thanked avanturist for this useful post.
on 04/05/2017(UTC)
Offline omorr  
#15 Posted : 04 May 2017 23:08:17(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello,

Originally Posted by: avanturist Go to Quoted Post
My suggestion was to implement some operator or function, like symbeval(), which returns the same as right arrow operator (Ctrl-.). Then the user can specify what exactly is passed to the function, definition, etc. Should I duplicate this to feature requests?


I agree with you and I think that this question might be a future request for Andrey. I remember that eval() was introduced long time ago due to the well known symbolic-numeric problems. In the meantime there were symbolic engine plugins introduced (maple and Maxima) and I think that your suggestion about symbeval() is worth considering as well. To be honest, I do not know why this problem appeared after such a long time.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Jean Giraud  
#16 Posted : 05 May 2017 00:50:34(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: omorr Go to Quoted Post
My suggestion was to implement some operator or function, like symbeval(), which returns the same as right arrow operator (Ctrl-.). Then the user can specify what exactly is passed to the function, definition, etc. Should I duplicate this to feature requests?


No need to put in "feature request", because it is already implemented.

1. Laplace Ode posted does exactly that
2. Symbolic can be spooled to file.

Smath is not a "scalar system". That is takes ln(x) and plot QuickPlot
is not scalar but vector. A more complex formula would execute faster
from eval(,) because it sets the algorithm from formula into the executable
suite from eval(,) which in fact is from the symbolic internal expansion.

"scalar" was just explained few days ago [What is scalar]. Most if not all
Smath functions are borrowed from various codes, thus not uniformized
unlike Mathcad/Mathsoft. A scalar algorithm runs by itself on its internal
x, y ... scalar iterator(s), so will not run on Smath that has only vector
input(s) for the variables. Revisit the "Fourier Quantum 2C" just posted.
Mathcad runs the integral product, no way Smath can/could. Once the system
of integral is solved, it can take Smath vector inputs.

Whether a "scalar interpreter" is desirable ? NOT SURE. It would return
Smath to the design board and beta testing for a long times because to
few users. By same token, might scrap lot more from the existing 6179
that works so fine. The result you show, is to me, strictly a bug by
coincidence, if you want to assign the result of cross products you
must isolate in vector as I have done. If afterwards you want to
recombine, you must do it again ... symbolic[1 x symbolic[2

Since the very birthday of Mathcad/Mathsoft, some inconvenience remained
over the years of > 125000 Collabs + unreported visitors. Some attachment
[Mathcad work sheets] got read 2000 times in two days.
Some functions could not be chained, some had to be recopied ...

On the other hand, Smath is far more educative than Mathcad, why ?
In Smath you can't do what you can't explicit. Probably the best
educative tool you could wish, in the sense of doing so much advanced
maths Sciences/Engineering.

Cheers, Jean


Offline avanturist  
#17 Posted : 05 May 2017 22:43:01(UTC)
avanturist

Rank: Newbie

Groups: Registered
Joined: 24/04/2017(UTC)
Posts: 9

Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
No need to put in "feature request", because it is already implemented.

Yes, of course symbolic evaluation is implemented, but how to assign the result to the symbol?

Originally Posted by: Jean Giraud Go to Quoted Post
1. Laplace Ode posted does exactly that

Sorry, can you show the place, where symbolically evaluated result is assigned. I have not found it...


Offline Jean Giraud  
#18 Posted : 06 May 2017 04:57:23(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)
Start with a simple example, note this:
as you type int(1/(1+x^2),x) it shows
the symbol of the indefinite integral.

Jean

Symbolic assign.sm (4kb) downloaded 26 time(s).
Offline omorr  
#19 Posted : 06 May 2017 10:20:38(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello,

I might be wrong here, but I think the question is about something like this regarding maple.
If you can not reproduce this, there might be something wrong with my SMath.

maple1.PNG

Regadrs,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#20 Posted : 06 May 2017 12:32:36(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
This is bug in maple() function. Not all operations are performed correctly during the conversion.
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 06/05/2017(UTC),  on 06/05/2017(UTC)
Users browsing this topic
Guest
2 Pages12>
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.