Comments (5)
Version 3.4.1 in IDE mode you can input the functions like this
Binomial(17,13)
Factorial(0.75)
Can you give some examples of your calculations which go wrong.
from ncalc.
Please refer to the screenshot below. I've seen all the ceiling operators, and that's the mistake.
The correct way to calculate Comb(n, r)
is n!/(r!(n-r)!)
, non-negative integers or not. There should not be any rounding up or rounding down. So don't round off the inputs.
Similarly, we have Perm(n, r) = n!/r!
for all numbers.
If you wonder what is n! for non-integer n, then take n! = Gamma(n+1)
. (You have already done this correctly.) The Gamma function works for complex numbers, so if your program support complex numbers you should also check your factorials against complex numbers.
Again, refer to the Wolfram article if you need any help. It has specifically defined nCr defined for non-integers with gamma function.
BTW, if you wonder what are the use of non-integers for nCr, consider the binomial expansion of (1+x)^n
(where n is not an integer). I don't know for any use of non-integer r, but the web says that some people do use it.
from ncalc.
You mean file CustomFunctions.java where the definitions should be:
Comb(n_, k_):=Binomial(n,k)
Perm(n_, k_):=Gamma(n+1)/Gamma(k+1)
BTW in you screenshot the input Comb(2.5,)
is parsed as Comb(2.5, Null)
from ncalc.
Yes.
BTW, I don't understand why the second string is named BINOMIAL
, which is supposed to be a synonym of "combination". I guess you should name that PERMUTATION instead.
Anyway, parsing Comb(2.5,)
is parsed as Comb(2.5, Null)
is okay to me. With invalid input anything other than crashing is okay. I gave you the screenshot just because it exposes the wrong formula.
from ncalc.
Fixed with 3.4.3-beta
from ncalc.
Related Issues (20)
- Incorrect result of Fibonacci Number HOT 5
- Mode Algebra-Simplify Expression has some error HOT 1
- Incorrect result of Prime Number module with negative number input HOT 2
- [Feature request]Possibility to "type" a function instead of searching for it in the list
- Metrics results for the project
- "Error String index out of range" during usual calculation
- Copycat/clone on Google Play HOT 2
- Confused about app versions, documentation
- PI calculator might has some problems HOT 2
- Permutation result is not right
- Result incomplete display HOT 1
- Incorrect angle value HOT 1
- Base-N module Interface HOT 1
- Suggestion: Notebook like experience for programming mode HOT 2
- Distance from A to B result is incorrect
- GCD function doens't work
- LCM function doesn't work
- The value of tan((2k+1)Ο/2οΌis not correct HOT 1
- The value of matrix calculate is incorrect
- Incorrect result of matrices addition with inconsistent dimension. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ncalc.