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 Konrad Anikiel  
#1 Posted : 23 November 2010 12:41:56(UTC)
Konrad Anikiel


Rank: Member

Groups: Registered
Joined: 26/10/2010(UTC)
Posts: 24
Man
Location: England

Was thanked: 1 time(s) in 1 post(s)
Hello

Could it be possible to make linterp() deal with units? here's an example:


and a Mathcad example:


Cheers
Konrad

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

Offline omorr  
#2 Posted : 23 November 2010 17:33:48(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)
Hello Konrad,

What do you think about this as a workaround:
Open in SMath Cloud
I think this will do the job most of the time.
Just get rid of the units when you do not need them (by dividing the variable with the appropriate unit). Maybe there might be introduced some function like "UnitsOf" in Mathcad to get rid of them when necessary.
My personal opinion is that it is advisable to avoid using units in some more complicated calculations.

Regards,
Radovan

Edited by user 23 November 2010 17:45:34(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Konrad Anikiel  
#3 Posted : 24 November 2010 12:18:35(UTC)
Konrad Anikiel


Rank: Member

Groups: Registered
Joined: 26/10/2010(UTC)
Posts: 24
Man
Location: England

Was thanked: 1 time(s) in 1 post(s)
Yes Radovan, this can be done this way or another. The thing is, in engineering, the document has to be as simple and easy to understand as possible. Formulas have to be as presented in the rules. This is why Mathcad has gained so much popularity (and Smath is going similar way) in engineering: you produce a presentation-quality document right from the scratch. This document goes to many people, non-engineers, non-mathematicians, just various inspectors, authorities, managers, checkers (not associated with the project) etc. It's not about its strength in high maths. It's about clarity of the expression. I could write a C++ program doing my calculations, but I owe you a crate of slivovitsa if it's acceptable to anyone in the chain :-)
Quote:
My personal opinion is that it is advisable to avoid using units in some more complicated calculations

Yes, I know, sometimes it takes a lot of time to make something work with units, but when I do something without units, the frst thing that happens is the document gets rejected with a comment: please demonstrate the right units have been processed troughout the design. Mind you, Mars Climate Orbiter mission failed because of the units screwed up.
Another thing is, I as a design engineer need some degree of trust in my tools- I do make mistakes and it would be nice when my software warns me about it. Furthermore, I make calculation worksheets for the others, I have to be sure there is some foolproofness in what I give to my younger colleagues. It's not a big problem if it's about the length of my shoe laces, but when it comes to nuclear engineering, it makes the difference.

Regards
Konrad
Offline omorr  
#4 Posted : 24 November 2010 14:35:51(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)
Hello Konrad,
Konrad Anikiel wrote:
I could write a C++ program doing my calculations, but I owe you a crate of slivovitsa if it's acceptable to anyone in the chain :-)

I understand your point Good OK
omorr wrote:
My personal opinion is that it is advisable to avoid using units in some more complicated calculations

Konrad Anikiel wrote:
Yes, I know, sometimes it takes a lot of time to make something work with units, but when I do something without units, the frst thing that happens is the document gets rejected with a comment: please demonstrate the right units have been processed troughout the design. Mind you, Mars Climate Orbiter mission failed because of the units screwed up.

Sorry, I did not make myself understood enough. Let me put it this way. I am not against of using units - contrary I am quite in favor of using them - like many SMath users. This is one of the greatest SMath feature. However, from my own experience with Mathcad I think, and was convinced many times, that when you use units - the safest way is to use them when there are simple algebraic operations where you actually "see" the calculation. Using of units in functions, user defined functions etc. which look like a "black box" is much more dangerous. This way there is a greater chance that something might have been "screwed up". Moreover, this way is much harder to "demonstrate the right units have been processed troughout the design" and to convince some other people about it.

Regarding the example with "linterp" I personally prefer the example given in SMath "live" region than the Mathcad solution. I do not know if this is a matter of taste, matter of clarity or something else. You might disagree and I respect that Good

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Konrad Anikiel  
#5 Posted : 24 November 2010 15:26:15(UTC)
Konrad Anikiel


Rank: Member

Groups: Registered
Joined: 26/10/2010(UTC)
Posts: 24
Man
Location: England

Was thanked: 1 time(s) in 1 post(s)
Radovan,
Yes, it is a matter of taste when I do something for myself only, here and now. But let me give you an example. I make a lot of library functions, for general use not only for me. For instance, a function which returns design strength for a given material and temperature, something I tried to do in the first post of this thread. I wrote it in Mathcad so it can handle any temperature units, and it returns stress with units, so you can express it in the units of your choice. You can't fool it. Now imagine the same without units. The user needs to remember that the temperature has to be in deg C and the result in megapascals, not in bars for instance. That's ok, one thing to remember. Now what if there is a hundred of such functions, each of them used dosens of times in various places in the document and there is plenty of such documents which use different input data (from client's spec), which are in different units? I just don't want to have to remember about all this, because I'm sure I will forget one day.
Quote:
I personally prefer the example given in SMath "live" region than the Mathcad solution.
The Mathcad example I gave was just a simplistic, quick check whether it works or not. In my case, I do something like in Smath example I showed in the beginning: a nice table which can be visually checked for errors. And what I like the most in Smath, this table contains reference data with units, which you can't do in Mathcad. It's just one small glitch, linterp() which can't swallow these units :-)

Regards
Konrad

Edited by user 24 November 2010 15:31:37(UTC)  | Reason: Not specified

Offline omorr  
#6 Posted : 24 November 2010 17:29:12(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)
Hello Konrad,

I would like just to mention that almost every intrinsic functions in SMath were made before the units has been implemented. I think that Andrey did his best in order to make the things working after the introduction of units in SMath. As you mentioned "linterp", the three interpolating functions were also introduced before the units implementation.

I hope you would not mind if I just put another example of how to use the functions which are not made to use units. This will not satisfy your wish regarding this subject, but maybe someone will have some benefit from it Good
Open in SMath Cloud

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Konrad Anikiel  
#7 Posted : 24 November 2010 18:06:10(UTC)
Konrad Anikiel


Rank: Member

Groups: Registered
Joined: 26/10/2010(UTC)
Posts: 24
Man
Location: England

Was thanked: 1 time(s) in 1 post(s)
Brilliant! That's a very good idea, define a new function! It fills the hole in my brain for today, thanks Clap
Konrad
Offline omorr  
#8 Posted : 24 November 2010 20:02:07(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)
You are very welcome Good

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
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.