question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

I have an array of numbers, I would like to calculate the diffs between them.

Calculate the n-th discrete difference along the given axis.

Just like the numpy diff.

Is that possible?

Ps. this is definitely not the same as your math.setDifference!

Regards, Melroy

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
josdejongcommented, Apr 11, 2020

👍 let’s start simple then and see how it evolves 😃

1reaction
LloydLScommented, Sep 27, 2019

The answer would be, but nevertheless maybe somebody just want to add it to mathjs?

x = [..., .. ,..]
y = [..., ..,..]
// Assuming both x & y are the same length
var diff = x.map((value, index) => value - y[index])

Hi, If you want to subtract one array from another in MathJS you don’t need .map(), you can just subtract one from the other.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Result of diff two files with switched lines says missing the ...
To understand the report, remember that diff is prescriptive, describing what changes need to be made to the first file ( file1 )...
Read more >
Diff missing vs nothing - General Usage - Julia Discourse
It basically comes down to the following: missing is basically for representing missing values in a data set. It therefore just propagates ...
Read more >
Diff and ignore lines missing in one file - Super User
I want to diff two files and ignore lines that are present in one file but missing in the other. For example. File1:...
Read more >
Consider clarify Missing image ID and Missing diff ID ... - GitHub
It's a bit hard to distinguish what Missing image ID: or Missing diff ID: means in this context. I'm not sure if I...
Read more >
Find out missing files between two directories ... - Stack Overflow
I wonder how can I ignore the extension, and find the missing file (4.b in this case). I assume that diff command doesn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found