Uneval

Uneval - Messages

#1 Posted: 2/2/2018 3:38:26 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

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.
#2 Posted: 2/2/2018 10:53:23 AM
Arie

Arie

93 likes in 285 posts.

Group: User

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 (3 KiB) downloaded 62 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#3 Posted: 2/2/2018 1:00:04 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

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 (8 KiB) downloaded 44 time(s).
#4 Posted: 2/2/2018 2:34:20 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

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
#5 Posted: 2/2/2018 2:52:16 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Maths Symbolic Export wrt Parameters.sm (8 KiB) downloaded 46 time(s).
#6 Posted: 2/2/2018 3:08:46 PM
Arie

Arie

93 likes in 285 posts.

Group: User

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
#7 Posted: 2/2/2018 3:47:34 PM
Arie

Arie

93 likes in 285 posts.

Group: User

Wrote

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
clear(a,b)
. Only you would then have to redefine a and b when you want to evaluate.

uneval (3).sm (10 KiB) downloaded 43 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#8 Posted: 2/2/2018 4:31:50 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

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 ?

#9 Posted: 2/2/2018 4:57:26 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote


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 (10 KiB) downloaded 43 time(s).



Sure, I'm requesting them.

Wrote


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.
#10 Posted: 2/2/2018 5:23:24 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

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 (8 KiB) downloaded 53 time(s).

I forgot this one:

2018-02-02 21_30_21-SMath Studio - [uneval_Kr.sm_].png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Arie 2/2/2018 5:27:00 PM
#11 Posted: 2/2/2018 5:57:16 PM
Arie

Arie

93 likes in 285 posts.

Group: User

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
#12 Posted: 2/2/2018 6:03:17 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

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://en.smath.info/wiki/SMath%20with%20Plugins.ashx
2 users liked this post
frapuano 2/2/2018 6:23:00 PM, Alvaro Diaz Falconi 2/2/2018 9:07:00 PM
#13 Posted: 2/2/2018 9:10:15 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

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
#14 Posted: 2/2/2018 10:07:02 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Oops. Integers vs rationals.

MyDiff.gif
#15 Posted: 2/3/2018 12:08:01 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

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
#16 Posted: 2/4/2018 7:08:19 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Hi. The proposed method looks excellent, but only works for integers.
So, it's a bug or what else?

Best regards.

Alvaro

Clipboard02.jpg
#17 Posted: 2/4/2018 8:47:22 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

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://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Alvaro Diaz Falconi 2/5/2018 6:35:00 PM
#18 Posted: 2/4/2018 10:18:55 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

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 (28 KiB) downloaded 52 time(s).
Spline De Boor [Colibri].sm (33 KiB) downloaded 51 time(s).

#19 Posted: 2/5/2018 3:05:18 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

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 (7 KiB) downloaded 45 time(s).

Uneval.PNG
  • New Posts New Posts
  • No New Posts No New Posts