Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

3 Pages<123>
Options
Go to last post Go to first unread
Offline ecki91  
#21 Posted : 09 March 2016 03:24:38(UTC)
ecki91

Rank: Newbie

Groups: Registered
Joined: 04/03/2016(UTC)
Posts: 3
Germany
Location: Berlin

Hello Andrey!

recently i found out about an issue with the Viewer, might it be possible to fix the update proces while using plugins like the comboboxList?

Please see the example pictures and you see the posibilities of the second list don't change
with the selection made in the first one, wich is non of a problem using
the file with SMath Studio... only with the Viewer it fails.

Thanks a lot for concerning!
I'd appreciate your help very much!







example.zip (429kb) downloaded 37 time(s).
Offline Jean Giraud  
#22 Posted : 09 March 2016 07:28:52(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 983 time(s) in 811 post(s)
Sergio,

Your example that works elements wise, check for other issue:
vectorise as you did ... SQRT(Cool ... result at the bottom of
the attached work sheet in light red.

Jean

Utilities Matrix Vectorise EXPRESS.sm (57kb) downloaded 56 time(s).

... read more as well.
thanks 1 user thanked Jean Giraud for this useful post.
on 09/03/2016(UTC)
Offline omorr  
#23 Posted : 09 March 2016 09:14:21(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)
What do you think Andrey to put then invert() function as well in the exception?

Function transpose() will get into the operator but invert() will not. Therefore, there is quite a difference between rising a matrix to a negative power inside vectorize() and having invert() inside vectorize(). For example, we have abs() and det() but inside vectorize() there is visually no difference.

I also hope this will not open some other issues regarding the vectorize() function.

Regards,
Rdovabn

Edited by user 09 March 2016 09:18:21(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Jean Giraud  
#24 Posted : 09 March 2016 09:35:36(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 983 time(s) in 811 post(s)
Originally Posted by: omorr Go to Quoted Post
I also hope this will not open some other issues regarding the vectorize() function.


Quite right Radovan,

That will require a "task force" checking wrt Mathcad.
The collection of vectorise is huge ! and would be
partial wrt functions not implemented in Smath. In the
mean time, the options in the previously attached
work sheets are VISIBLE. The risk of conflict between
"conventions" and "inventions" is silent/present.
Remember the Smath missing col operator <,> ... +++

Jean

thanks 1 user thanked Jean Giraud for this useful post.
on 09/03/2016(UTC)
Offline frapuano  
#25 Posted : 09 March 2016 10:41:44(UTC)
frapuano


Rank: Advanced Member

Groups: Registered
Joined: 01/08/2010(UTC)
Posts: 115
Man
Italy
Location: Rome

Was thanked: 13 time(s) in 13 post(s)
Jean,
thanks a lot for sharing ...your approach with the algo technique of passing a function ..to a function is very interesting .
It is something I had never thought that was possible to do, it is very elegant and concise.

Thanks again and best regards

Franco
Offline omorr  
#26 Posted : 09 March 2016 10:58:21(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)
Originally Posted by: Jean Giraud Go to Quoted Post
Originally Posted by: omorr Go to Quoted Post
I also hope this will not open some other issues regarding the vectorize() function.


Quite right Radovan,

That will require a "task force" checking wrt Mathcad.
The collection of vectorise is huge ! and would be
partial wrt functions not implemented in Smath. In the
mean time, the options in the previously attached
work sheets are VISIBLE. The risk of conflict between
"conventions" and "inventions" is silent/present.
Remember the Smath missing col operator <,> ... +++

Jean



Thank you Jean,

You are right. Although very useful vectorization() might be sometimes quite a headache if used carelessly.
As you pointed out, that means from the users and developers point of view. I suppose that Andrey therefore avoided using it for such a long time.
It might have been like opening Pandora's box.

Regards,
Radovan

Edited by user 09 March 2016 11:14:32(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline PompelmoTell  
#27 Posted : 09 March 2016 12:20:16(UTC)
PompelmoTell


Rank: Advanced Member

Groups: Registered
Joined: 23/12/2011(UTC)
Posts: 321
Man
Italy
Location: italy

Was thanked: 110 time(s) in 94 post(s)
thanks Andrey,
Your explanation convinced me. And now I think it is not appropriate to satisfy the misuse that I had indicated: only a shortcut.
Reading the posts received later we understand that the introduction of function vectorize() has created a bit of movement And this is very interesting.

sergio
thanks 2 users thanked PompelmoTell for this useful post.
on 09/03/2016(UTC),  on 09/03/2016(UTC)
Offline Alex M.  
#28 Posted : 09 March 2016 18:53:29(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Andrey Ivashov Go to Quoted Post
Hello, Sergio.

Originally Posted by: PompelmoTell Go to Quoted Post

Thank you for pointing it out.

From programmers point of view everything goes correctly here. You tries to transpose every single element of matrix, which is not allowed by the program (as transpose operation can be applied for matrices and vectors only). But on other side I see it will be very handy to have transpose operation in some exceptions list for vectorization.

Will check what I can do...

Best regards, Andrey Ivashov.


First of all - thank you, Andrey, vectorize() can be EXTREMELY useful.

My vote goes for creating no exceptions. Its way easier for end user to understand why vectorize() throws an error (inverse of zero for example), rather than understanding why one "exception" works but not another.

A logically valid workaround is use of eval() inside vectorize - it just makes sense, easy to document and achieves the end goal.

If anything we could use a symbolic alternative of eval() (or does it already exist)?

Cheers All

vectorize1.png

Edited by user 09 March 2016 18:55:14(UTC)  | Reason: Not specified

thanks 1 user thanked Alex M. for this useful post.
on 09/03/2016(UTC)
Offline Davide Carpi  
#29 Posted : 09 March 2016 19:24:44(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,690
Man
Italy
Location: Italy

Was thanked: 1368 time(s) in 895 post(s)
Originally Posted by: Alex.M Go to Quoted Post
My vote goes for creating no exceptions. Its way easier for end user to understand why vectorize() throws an error (inverse of zero for example), rather than understanding why one "exception" works but not another.

A logically valid workaround is use of eval() inside vectorize - it just makes sense, easy to document and achieves the end goal.

If anything we could use a symbolic alternative of eval() (or does it already exist)?


That's an interesting and clean approach Good

Since eval() force evaluation in place, maybe a novectorize() [like noparse in bbcode] may be an alternative to keep the symbolic data Good



P.S. Still no ideas about this error? Unsure

Edited by user 09 March 2016 23:28:24(UTC)  | Reason: link fixed

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Alex M.  
#30 Posted : 10 March 2016 00:06:57(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post


Since eval() force evaluation in place, maybe a novectorize() [like noparse in bbcode] may be an alternative to keep the symbolic data Good




.. It might be easier for an unfamiliar person to find the function if it is similar in name to eval(), say eval.sym(); in this case eval.sym() will evaluate the expression symbolically.

The function can be usefull beyound vectorize() (say in passing input to plugins).
Offline Davide Carpi  
#31 Posted : 10 March 2016 01:52:53(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,690
Man
Italy
Location: Italy

Was thanked: 1368 time(s) in 895 post(s)
maybe simply symb() ... Good

Originally Posted by: Alex.M Go to Quoted Post
The function can be usefull beyound vectorize() (say in passing input to plugins).

I miss the point here, you can pass almost whatever you want to the plugins... Umnik
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Alex M.  
#32 Posted : 10 March 2016 02:46:11(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post

I miss the point here, you can pass almost whatever you want to the plugins... Umnik


It might be me and my lack of programming skills, but unless I use an eval() on the expression passed to my excel_IN function, it will not cancel out all the units before pasting the value into the EXCEL cell. End result - MESS. Instead of cell value 3138.0096 i get 2.82646777304901*10^19/9007199254741*'kg*'m^2/'s^2*1/10^3*'kg*'m/'s^2*'m (which is actually 3138.0096).

I figured our proposed symb() function can be used in similar way to cancel out units, but preserve symbolic notation.

P.S.: I'm sure I could do it somehow inside the plugin code, I just do not know how... And would not want to get off topic here.

Edited by user 10 March 2016 02:49:24(UTC)  | Reason: Not specified

Offline mikekaganski  
#33 Posted : 22 March 2016 06:06:04(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
I'm not sure if this had been asked:
Currently, it's impossible to create a function like

f(M)=sum(M)

because sum takes only matrices, and M here is unknown type.
Using, say, augment(), which return type is known to be a matrix, I can do this:

f(M)=sum(augment(M))

I cannot use vectorize(), because its return type may be scalar like in vectorize(1), or system.
Though I can use it with eval().

The question is, is it possible to make vectorize always return matrix? When argument is a operation on system, for example, the result type differs from input. Having this could allow for such constructs without evals.
Or maybe allow sum to accept any type of input, making it return input itself if it's scalar/system/string?
scr3.png

Edited by user 22 March 2016 06:13:58(UTC)  | Reason: Not specified

Best regards,
Mike Kaganski
Offline mikekaganski  
#34 Posted : 22 March 2016 07:09:26(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
It is unfortunate that eval() prevents vectorize() from evaluating its arguments one-by-one.
For example:

f(x):=(1/x)^2
vectorize(mat(1,2,3,4,2,2))=mat(1,0.25,0.1111,0.0625,2,2)

f(x):eval((1/x)^2)
vectorize(mat(1,2,3,4,2,2))=mat(5.5,-2.5,-3.75,1.75,2,2)

If the expression of vectorize is optimized before by-element evaluation, then it's impossible to use, say, linterp() in such functions, and eval doesn't help.
Best regards,
Mike Kaganski
Offline Jean Giraud  
#35 Posted : 22 March 2016 14:55:01(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 983 time(s) in 811 post(s)
Vectorise is specific to Mathcad, then new to Smath.
A risky new bugger that does not speak, won't match
Mathcad either ... and almost impossible to exhaust.
We can expect more and more of that in the Forum.

Jean

Forum Vectorise Risky Stuff.gif
Offline Jean Giraud  
#36 Posted : 22 March 2016 15:43:51(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 983 time(s) in 811 post(s)
Originally Posted by: mikekaganski Go to Quoted Post
It is unfortunate that eval() prevents vectorize() from evaluating its arguments one-by-one.
For example:

f(x):=(1/x)^2
vectorize(mat(1,2,3,4,2,2))=mat(1,0.25,0.1111,0.0625,2,2)

f(x):eval((1/x)^2)
vectorize(mat(1,2,3,4,2,2))=mat(5.5,-2.5,-3.75,1.75,2,2)

If the expression of vectorize is optimized before by-element evaluation, then it's impossible to use, say, linterp() in such functions, and eval doesn't help.



... and you have it wrong both ways. Solution is: return Smath to the last working
version [5346], litle simples step of more maths and more conviviality... issue patch.
linterp what ? you just have the Y vector !

Jean

Forum Vectorise Risky Stuff_1.gif


Offline mikekaganski  
#37 Posted : 22 March 2016 16:42:58(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
Location: Khabarovsk, Russia

Was thanked: 151 time(s) in 107 post(s)
Thank you Jean for attention.

Though when I read things like that:

Originally Posted by: Jean Giraud Go to Quoted Post
... and you have it wrong both ways. Solution is: return Smath to the last working
version [5346], litle simples step of more maths and more conviviality... issue patch.
linterp what ? you just have the Y vector !


I start to think that you want to be rude.
I have it wrong both ways? What do you mean by that? Have you read that carefully? First way I get absolutely correct matrix of original numbers raised to power (-2). How is that incorrect? Or do you think that you know my requirements better?

Your method works, and fine. I have mine, working too. But what I write about isn't call for help "Hey! I'm lost in two trees! How do I calculate them?", but a proposal to enable more powerful use of new shiny feature.

"linterp what ? you just have the Y vector !" - I wrote that if some of my function internally uses linterp for some reason, it currently automatically isn't fit for use inside vectorise.

I'm trying to replace a number of loops in my files that are used to fill matrices, with a cleaner syntax of vectorise. And I meet with some limitation that MAY be curable if Andrey decides that it's possible (and that's not too difficult taking into account his code).

Specifically, I attach a file that I tried to cleanup today. One of loops is marked by magenta. It's impossible to rephrase it like is shown to the right of it on margin (highlighted by red), though both Q and t are vectors that I want to be used one-by-one, to get resulting vector of formula results. The problem is that the functions that are used in my top-most function use *interp() on some other matrices, and that makes this syntax illegal. I dream of a proposed here "novectorize" or suchlike...

Regulirujushchijj klapan.sm (233kb) downloaded 45 time(s).
Best regards,
Mike Kaganski
Offline Jean Giraud  
#38 Posted : 22 March 2016 22:07:26(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 983 time(s) in 811 post(s)
Originally Posted by: mikekaganski Go to Quoted Post
I'm trying to replace a number of loops in my files that are used to fill matrices, with a cleaner syntax of vectorise. And I meet with some limitation that MAY be curable if Andrey decides that it's possible (and that's not too difficult taking into account his code).

Specifically, I attach a file that I tried to cleanup today. One of loops is marked by magenta. It's impossible to rephrase it like is shown to the right of it on margin (highlighted by red), though both Q and t are vectors that I want to be used one-by-one, to get resulting vector of formula results. The problem is that the functions that are used in my top-most function use *interp() on some other matrices, and that makes this syntax illegal. I dream of a proposed here "novectorize" or suchlike...


In the attached, your clean creation of dual vector is suggested. You could probably work a long route by creating the model of T, P data set. By inspection it looks simple polynomial fit. Seeing
ΔP make me think your are trying to compute some MassFlow in association with m^3. You may not have
the appropriate formulation ... which is in construction in my design board, maybe a day or two.
On the other hand ΔP.доЦТП:vectorize(Δp(Q,D,L,Δ.э,t)) is not a function definition.
If I'm correct assuming you try to compute MassFlow, better start working unitless to ease reading.


Regulirujushchijj klapan Notes.sm (293kb) downloaded 44 time(s).

Offline Davide Carpi  
#39 Posted : 23 March 2016 01:44:54(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,690
Man
Italy
Location: Italy

Was thanked: 1368 time(s) in 895 post(s)
About foo1 and foo2 you can avoid the evaluation on assignment using a programming function (line()); no ways to use vectorize on linterp Sad

foo.sm (21kb) downloaded 52 time(s).

Any further improvement on vectorize is welcome from my side Good

Edited by user 23 March 2016 01:47:59(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 23/03/2016(UTC)
Offline ElSid  
#40 Posted : 30 March 2016 18:13:03(UTC)
ElSid


Rank: Advanced Member

Groups: Registered
Joined: 05/03/2009(UTC)
Posts: 433
Man
United States
Location: USA

Was thanked: 17 time(s) in 15 post(s)
The problem is that "vectorize" is not passed through with the function definition
Vectorize.PNG
You will notice that the vectorization "arrow" is missing in the definition of f
Users browsing this topic
3 Pages<123>
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.