Closed christianp closed 2 years ago
Hello! I don't see anyone assigned to this issue, so would it be helpful for me to work on this function? Thank you!
HI @ldnljcksn, thanks for offering! Please have a look at our guidance on contributing code.
The maths functions are defined in runtime/scripts/math.js
, and JME functions are defined in runtime/scripts/jme-builtins.js
.
Open a pull request when you've got something I can look at, and please ask for help if you get stuck.
Hello Christian @christianp,
I fixed this issue and initiated a pull request. Would you mind if you take a look at it and give me some feedback?
Thanks so much and I appreciate your help!
Best, Alisa
I forgot to close this! Thanks again, @alisahq
This would be a nice function to have, instead of having to rewrite it each time I write a question that needs it.
u
is a scalar multiple ofv
if there is a scalark
such thatu = k*v
. You could find thisk
by computing the ratiou_i / v_i
for each non-zero componenti
, then check that the ratios are all equal. This should work similarly toisclose
, allowing given relative and absolute tolerances.The function would look like
is_scalar_multiple(u, v [, rel_tol] [, abs_tol])
Zero is an edge case: its only scalar multiple is zero.