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 omorr  
#1 Posted : 23 May 2013 11:38:40(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)
I just wanted to get into attention this thread once more. There were problems of rather different results using different optimization and different solvers. Those problems still remained unexplained.

Just look at the picture and try the attached file. Changing the symbolic/numeric/none optimization and using/not using eval() for the yellow regions, there will be different results. This time, we will get different results - sometimes scalars, sometimes vectors.

Regards,
Radovan

Edited by user 23 May 2013 11:46:21(UTC)  | Reason: Not specified

File Attachment(s):
Primer63w_again.sm (37kb) downloaded 30 time(s).
omorr attached the following image(s):
Primer63w_again.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 2 users thanked omorr for this useful post.
on 23/05/2013(UTC),  on 24/05/2013(UTC)

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

Offline mkraska  
#2 Posted : 24 May 2013 17:10:04(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)
Here is an minimal example showing the problem mentioned above.
mkraska attached the following image(s):
sym-num-diff.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 24/05/2013(UTC),  on 24/05/2013(UTC)
Offline omorr  
#3 Posted : 24 May 2013 17:51:08(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)
Or this one

EDIT: This is not good by all means. Something has to be done about it.

Edited by user 24 May 2013 18:00:33(UTC)  | Reason: Not specified

omorr attached the following image(s):
symbnum1.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 24/05/2013(UTC)
Offline mkraska  
#4 Posted : 24 May 2013 20:44:23(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)
The whole disussion just illustrates the survival rules

"Never trust symbolic evaluation"
"Never use symbolic optimization in function definitions"

Sometimes eval() or line() may save the day.
File Attachment(s):
Symb-Num-diff.sm (25kb) downloaded 24 time(s).
mkraska attached the following image(s):
symbug.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 24/05/2013(UTC),  on 24/05/2013(UTC)
Offline mkraska  
#5 Posted : 25 May 2013 00:26:23(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)
Originally Posted by: omorr Go to Quoted Post
This is not good by all means. Something has to be done about it.


The reason for the problem is the type-unawareness of the symbolic optimization, as was already discussed in the Transpose function bug topic.

Thus, what can be done? When SMath does symbolic optimizations, certain assumptions are made (just like operators being scalar). Strictly taken, you would need to add a type checking instruction to any definition that is optimized under such assumptions. Alternatively you could block invalid optimizations by providing type information. Function arguments that are to assume matrix values would require to be marked as such. Otherwise matrix arguments are to be refused by the function.

I'd propose to use the ~ character including the boldface markup for matrix valued variables.

The drawback for me would be that the ~ character is inaccessible in SMath with german keyboard layout (acts as hotkey for boolean =)

Boldface marking matrices and vectors is quite common in engineering textbooks, thus this would be easy to comprehend for most users.

Currently, the ~ character is used for absolute variables. I never used this concept and have never seen any example from other users. If I remember correctly, Andrey announced this feature as essential for animations to work. However, this does not seem to require any user access to such variables. Thus I think that dedicating the math region capability to show boldface symbols to matrix and vector variables would be welcomed by most users.

Look at the attached image: Wouldn't that be nice? Boldfacing the function name would indicate that matrix values are expected to be returned. The boldface 1 would preferrable be interpreted as unit matrix of appropriate size. Alternatively, this could mean a matrix of all ones just like boldface zero would be a zero matrix. Unit matrix could be a boldface I.

Edited by user 25 May 2013 00:31:13(UTC)  | Reason: Not specified

mkraska attached the following image(s):
matrix2.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 25/05/2013(UTC)
Offline omorr  
#6 Posted : 25 May 2013 01:05:15(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)
I agree with you Martin,

The same thoughts and ideas regarding boldface notation crossed my mind as well.

These frustrating problems were mentioned many times (symbolic-numeric-eval()), and I believe you would all agree that this might be the most annoying behavior of SMath. As we could see, Andrey tried to fix those things, but I have the filling that we are in some kind of "looping". It seems that a radical approach must be applied here. I do not know which one exactly, otherwise our frustrations will continue.

Regards,
Radovan

EDIT: I do not know if the breaking of operator overloading will help here (for instance, different multiplications for scalars and vectors) and might be the idea worth considering

