Mike Day on Sat, 20 Jul 2019 20:02:46 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Help understanding generating functions, (partitioning n into k parts)


Should change this thread’s subject! 
Tried pnk, by “mihaild” as sent by Dmitry ... yes, it’s good, and generates 
P(n,i) for i in [1,k] which can be output instead.  

I’ve coded it back into J where it’s also good, and will try to bring it to the attention of the J programming forum when back home.  Quite tricky to recode the double loop on i, j to a single loop, which I might try sharing here, too,  when home again.

Qns: 
A) why no cumulative vector sum/products in pari? 
eg veccumsum(v) = vector (#v, i, v[i]+if(i>1, v[i-1], 0))

B) I can multiply a vector by an integer; why can’t I add an integer?

Thanks,

Mike
.      
Sent from my iPad