Skip to main content
1-Visitor
February 5, 2016
Solved

How to create inverse units [e.g. /dBm(x)] in Mathcad Prime?

  • February 5, 2016
  • 14 replies
  • 8498 views

I'd like to implement some form of decibels in Mathcad. I've found a few nice references:

Mathcad Example Using Decibels | Math Encounters Blog

https://books.google.com/books?id=DfVVkGnzIJAC&printsec=frontcover#v=onepage&q=inverse%20function&f=false

In both of these examples they are creating a forward function dB(x), which works just fine, but also an "inverse function" /dB(x). No matter how I try I cannot get Mathcad Prime to create something that looks like that inverse function. (The CTRL+SHIFT+K approach recommended in the second link doesn't work in Prime.) The closest I've gotten is when I got the Mathcad error message "Unknown error: no_inverse_declared."

Is there any way to create an "inverse function" in Prime?

Best answer by RichardJ

Here's a Mathcad 15 worksheet that shows how to use dB. I've posted this before (more than once, I think; see here for the original post in a discussion, or argument, about dB: Solved: Re: Working with dB (decibels) - PTC Community). I converted it to Prime, and it doesn't work; it just throws the error you have already seen. So I think you are out of luck. Yet another deficiency in Prime.

14 replies

24-Ruby IV
February 6, 2016

One general remark.

We have use dB, pH etc. only in manual calculation. We does not need dB, pH etc. in computer calculation.

And partially 2 pictures from the book Thermal Engineering studies with Excel, Mathcad and Internet

Fig-2-10.png

Fig-2-11.png

pwanis1-VisitorAuthor
1-Visitor
February 8, 2016

Yes I agree that dB shouldn't be needed for automated calculation, since dB is a shortcut created for easier (human) calculation. But in RF and sonar all of the standard formulas are centered around dB, dBm, dB re 1uPa, etc so it would be nice to be able to use those units within Mathcad.

RichardJ19-TanzaniteAnswer
19-Tanzanite
February 6, 2016

Here's a Mathcad 15 worksheet that shows how to use dB. I've posted this before (more than once, I think; see here for the original post in a discussion, or argument, about dB: Solved: Re: Working with dB (decibels) - PTC Community). I converted it to Prime, and it doesn't work; it just throws the error you have already seen. So I think you are out of luck. Yet another deficiency in Prime.

JeffH1
16-Pearl
February 8, 2016

The Prime shortcut for special characters is different than Mathcad 15.0 (Ctrl-Shift-K).  First, type a double quote (which in 15 gave you text, but not in prime).

     ""

In between the double quotes, type /dB

     "/dB"

Now delete either of the quote marks and follow this variable with a parenthesis to make it a function

     /dB( x )

Press : and define the function.

In Mathcad 15, you could make this a postfix operator, but these aren't implemented in Prime yet.

pwanis1-VisitorAuthor
1-Visitor
February 8, 2016

The good news: this trick (using quotes) worked, and I could enter the formula exactly as you said.

The bad news: mathcad still doesn't appear to be treating this as an inverse function; even when I do declare /dB(x) I still get the error no_inverse_declared. Unfortunately I think Richard Jackson hit the nail on the head.

23-Emerald V
May 17, 2020

Has this problem been fixed yet?  I can find no reference in Help to how to implement an inverse (unit) function.   

 

To move away from discussion about the merits or otherwise of displaying dimensionless units, I have another example - conversion of numbers between bases.  I can write a 'unit' function that displays a number as, say, a binary, octal or hex number (well, string, actually).  What I'd like to do is use the same name to go from a string to a decimal number (a genuine number, this time).

 

2020 05 16 B.png

 

Cheers,

 

Stuart

23-Emerald IV
May 24, 2020

@StuartBruff:

Stuart,

just out of curiosity, I was wondering what your bin/oct/hex conversion functions look like.

 

Luc

 

23-Emerald V
May 28, 2020

@LucMeekes wrote:

@StuartBruff:

Stuart,

just out of curiosity, I was wondering what your bin/oct/hex conversion functions look like.

 

Luc


Nothing special, Luc.

 

Some general-purpose string functions:

 

2020 05 28 C.png

 

Integer to Base conversion functions (number to string😞

2020 05 28 B.png

Base to Integer conversion functions (string to number😞

2020 05 28 A.png

 

I've got another version that works better with str2num ... I'll throw some documentation around it and, hopefully, post it later on today.   It's a bit "ragged" though, as it's in development, and uses some vector and string functions that are stepping stones to a more general, Mathcad-oriented, array handling capability.

 

Cheers,

 

Stuart

23-Emerald I
May 17, 2020

You can do this (see Prime 4 Express example).  It's tedious, but if you really need it:

FredKohlhepp_0-1589719857160.png

 

23-Emerald V
May 17, 2020
Thanks, Fred. I plan to check it out tomorrow.

Cheers,

Stuart
23-Emerald V
May 22, 2020

Sorry for the delay in replying, Fred ... I got sidetracked.

 

I'm afraid that your suggestion doesn't do what I want, which is to define an inverse function that can be used in a unit placeholder.  I get that pesky 'inverse function' error.

 

I can't access my M15 files (only got Express), but ISTR that even in m15 I had to "cheat" and hack a units XML(?) file to get such f-invf pairs to work properly.   

 

Does anybody know if PTC has any plans to allow users to define their own unit function pairs?

 

Cheers,

 

Stuart