Edited by user 25 May 2013 01:16:43(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 25/05/2013(UTC)
Offline mkraska  
#7 Posted : 25 May 2013 01:39:30(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)
Originally Posted by: omorr Go to Quoted Post

EDIT: I do not know if the breaking of operator overloading will help here (for instance, different multiplications for scalars and vectors) and might be the idea worth considering

That is how it is done in maple. It would be important to provide operator forms for the special functions.
The operators could be equipped with different (e.g. significantly larger) placeholders. If you type variables into them, then they are automatically boldfaced.



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 25/05/2013(UTC)
Offline NeoAndrew  
#8 Posted : 12 June 2013 22:40:06(UTC)
NeoAndrew

Rank: Newbie

Groups: Registered
Joined: 12/06/2013(UTC)
Posts: 2
Man
Poland
Location: Here and There

I guess it would be (somewhat) easy to fix vector / scalar problems by allowing users to strictly define variable types.
If you were to choose variable types, you would be sure you always get the right format and potentially eliminate improper values.

I am currently having a pretty annoying problem with Smath putting scalar (not defined, but intended to be scalar) variables in fromt of vectors. That leads to errors upon some vector operations and leaves me to writing exact values manually (pretty annoying with tons of calculations and constant lack of time).

Is there already a method, which can be used to avoid Smath putting variables in front of vectors (or matrices) and doing it 'the right way'?
10 home
20 sweet
30 goto 10
Offline kilele  
#9 Posted : 12 June 2013 23:22:47(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 393

Was thanked: 132 time(s) in 113 post(s)
would it possible to use macron for vectors ? Custom special characters in SMath for vectors, just adding a bar (overline) over a letter.
You would type onto the canvas: vecg and automagically it'd be converted to ḡ
or converted to some calligraphical font.

Edit :

It would be faster, typing three times 'v' like vvvg to obtain ḡ
or just a toggle key working like CapsLock.

Edited by user 17 June 2013 15:16:01(UTC)  | Reason: Not specified

Offline NeoAndrew  
#10 Posted : 13 June 2013 17:19:15(UTC)
NeoAndrew

Rank: Newbie

Groups: Registered
Joined: 12/06/2013(UTC)
Posts: 2
Man
Poland
Location: Here and There

That is quite a good idea as long as you also include vector lengths, as you do not always work on 3 dimensions. Very often it is 2, or 4 dimensions, so you would have to have something like vector3 g or vector4 a to make a variable set to 3- or 4-dimensional vector values.

Example:
input text:
vector3 g
output:
ḡ as a 3-dim vector

Now multiplying ḡ by m (which is not marked as vector, by which we automatically treat is as a scalar value variable) would put m inside ḡ vector brackets.
That would bring us to another problem, which is matrix definition.

It would be easier to leave users choice, whether, or not they wish to define the variables.
This way any undefinde variable types would be treated the standard way and all other, that users fancy to define (vectors, matrices, scalars) would be treated according to their type and (probably just in case of vectors) marked appropriately.

Problem - what if a user wanted to show vector length, which is of course a scalar value?
Solution - allow users to ommit the definitions by writing scalar g to (just in the particular occurence) display ḡ without vector sign and treat it as a scalar value.
Alternative - treat scalar g and vector g as separate variables.

These are just some loose ideas, but perhaps they're worth considering.
10 home
20 sweet
30 goto 10
Offline kilele  
#11 Posted : 13 June 2013 18:30:31(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 393

Was thanked: 132 time(s) in 113 post(s)
As you said I didn't put much thought and left my suggestions as loose ideas.
I rather had in mind this three "vvv" for any matrix like a fast to type shortcut unlikely to be a user defined function.
vvvg plus enter would become ḡ and this variable would be recognized by SMath as a matrix with undefined dimensions, the program would warn you about dimensions when needed and there'd be a dimensions indication in the dynamic assistance. Later on you would define ḡ as usual with ctr+m
I don't know if this makes sense, surely other fellows can give far better suggestions, maybe RisingEagle or even Andrey Biggrin

Edit:

Again i'd prefer a toggle buton/key to enter matrix notation.
Who knows if it'd be easier for the current symbolic engine to detect which are the proper operations for the expression that the user is entering. SMath could map the vectorial operators required in that very same moment.
All in all my proposal would be: press key toggle and type one or more letters; press again the toggle and you'd get a matrix variable (I don't know if it'd be possible to put an overline ); hopefully SMath may have fewer problems to detect the correct operators if vectors are declared while the user enters the expression.

Edited by user 17 June 2013 15:16:55(UTC)  | Reason: Not specified

Offline Rising Eagle  
#12 Posted : 14 June 2013 03:39:12(UTC)
Rising Eagle


Rank: Member

Groups: Registered
Joined: 14/12/2012(UTC)
Posts: 23
Location: Neverland

Was thanked: 15 time(s) in 9 post(s)
Originally Posted by: kilele Go to Quoted Post
...surely other fellows can give far better suggestions, maybe RisingEagle or even Andrey


Wow, Kilele, to put me in the same phrase as Andrey is waaay beyond what I deserve. I'm not even in the same solar system as he is. Be that as it may, how can I refuse such a flattering invitation. And thank you.

I must admit I haven't given this issue a lot of thought, but one thing I have been considering on a conceptual level that might work is that vectors and physical units are both attributes we assign to scalars. Andrey has built a wonderful software infrastructure for tracking and calculating physical units, vis, filling in the oval to specify one's personal choice in physical units and applying automatic unit conversions. Can this same machinery be used to specify vector, matrix, or other complexity with additional symbols? So if I want to override meters per second with millimeters per second and set it up as a 5 dimensional vector I would fill in the oval as v5;mm/s. A matrix might be m3x2;mm/s. For scalar arrays that contain mixed dimension such as spacetime 4-D vectors (3 space, one time), a more complex encoding would be required, but shouldn't be that difficult to design.

Instead of one oval, perhaps Andrey could set up a second oval of a different color for specifying any scalar array type specification separately from any physical unit: scalar/vector/matrix/tensor/complex-number. As for fonts, bolding, color, decorator markings, etc., used to represent the different scalar array types, that is rather an arbitrary choice as long as everybody likes it. Beyond that, Andrey would need the software to track allowable operations between any two scalar arrays, each of arbitrary type. Such rules might be user cusomizable as well. For example, some vector spaces have inner products and metrics, others do not. The user should be able to disallow such operations between two vectors from a vector space that does not. If I have other ideas, I'll submit again.

I am greatly impressed by the continuing hard work and cleverness of the smath community including, but definitely not limited to, Radovan, Uni, Martin, Kilele, Web Surfer, Ber7, and of course Andrey. I commend you all. Those of you I have failed to mention, it is not your shortcoming, but my own poor memory.

Edited by user 14 June 2013 09:01:47(UTC)  | Reason: Not specified

thanks 1 user thanked Rising Eagle for this useful post.
on 14/06/2013(UTC)
Offline Rising Eagle  
#13 Posted : 14 June 2013 21:47:59(UTC)
Rising Eagle


Rank: Member

Groups: Registered
Joined: 14/12/2012(UTC)
Posts: 23
Location: Neverland

Was thanked: 15 time(s) in 9 post(s)
I have some follow-up thoughts.

There has been an issue discussed that smath can have misleading presentation where the internal encoding of formulas defined by the user may not match the user's intended meaning of the formula and the user may very well be unaware of the mismatch. This arises, for example, when one defines a formula under the numerical flag when one meant to define it under the symbolic flag. While the rules that smath follows are consistent (except, of course for bugs), the user interface is not friendly enough to keep the user fully cognizant of the internal encodings of a formula that smath may assign to a user's formula definition. The dynamic assistance helps, but doesn't go far enough. Ideally, the user interface should invoke intuitive impressions in the user's mind that are perfectly aligned with smath's internal encodings and representations. The following thoughts are intended to address this issue, though it certainly is not a full correction of the problem by any means. It will be clear how these thoughts relate to the scalar/vector discussion in this thread.

(1) using a tabbed presentation of worksheets would allow smath to provide its own non-worksheet tabs to provide users with extra information. The information I have in mind and would like to see is a tab containing a formatted presentation of the variables and formulas declared with their type properties (e.g., real, integer, vector, mxn matrix, etc.), their symbolic vs numerical flag in force at the time of declaration, and any other properties that might be relevant. This display is similar to a textbook showing the notation used throughout the book. The formatting would be logically collated in a way that makes sense, e.g., having all reals collected together, having all vectors collected together, etc. Or it could be better formatted in chronological order - user's choice. This declarations tab would be an information display that shows how smath encodes all formulas or variables, e.g., f = x + a would be shown as f = x + 2 if a is set equal to 2 before the declaration (whatever is shown in dynamic assistance is what would be seen). Any reuse or overloading of a variable or function would be seen clearly (sometimes one inadvertently reassigned a variable name, forgets that one has already used it, or is not fully cognizant of the smath environmental conditions surrounding the declaration).

(2) a more direct display of such things would be to have a mode invoked by the press of a button that shows the worksheet where all declarations are followed on the right by a grey highlighted region showing an equals sign and the smath encoding, e.g., f = x + a <grey area> = x + 2 <end grey area>.

(3) a left pane margin area that shows a warning when declarations in the worksheet to the right are making use of a previously defined variable name, are overriding an smath default, or are denied the override (as in the case with i).

Edited by user 15 June 2013 16:13:21(UTC)  | Reason: Not specified

Offline kilele  
#14 Posted : 15 June 2013 04:43:44(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 393

Was thanked: 132 time(s) in 113 post(s)
@Rising Eagle
I knew that you would come up with some good ideas like these ones Good
Clear function implemented by w3b5urf3r
Suggestion to better discern array indices
Offline kilele  
#15 Posted : 17 June 2013 14:29:43(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 393

Was thanked: 132 time(s) in 113 post(s)
A few more suggestions about user interfaces:

- There could be more views like the output from the view menu, a sort of a few inspectors of the worksheet properties (variables, operators, highlighting of elements according to code colors, search..), it could be something look a simplified version of the addon for Firefox "Firebug".

- I've just seen a gui control that may be of inspiration, the minimap from the text editor "Sublime Text". This kind of view could be useful for large worksheets, bookmarking, search.. see it in action in this video.

- About boldfacing for matrices, it'd be a really good looking notation. The problem is just that SMath could not use this formatting style for text in general, that's why I suggested a couple of alternatives.

Edited by user 17 June 2013 16:47:30(UTC)  | Reason: Not specified

Offline mkraska  
#16 Posted : 17 June 2013 19:32:40(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)
Originally Posted by: kilele Go to Quoted Post
- About boldfacing for matrices, it'd be a really good looking notation. The problem is just that SMath could not use this formatting style for text in general.


I do not understand how "formatting style for text in general" is related to math markup. We can take it as given, that math regions can handle boldface markup (as demonstrated here).

Mixing styles in text regions would be fine. Sometimes proper patchworking different regions does the trick but in multilingual sheets that is an nightmare. But that is a different feature request.



Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline kilele  
#17 Posted : 17 June 2013 20:21:18(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 393

Was thanked: 132 time(s) in 113 post(s)
Precisely I wonder how you got to apply the boldface style, I guess by adding some tag to the xml file.

Wouldn't be sort of a mess to mix boldface both in text and math regions ? I mean if SMath were to follow this matrix notation, shouldn't boldface be restricted to this sole purpose ?
Offline mkraska  
#18 Posted : 17 June 2013 22:38:44(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)
Originally Posted by: kilele Go to Quoted Post
Precisely I wonder how you got to apply the boldface style, I guess by adding some tag to the xml file.

Messing with xml files - would I ever do that ;-)

No, I just used the markup for absolute variables, just put a tilde ~ in front of the character. That works with numbers as well. Thus SMath could translate ~1 into a unit matrix of appropriate size. I attach my wish list prototype, see the region named "Type declaration and boldface markup for vectors"

As to mixing type faces: In math regions this should follow strict rules as close as possible to natural math notation.

In text regions, it would be beneficial, e.g. for citing math expressions (as long there are no inline math regions for texts) or for emphasizing individual words. These functions shall become more important when the internal help system gains speed.

In general, I am not a fan of visual (manually edited) markup in texts, my pdf handbook is written in LaTeX, which is mainly a structure based typesetting system.
File Attachment(s):
Wish List.sm (47kb) downloaded 32 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Users browsing this topic
Guest
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.