Message Boards Message Boards


Calculate the result of a recursive equation in Wolfram Alpha?

Posted 22 days ago
3 Replies
3 Total Likes

I am looking for a way to solve $ B(P,N) $ function with Wolfram|Alpha.

Where $ B(P,N) $ is a recursive function defined as follows:

$ B(P,N)=\frac{-(-1)^{\frac{N}{2^{P-1}}+\sum_{i=1}^{P-1}(\frac{-B(P-i,N)}{2^{i}})}+1}{2} $

$P\in \mathbb{N}_{>0}$

$N\in \mathbb{N}$

Note that $ \sum_{i=1}^{0}f(x)=0 $ summation is an empty sum, so:

$$ B(1,N)=\frac{-(-1)^{\frac{N}{2^{1-1}}+\sum_{i=1}^{0}(\frac{-B(0,N)}{2^{i}})}+1}{2}=\frac{-(-1)^{\frac{N}{2^{0}}+0}+1}{2}=\frac{-(-1)^{N}+1}{2} $$

I've tried solving $ B(2,7) $ with Wolfram|Alpha, but it doesn't seem to work -- SEE LINK

3 Replies
Posted 22 days ago

Hi Parminder,

Using WL

b[p_Integer, n_Integer] := (-Power[-1, 
      n/Power[2, p - 1] + Sum[-b[p - i, n]/Power[2, i], {i, 1, p - 1}]] + 1)/2

$$\frac{1}{2} \left(-(-1)^{\frac{n}{2^{p-1}}+\sum _{i=1}^{p-1} -\frac{b(p-i,n)}{2^i}}+1\right)$$

b[2, 7]
(* 1 *)

Table[b[p, n], {p, 0, 7}, {n, 0, 80}] // ArrayPlot

enter image description here

I don't know how to do this on Wolfram|Alpha.

Thanks for the reply Rohit. I have never used WL. Can you suggest me a good development environment for this language?

Posted 21 days ago


You can sign up for a free Wolfram Cloud account here and use the WL from a browser (there are some resource consumption limitations).

If you are unfamiliar with WL then take a look at Stephen Wolfram's book which is available online for free.

You might also find this helpful.

Have fun!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract