Units implementation

Units implementation - Сообщения

#1 Опубликовано: 25.02.2010 09:37:37
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Hello.

Good news for people, who have requested implementation of Units to the SMath Studio. Here is screenshot of what I have for today:


P.S.:
#2 Опубликовано: 25.02.2010 12:05:32
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello Andrey,

As we know, Units are very often mentioned on this forum. This is rather appreciated from all of us
BTW, you mentioned that units will be in Italic to distinguish them from the variables. How would that be implemented? What do you think to put them in a different color as well, by default? Just curious.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Опубликовано: 25.02.2010 13:12:35
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Wrote

How would that be implemented?


Good question My logic was simple: SMath Studio is math-oriented program, so

  1. Math symbols (digits, constants/variables, functions, operators, brackets) should have an ability to be inserted just by pressing the keyboard buttons. As is.
  2. Text strings should be different entries type. To insert text user should specify the type first... using " (quotation marks) symbol. It is rather predictable.
  3. Unit entry is not math symbol and is not a text, so user should also specify a type. I propose to use ' (apostrophe) symbol as a solution of this problem.

So, when user presses an apostrophe, programs placeholder will change its form to filled black oval (standard form is filled black rectangle) and SMath Studio will show Dynamic Assistance list with defined units. User should write own unit or choose one from the shown list. It is simple enough. I know, that Mathcad users knows ' symbol as a shortcut to insert brackets, but... my goal is not to remake the Mathcad, really

Wrote

What do you think to put them in a different color as well, by default?


The second good question. In truth, I don't know. And what do you think? Actually italic font is a temporary thing. The final implementation still can be different. So, I really need in the comments from users.

Questions to all:
  1. Is it OK, that units will be presented italic?
  2. Is it OK, that units will be shown blue (f.e.) colored?
  3. Is there any standard for using units in, maybe, books?
#4 Опубликовано: 25.02.2010 13:42:27
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Wrote

1. Is it OK, that units will be presented italic?


It is Ok with me, as long as the units and superscripts does not overlap and might look ugly.
Wrote

2. Is it OK, that units will be shown blue (f.e.) colored?


It is also Ok with me. I hope that the default color might be changed. If not, the blue color will be fine.
Wrote

3. Is there any standard for using units in, maybe, books?


I do not know, but most of the publishers want units in italic but I can not say it is a standard.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#5 Опубликовано: 25.02.2010 13:55:00
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Thank you.

I've found this link: http://physics.nist.gov/cuu/Units/checklist.html.
#6 Опубликовано: 25.02.2010 14:21:41
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Wrote

Thank you.

I've found this link: http://physics.nist.gov/cuu/Units/checklist.html.


It seems I was wrong. As I understood, the NIST described that variables should bi Italic and variables in Roman type. To be honest, we all know how LaTeX prepared Math texts look like. As I've been using Mathcad for such a long time, Italic variables look very ugly in Mathcad, therefore I never use Italic in Mathcad. The SMath Courier like fonts are much nicer. Moreover, Italic in SMath look very good.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#7 Опубликовано: 26.02.2010 07:11:51
jakobg

jakobg

0 сообщений из 21 понравились пользователям.

Группа: User

Units are a very nice feature indeed, Andrey!

Following the last discussion, I would agree that units should be distinguishable (colored !), especially during the writing and working phase.
But maybe for printing a more restrained look (just italic, but black) would be useful.
Maybe, my very first post, regarding a Latex export capability may become interesting when publishing features grow attention.

Jakob
#8 Опубликовано: 27.02.2010 15:11:09
tsgrue

tsgrue

0 сообщений из 3 понравились пользователям.

Группа: User

Awesome, excellent, fantastic!

Thanks very much!!!




#9 Опубликовано: 27.02.2010 15:48:51
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Just few notes.

SMath Studio will support Units inside matrix/vector/array even if items will be presented with different units.


Even if user will not know about how to insert Units (using ampersand symbol on start), Dynamic Assistance will show all available units as well as variables and functions in drop-down list.


Regards.
#10 Опубликовано: 27.02.2010 16:44:01
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello Andrey,

Could you please let us know how the things are going on regarding to units conversion. How would that be implemented (say, displaying the value in "cm" not in "m" )?
Just curious.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#11 Опубликовано: 27.02.2010 18:17:08
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Sure.

