# Unitful.jl and DifferentialEquations.jl: compatibility?

**URL:** <https://discourse.julialang.org/t/unitful-jl-and-differentialequations-jl-compatibility/68594>\
**Category:** New to Julia\
**Tags:** unitful, differentialequation\
**Created:** [September 22, 2021, 4:56pm UTC](https://discourse.julialang.org/t/unitful-jl-and-differentialequations-jl-compatibility/68594 "2021-09-22T16:56:23Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 25, 2021, 6:10pm UTC](https://discourse.julialang.org/t/unitful-jl-and-differentialequations-jl-compatibility/68594/12 "2021-09-25T18:10:06Z")

</div>

> [@bilderbuchi](#):
>
> Why does this fall down here, are a number of operation implementations missing in unitful or some such?

> <https://github.com/PainterQubits/Unitful.jl/issues/46#issuecomment-265611553>
>
> Some linear algebra operations like \`\\\` have a hard time with unitful numbers. T…ake the following case:
> 
> \`\`\`julia
> a = \[1.0u"N" 2.0u"N"
> 3.0u"N" 1.0u"N"\]
> b = \[1.0u"N";3.0u"N"\]
> \`\`\`
> 
> If you try \`\\\` it gives a dimension error. If you try \`\*\` then it uses the generic \`\*\` fallback and not BLAS. The same is true if you use:
> 
> \`\`\`julia
> A = rand(100,100)u"N"
> b = rand(100)u"N"
> \`\`\`
> 
> I suggest trying something like, performing a dimensional analysis, strip the units, use the general \`\*\` or \`\\\`, and then re-apply units. 
> 
> To do this properly, you might need a \`UnitfulArray\` instead of an array of Unitful values. I am not sure if stripping the units on an array of Unitful numbers can be done without making a temporary.

The code shown in the comment assumes that the number and its inverse have the same type, assumption which fails when the unit dimension is encoded in the type domain, which is what `Unitful.jl` does. Another approach would be to have a type which doesn’t embed the unit and unit dimension in the type as parameters, which is what Chris would prefer.

---

_[View the full topic](https://discourse.julialang.org/t/unitful-jl-and-differentialequations-jl-compatibility/68594)._
