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.

The negate function makes it possible to obtain the additive inverse of a number. How about adding a similar function, but for multiplicative inverse?

// inverse :: Number -> Number

inverse(10); //=> 0.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitrizcommented, Apr 20, 2017

Mathematically I am familiar with the “inverse” of functions f^-1(f(x)) = x and matrices too. So I would not like naming x => 1 / x “inverse”.

Both are inverses for different group operations. First for the composition of invertible functions, and second for the multiplication.

Which becomes a problem if inverse is used without clearly specifying the operation. reciprocal would be unambiguous.

0 * inverse(0) does not equal 1.

That is because JS forcefully extends the division breaking the maths law: (1/0)*0 != 1 Still formally (a/b)*b == a holds for all valid expressions, but we cannot expect it to hold for the invalid ones.

For Linear Algebra and vector calculus I’d rather pick a specialized library than Ramda…

… and a different language than JavaScript

That language is called maths 😉

1reaction
buzzdecafecommented, Apr 13, 2017

in that case, reciprocal = R.divide(1);

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inverse - Math is Fun
Inverse. Inverse means the opposite in effect. The reverse of. It is a general idea in mathematics and has many meanings. Here are...
Read more >
Inverse Function – Definition With Examples - SplashLearn
In mathematics, the word inverse refers to the opposite of another operation. Let us look at some examples to understand the meaning of...
Read more >
Inverse function - Wikipedia
In mathematics, the inverse function of a function f is a function that undoes the operation of f. The inverse of f exists...
Read more >
Finding inverse functions (article) - Khan Academy
Inverse functions, in the most general sense, are functions that "reverse" each other. For example, if f f ff takes a a aa...
Read more >
Inverse Operations in Math: Definition & Examples
The four main mathematical operations are addition, subtraction, multiplication, division. The inverse of addition is subtraction and vice versa ...
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