For now, I cannot find the way more convenient then MathSoft done. My plan was to make first release of Units without an ability for user to operate with result (results will be always presented with base units)... it depends on my time availability. Hope you'll understand it.

Regards.
#12 Опубликовано: 27.02.2010 19:16:08
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

I understand Andrey, of course . You are right, Mathcad has quite good unit conversion features. As far sa I am concerned, it would be quite enough if you could implement the ability to, say, devide the variables with the appropriate units and to obtain the numerical value:

a:=1m

b:=a/cm

b=100

If not, never mind - some other time .

Reards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#13 Опубликовано: 27.02.2010 23:47:45
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Yeah, it will work.

#14 Опубликовано: 28.02.2010 11:06:22
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Thanks Andrey

It is very good. Also, I am convinced that everyone will agree that units in different color is much more acceptable.

I think that we can assume that there would be no problem to have unit variables as function arguments. Moreover, I hope that plotting with them will also be possible. On the basis of your screenshots I suppose that we could manage that, couldn't we?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#15 Опубликовано: 28.02.2010 14:14:08
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator



Do you mean this? By the way, I don't know why, but Mathcad can plot the second graph...
#16 Опубликовано: 28.02.2010 16:13:23
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Yes, this is strange. It seems that this is due to Mathcad feature to mix units and numbers in symbolic calculation, when you use g(1.2kg)-> simbolicaly you will get the result with units in it (numericaly will be wrong). Afterwards, when you want to plot the function, Mathcad converts all the units in base units and, after that, gives them unity value (one) and you can plot this. BTW, working with units in Mathcad can be sometimes confusing because of this and proone to errors. One must be careful about it and I made many mistakes considering this.

For instance:
f(x):=x^2*m+10 will convert into f(x)->x^2*1+10
g(x):=x^2*cm+10 will convert into g(x)->x^2*0.01+10

This might be questinable because you can plot x versus y even in this way (with the expression with units which do not match - expresion with inconsistent units)??? Therefore I asked about divison by the desired unit because of the x,y axis on plots or other variables. This way you can have the numerical (dimensionless) values in the desired units on plots.

Regards,
Radovan

PS. From my experience with Mathcad, working with units is quite safe when this includes basic algebraic operators. If using some special functions (numerical...), plotting etc. which include units, extracare is needed. The safest way is to work without units first, and put them afterwards.
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#17 Опубликовано: 02.03.2010 22:15:24
Edwin

Edwin

0 сообщений из 12 понравились пользователям.

Группа: User

Terrific job on the units so far! I'm looking forward to using it. The only thing that seems to be missing is the extra input field for the output value (which isn't actually a unit field in mathcad, it can contain anything. Apparently mathcad just does a symbolic division and outputs that before the field. Very effective though).

As for the graphs. Seems logical that the second one wouldn't work. The fact that is does is probably a testament to the horrible way mathcad seems to handle units in graphs. All you want it to do is input your range in the proper units and have it output the axis values in the units of your choice. But that never worked and it always had weird side effects. (Disclaimer: I never used any mathcad beyond version 9 (=2000) )

My answers to your questions:
1. Italic is fine. Maybe not the way it should be, but it's good to be able to recognise the difference.
2. Blue looks nice for input purposes because it makes units stand out really well. But for printing I would prefer black.
3. You seem to have found the formal layout rules yourself. They may not be practical though because doing math symbols in Times/Italic will probably require larger font sizes to keep them easily readable. It would of course be nice for printing or work on a high resolution desktop. Maybe a style implementation would be nice somewhere down the line.

#18 Опубликовано: 03.03.2010 00:38:08
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Edwin, hello! Do you talk about this:



P.S.: omorr, I did it!
#19 Опубликовано: 03.03.2010 07:11:54
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Andrey,

All my credits to you
You did a great job. I hope it would not be to shameless from me to mention just one more thing. What about the temperature relative scales (Celsius, Fahrenheit)?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#20 Опубликовано: 03.03.2010 15:16:12
maweilian

maweilian

5 сообщений из 103 понравились пользователям.

Группа: User

Andrey, the unit implementation looks great! I can't wait to try out the beta version. Congratulations on your good work.
Will Massie Mechanical Engineer Oregon, USA
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений