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 Razonar  
#1 Posted : 02 February 2018 09:38:26(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi.

An uneval ability, like 'x' and x::uneval in maple, or Mathematica's Hold .

Thanks for this wonderful tool that is SMath.

Best regards.

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

Offline alyles  
#2 Posted : 02 February 2018 16:53:23(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 274
United States

Was thanked: 91 time(s) in 57 post(s)
SMath doesn't have a discrete uneval function of which I am aware. However, you can replicate that functionality depending on when you define the variables. Look at my example below. uneval.sm (4kb) downloaded 40 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Razonar  
#3 Posted : 02 February 2018 19:00:04(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. Thanks for the tip. But isn't enough for somethings more or less basics tasks, like call NDiff with 2 args, and not 3. Also, there are something else wrong about diff and how it handle some cases.

Best regards.

Alvaro.

hold.gif

uneval.sm (9kb) downloaded 25 time(s).
Offline Jean Giraud  
#4 Posted : 02 February 2018 20:34:20(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: alyles Go to Quoted Post
SMath doesn't have a discrete uneval function of which I am aware


Isn't what Clear(,) does ?

I Have an application example somewhere in Fourier compendium.
To imitate Mathcad/Maple: make the variables wild.

Clear.PNG
Offline Jean Giraud  
#5 Posted : 02 February 2018 20:52:16(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Maths Symbolic Export wrt Parameters.sm (9kb) downloaded 26 time(s).
Offline alyles  
#6 Posted : 02 February 2018 21:08:46(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 274
United States

Was thanked: 91 time(s) in 57 post(s)
Quote:
Isn't what Clear(,) does ?


Clear is more permament. The uneval function allows you re-enable without redefining the variable.
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline alyles  
#7 Posted : 02 February 2018 21:47:34(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 274
United States

Was thanked: 91 time(s) in 57 post(s)
Originally Posted by: Razonar Go to Quoted Post
Hi. Thanks for the tip. But isn't enough for somethings more or less basics tasks, like call NDiff with 2 args, and not 3. Also, there are something else wrong about diff and how it handle some cases.

Best regards.

Alvaro.




The problem with your two argument function is that you're using hold() and value() functions in function call and those functions aren't defined anywhere.

The method still works with your defined functions IFF you define a and b when you would normally call eval()

You could also use the method Jean suggests, by calling
Code:
clear(a,b)
. Only you would then have to redefine a and b when you want to evaluate.

uneval (3).sm (11kb) downloaded 25 time(s).

Edited by user 02 February 2018 21:49:22(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Jean Giraud  
#8 Posted : 02 February 2018 22:31:50(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: alyles Go to Quoted Post
Clear is more permament. The uneval function allows you re-enable without redefining the variable.


Just disable Clear(,) to reuse same parameters.
More generally if you "Clear" you want to redefine anyway, isn't ?

Offline Razonar  
#9 Posted : 02 February 2018 22:57:26(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: alyles Go to Quoted Post

The problem with your two argument function is that you're using hold() and value() functions in function call and those functions aren't defined anywhere.
uneval (3).sm (11kb) downloaded 25 time(s).


Sure, I'm requesting them.

Originally Posted by: alyles Go to Quoted Post

You could also use the method Jean suggests, by calling ...


Jean's method is close, but not enough (actually it's equivalent to x='x' in the image). Can you replicate this Maple's code in SMath?

MyDiff.gif

Best regards.

Alvaro.
Offline mkraska  
#10 Posted : 02 February 2018 23:23:24(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1120 time(s) in 718 post(s)
Originally Posted by: Razonar Go to Quoted Post
Hi. Thanks for the tip. But isn't enough for somethings more or less basics tasks, like call NDiff with 2 args, and not 3.


Isn't this pretty much what you want? Magics of the line operator.

2018-02-02 21_16_04-SMath Studio - [uneval(1).sm_].png
uneval_Kr.sm (9kb) downloaded 35 time(s).

I forgot this one:

2018-02-02 21_30_21-SMath Studio - [uneval_Kr.sm_].png

Edited by user 02 February 2018 23:31:37(UTC)  | Reason: Not specified

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 02/02/2018(UTC)
Offline alyles  
#11 Posted : 02 February 2018 23:57:16(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 274
United States

Was thanked: 91 time(s) in 57 post(s)
Martin,

Are the lines even necessary? What are they doing in your example? I see no difference in not using lines.

Untitled.png
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline mkraska  
#12 Posted : 03 February 2018 00:03:17(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1120 time(s) in 718 post(s)
Originally Posted by: alyles Go to Quoted Post
Thanks Martin!

I learned something new today. Looking forward to trying some more of these tricks with line operators in my own applications.


I wish I could explain this.

The debugger doesn't seem to reveal the secret:

2018-02-02 21_54_32-SMath Studio - [uneval_Kr.sm_].png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 2 users thanked mkraska for this useful post.
on 03/02/2018(UTC),  on 03/02/2018(UTC)
Offline Razonar  
#13 Posted : 03 February 2018 03:10:15(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
I'm impressed! Excelent! Thanks, don't know what actues as hold but there are something there ... Now, my point is look if it can be done for external libraries, like coolprop or airy functions. And redefine diff for those cases where it fails.

Best regards.

Alvaro.

MyDiff.gif

Edited by user 03 February 2018 03:11:52(UTC)  | Reason: Not specified

Offline Razonar  
#14 Posted : 03 February 2018 04:07:02(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Oops. Integers vs rationals.

MyDiff.gif
Offline Jean Giraud  
#15 Posted : 03 February 2018 06:08:01(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: mkraska Go to Quoted Post
I wish I could explain this.


The line is a local definition operator.
Observe the red example: coefficients 'a' exist/defined/assigned
thus satisfy the Σ . On the other example |Σ 'c' result from calculations.
The summing operator must "steal" the 'c' via the isolating local line operator.
Differently but of same nature, DeBoor is redefined locally on the RHS.
More examples have been encountered [there was Legendre polynomials...]

Local.PNG
Offline Razonar  
#16 Posted : 04 February 2018 13:08:19(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi. The proposed method looks excellent, but only works for integers.
So, it's a bug or what else?

Best regards.

Alvaro

Clipboard02.jpg
Offline mkraska  
#17 Posted : 04 February 2018 14:47:22(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1120 time(s) in 718 post(s)
Originally Posted by: Razonar Go to Quoted Post
Hi. The proposed method looks excellent, but only works for integers.
So, it's a bug or what else?

Best regards.

Alvaro



The at() function used for applying the perturbation makes a search and replace without limiting the search expression to valid variable names. It can't, however, handle expressions as replacement targets.

The line function isn't at stake here.

2018-02-04 12_37_48-SMath Studio - [Page4_].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 06/02/2018(UTC)
Offline Jean Giraud  
#18 Posted : 04 February 2018 16:18:55(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: mkraska Go to Quoted Post
I learned something new today. Looking forward to trying some more of these tricks with line operators in my own applications.

More generally, the line operator is the program operator.
It may be as short as one element. Attached are three typical
applications. DeBoor is just demo, here [attached separately].

Maths Local Definition.sm (29kb) downloaded 34 time(s).
Spline De Boor [Colibri].sm (34kb) downloaded 32 time(s).

Offline Jean Giraud  
#19 Posted : 05 February 2018 09:05:18(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Maybe I don't understand what you are attempting,
if so => here is simple procedure that needs no
Uneval/re-eavl ... it just works on demand ,
wherever demanded in the work sheet.

Maths Uneval.sm (8kb) downloaded 28 time(s).

Uneval.PNG
Users browsing this topic
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.