Uneval

Uneval - Mensajes

#1 Publicado: 2/2/2018 3:38:26
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: 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 Publicado: 2/2/2018 10:53:23
Arie

Arie

94 me gusta en 285 mensajes.

Grupo: 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,31 KiB) descargado 1679 vez(es).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#3 Publicado: 2/2/2018 13:00:04
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: 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,16 KiB) descargado 1662 vez(es).
#4 Publicado: 2/2/2018 14:34:20
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: 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 Publicado: 2/2/2018 14:52:16
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: User

Maths Symbolic Export wrt Parameters.sm (8,81 KiB) descargado 1650 vez(es).
#6 Publicado: 2/2/2018 15:08:46
Arie

Arie

94 me gusta en 285 mensajes.

Grupo: User

Citar

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 Publicado: 2/2/2018 15:47:34
Arie

Arie

94 me gusta en 285 mensajes.

Grupo: 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,68 KiB) descargado 1619 vez(es).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#8 Publicado: 2/2/2018 16:31:50
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: 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 Publicado: 2/2/2018 16:57:26
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: 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,68 KiB) descargado 1619 vez(es).



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 Publicado: 2/2/2018 17:23:24
Martin Kraska

Martin Kraska

1.361 me gusta en 2.275 mensajes.

Grupo: 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,6 KiB) descargado 1603 vez(es).

I forgot this one:

2018-02-02 21_30_21-SMath Studio - [uneval_Kr.sm_].png
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
A 1 usuarios les gustó este mensaje
Arie 2/2/2018 17:27:00
#11 Publicado: 2/2/2018 17:57:16
Arie

Arie

94 me gusta en 285 mensajes.

Grupo: 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 Publicado: 2/2/2018 18:03:17
Martin Kraska

Martin Kraska

1.361 me gusta en 2.275 mensajes.

Grupo: 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
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
A 2 usuarios les gustó este mensaje
frapuano 2/2/2018 18:23:00, Alvaro 2/2/2018 21:07:00
#13 Publicado: 2/2/2018 21:10:15
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: 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 Publicado: 2/2/2018 22:07:02
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: User

Oops. Integers vs rationals.

MyDiff.gif
#15 Publicado: 3/2/2018 0:08:01
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: 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 Publicado: 4/2/2018 7:08:19
Alvaro

Alvaro

1.139 me gusta en 1.805 mensajes.

Grupo: 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 Publicado: 4/2/2018 8:47:22
Martin Kraska

Martin Kraska

1.361 me gusta en 2.275 mensajes.

Grupo: 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
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
A 1 usuarios les gustó este mensaje
Alvaro 5/2/2018 18:35:00
#18 Publicado: 4/2/2018 10:18:55
Jean Giraud

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: 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,24 KiB) descargado 1646 vez(es).
Spline De Boor [Colibri].sm (33,42 KiB) descargado 1458 vez(es).

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

Jean Giraud

983 me gusta en 6.866 mensajes.

Grupo: 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,66 KiB) descargado 1612 vez(es).

Uneval.PNG
  • Nuevos mensajes
  • Sin mensajes nuevos