Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-integer unit exponents? #48

Open
MichaelClerx opened this issue Apr 25, 2019 · 6 comments
Open

Non-integer unit exponents? #48

MichaelClerx opened this issue Apr 25, 2019 · 6 comments

Comments

@MichaelClerx
Copy link
Contributor

Are we allowing this:

x = 5 m
y = sqrt(x)

?

and what about this:

a = 5 m
b = a ^ 2.345

?

@MichaelClerx
Copy link
Contributor Author

(This is related to the issue of determining the units of a ^ b)

@MichaelClerx
Copy link
Contributor Author

In Myokit I've explicitly disallowed it, with zero errors and/or complaints so far, but I can imagine you might end up with them somehow?

@jonc125
Copy link
Contributor

jonc125 commented Apr 25, 2019

Strictly speaking the first is invalid (sqrt requires dimensionless args, similarly for exp) and pycml emits an error. For web lab code generation, we treat such errors just as warnings and proceed hoping the modeller put conversion factors in appropriately. Since some widely used models have these issues...

The second option is allowed. But hopefully not done much!

@MichaelClerx
Copy link
Contributor Author

Really? So we allow m^(1/2) but not sqrt(m)? I would have thought having a rational in the exponent would be permissible before having a real was!

@MichaelClerx
Copy link
Contributor Author

Also sqrt(m^2) should be absolutely fine. For example if you measure the area of a square and want to deduce its length. I would say the input of sqrt() can have a unit, as long as its output doesn't have a non-integer unit...

@jonc125
Copy link
Contributor

jonc125 commented Apr 25, 2019

Good point, sorry, getting confused there. It is an error for exp() and trig functions, but not roots as you say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants