Tell Wolfram Alpha that a variable is a natural number

50.1k Views Asked by At

How can I tell Wolfram Alpha that some variables are natural numbers, when I want to solve a equation?

An example of what I want to do:

$\binom{n}{k}\cdot p^k \cdot (1-p)^{n-k} = \frac{1}{\sqrt{n\cdot p \cdot (1-p)}}\cdot \frac{1}{\sqrt{2 \cdot \pi}} \cdot e^{-\frac{1}{2} \cdot \left(\frac{x-np}{\sqrt{n \cdot p \cdot (1-p)}}\right)^2}$ solve for $x$ with $n,k \in \mathbb{N}$, $0 \lt p \lt 1$.

2

There are 2 best solutions below

4
On

Just add an "assuming x integer" at the end. I tested it, and it seems to work. (similar to Maple's notation assuming x::integer, I guess) For natural it doesn't seem to work properly: assuming x natural

3
On

It depends on how you are trying what it is you are trying to solve. Telling Mathematica that something is an integer has a different syntax depending on what you are trying to do.

Assuming that you are using the "Solve" function, it would look like this:

Solve[(x - 3/2) (x - 2)== 0 && x \[Element] Integers]

EDIT. After 6 years, the website has changed and this no longer works. However,

 Solve (x-3/2)(x-2)=0 for x integer

seemed to work, as you can can see here.