Showing a way of returning elementwise operations to some functions #2881
Closed
dvd101x
started this conversation in
Show and tell
Replies: 1 comment 4 replies
|
Thanks for sharing David! You can indeed extend a mathjs function with support for // extend function sin with support for matrices and arrays
math.import({
sin: math.typed({
'Array | Matrix': A => math.map(A, math.sin)
})
})For reference: there is a discussion whether to support element-wise operations for a set of functions in #2440 |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I have been working on a way to extend some mathjs functions to add elementwise operations similar to matlab or numpy (personally I'm more familiar with that)
To test it:
It's the first time I use some of the extension capabilities of mathjs and I'm fascinated by that. Maybe it's a bit basic for some of the more advanced users here and I see those capabilities are well documented, nontheless here it is.
Even found a way to make work
log([1, 2], 2)logarithm base 2 elementwise for [1, 2]https://github.com/dvd101x/web-thermodynamics
PD: Next I will try to extend index
All reactions