-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1104 from ven-k/vkb/metadata-in-diff2term
feat: accept additional metadata in `diff2term`
- Loading branch information
Showing
4 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Symbolics: diff2term | ||
using ModelingToolkit | ||
using ModelingToolkit: equivalent, get_unit, value, VariableUnit | ||
using Unitful: @u_str | ||
using Test | ||
|
||
@variables t [unit = u"s"] k(t) | ||
D = Differential(t) | ||
|
||
@test equivalent( | ||
u"1/s", | ||
get_unit( | ||
diff2term( | ||
value(D(k)), | ||
Dict(VariableUnit => get_unit(D(k))) | ||
) | ||
) | ||
) | ||
|
||
@test equivalent( | ||
u"1/s^2", | ||
get_unit( | ||
diff2term( | ||
value(D(D(k))), | ||
Dict(VariableUnit => get_unit(D(D(k)))) | ||
) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters