cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Leading Zero Frustration

Old-MCAD-User
10-Marble

Leading Zero Frustration

OldMCADUser_0-1734126242895.png

MathCAD Prime 7.0 is where my company is still stuck at, but it still has the very frustrating limitation/bug of not accepting decimal numbers without putting a leading zero before the decimal. It allows you to do this when calculating a number, but not when using units. Has this been fixed in subsequent versions? 

 

It is frustrating not only from the standpoint that I never put leading zeros before a decimal, and never have, never do on any other program/software, and it's not a problem at any other time on any other software package I use (including MathCAD Prime 7.0) UNTIL I try to use units in the calculation. I have hundreds of worksheets where I have not used leading zeros and it used to calculate everything just fine, even with the use of units.

6 REPLIES 6
LucMeekes
23-Emerald III
(To:Old-MCAD-User)

Maybe type an * (explicit multiplication) between the 2 and the i...

 

Success!

Luc

I can confirm that this behaviour has not changed in Prime 10.

 

As a workaround you may type an explicit multiplication (*) between the number and the unit as suggested by Luc or (for consistency) an implicit one which you get by pressing ctrl-shift-U.

Werner_E_0-1734146843735.png

BTW, Prime calls this implicit multiplication the "scaling operator".

 

StuartBruff
23-Emerald III
(To:Werner_E)


@Werner_E wrote:

BTW, Prime calls this implicit multiplication the "scaling operator".


 

I've occasionally wondered why PTC called it the "scaling operator" or, to be more precise, why they gave it the functionality they did.   

 

AFAICT, the "S-expression" associated with each maths region doesn't so much affect the nature of the calculation but rather the chosen display form.   Certainly, the scaling operator scales scalars, but its prime(!) purpose seems to be to tell Mathcad not to draw a multiplication operator between terms that Mathcad is actually multiplying.

 

2024 12 14 A.png

 

The Hadamard (element-by-element or vectorized) product would, IMO, have been a more mnemonic operation on arrays.

 

Stuart

The reason you can't type ".2in" is because the dot is a valid leading character in an identifier name.

 

2024 12 14 E.png

 

When the number begins with 0, Mathcad Prime recognises a non-numerical character as the number string terminator (unless that character is an i or a j, in which case Mathcad interprets the number as imaginary). 

 

Stuart

 

From the Mathcad Prime 10 Help:

 

Variable and Function Names
 
Variable names, function names, unit names, constant names, etc, are generically referred to as identifiers.
 
Identifiers can contain any valid Unicode character from the Base Multilingual Plane (BMP) with the exception of white space and control characters, and with the additional limitation that the first character cannot be a decimal digit (0-9). Unicode BMP characters are defined as having a code in the range 0-65535.
 
The label associated with an identifier is considered part of its name when distinguishing it from another identifier. This makes it possible to define a new function mean with the Variable label, and still be able to refer to the built-in function mean by specifying the Function label. However, if you define a new function mean with the Function label, you will be hiding the built-in definition of that function.
Identifiers are case-sensitive, can be of any length, and may contain any combination of valid characters:
 
Letters—Uppercase and lowercase letters.
Digits—0 through 9, but not as the first character of a name. PTC Mathcad interprets leading digits in combination with letters as either an imaginary number (2i or 3j) or as a number times a variable (3x).
Dot—A single, punctuation character, period can be used any where; including as the first character.
StuartBruff
23-Emerald III
(To:StuartBruff)

A little more digging shows that the ISO 80000-1:2022 states:

 

If the magnitude (absolute value) of the numbers is less than 1, the decimal sign shall be preceded by a zero." 

Earlier versions, including the British Standard 31, have similar wording, although the “shall” is replaced by “should” in some cases.

 

So, Mathcad’s behaviour in this respect would appear to be formally neither a limitation nor a bug but rather correct, irrespective of common practice.


Stuart

Werner_E
25-Diamond I
(To:StuartBruff)


So, Mathcad’s behaviour in this respect would appear to be formally neither a limitation nor a bug but rather correct, irrespective of common practice.

I fully agree.

Accepting numbers starting with a decimal point is just a courtesy, as this habit seems to be common in some parts of the world, but it is certainly not a requirement.
The fact that you now have to insert the scaling operator manually in such cases is, in my opinion, a small price to pay for this concession.
I do not think it would be justified to restrict the possibility of using variable names with a leading dot followed by digits and others.

 

Where I live, we use the comma and not the period as a decimal separator, and omitting the zero before the comma is not usual (at least not nowadays). With a calculation like 50*,2, and especially with 50*.2, many people would probably get the result 100 because they would think the small decimal separator was either a typo or the legacy of a fly on the paper (or the monitor). With handwritten calculations, some would perhaps even get 600 because they would think the comma was a failed digit one.
So for me it is perfectly understandable and also reasonable that the standards support the writing of the leading zero in these cases with some emphasis.

But of course I understand that when you are used to use a certain short, you have the wish that the software you use should support it as well. 

Announcements

Top Tags