# Any suggestions for implementing parametric unit conversions?

**URL:** <https://discourse.julialang.org/t/any-suggestions-for-implementing-parametric-unit-conversions/124560>\
**Category:** General Usage\
**Tags:** question, unitful\
**Created:** [January 9, 2025, 1:58am UTC](https://discourse.julialang.org/t/any-suggestions-for-implementing-parametric-unit-conversions/124560 "2025-01-09T01:58:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kapple](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kapple/32/218915_2.png) [@kapple](https://discourse.julialang.org/u/kapple)\
**Post date:** [January 9, 2025, 1:58am UTC](https://discourse.julialang.org/t/any-suggestions-for-implementing-parametric-unit-conversions/124560/1 "2025-01-09T01:58:24Z")

</div>

I have the following table of unit conversions for wave attenuation rates.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/3/4337d272ac1dfa3ced969218f1c03ba3669b0ddd.png)

For example,

![image](https://global.discourse-cdn.com/julialang/original/3X/0/2/0250946841ce3a0b2ff2a65894259a4101dd820b.png)

The unitless quantity (units of “1”) is known as the _loss tangent_.

In the spirit of Unitful.jl and/or DynamicQuantities.jl or other unit-handling implementations, what are your guys’ thoughts on how to best implement the above conversion equations?

Some implementation pointers:

- I wasn’t sure how to implement a “new” unit named “wavelength” by symbol `λ`, not being “equal” to anything currently existing (re `Unitful.@unit`).

- The conversion from e.g. dB/λ to Np/m involves the two components of conversion from dB to Np and from /λ to /m. My above “in the spirit of” refers to leveraging the fact that we can implement those two components individually, and hopefully the general implementation gets the conversion from dB/λ to Np/m for “free” by internally automatically knowing to call the two component implementations. (That was poorly worded, sorry.)

- I assume handling the dimensionless attenuation rate (unit “1”) would be tricky.

Am I unable to extend on Unitful.jl and/or DynamicQuantities.jl?
