The Octave miscellaneous package has embedded GNU units as a function which should be helpful.
It looks interesting, but more focused on conversions than actual operations it seems:
octave:37> a.value = 100
a =
scalar structure containing the fields:
value = 100
unit = W
octave:38> a.unit = 'W'
a =
scalar structure containing the fields:
value = 100
unit = W
octave:39> b.value = 3
b =
scalar structure containing the fields:
value = 3
unit = s
octave:40> b.unit = 's'
b =
scalar structure containing the fields:
value = 3
unit = s
octave:41> a*b
error: binary operator '*' not implemented for 'scalar struct' by 'scalar struct' operations
I think I've found a solution. Matlab has implemented symunits
in the symbolic toolbox and I've found the original? on Github. Hopefully it is compatible to GNU Octave.
This looks very VERY promising! I'll try to install it tomorrow and Post here the results! Thanks?
I downloaded it and tried to run it, but it gets stuck in a loop and I don't know how it could be fixed:
error: max_recursion_depth exceeded
error: called from
baseUnitSystem
<unknown>
it seems the problem is in the line
coreUnits = buildCoreUnits(u.baseUnitSystem);
in the file u.m
, I think because u.baseUnitSystem
tries to "call itself". I don't know what this should be supposed to do, and have no idea on how to possibly fix it :(
It seems that the implementation of classdev
in Octave is unfortunately not complete enough yet.๐
I don't think symbolic will solve your problem at all
With symbolic variables J, s
and W
, the Ws
won't be converted to J
automatically.
automatically no, but perhaps there's a way to replace it. If there's a way to check if a variable is "divisible by another symbolic one" then it would be not so hard to implement this behavior
Open Source
All about open source! Feel free to ask questions, and share news, and interesting stuff!
Useful Links
- Open Source Initiative
- Free Software Foundation
- Electronic Frontier Foundation
- Software Freedom Conservancy
- It's FOSS
- Android FOSS Apps Megathread
Rules
- Posts must be relevant to the open source ideology
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
- !libre_culture@lemmy.ml
- !libre_software@lemmy.ml
- !libre_hardware@lemmy.ml
- !linux@lemmy.ml
- !technology@lemmy.ml
Community icon from opensource.org, but we are not affiliated with them.