Thread Closed

Partition Function

 
Share Thread Thread Tools
Nov25-05, 06:00 AM   #1
mak
 

Partition Function


Hi everyone,

I am trying to define a function partition in Haskell that takes in an integer as an argument and returns a list of all possible positive integers that would sum to the input, ie

partition 4 = [[1, 1, 1, 1], [1, 1, 2], [1, 3], [2, 2], [4]]

The function (formally defined) can be found here
http://en.wikipedia.org/wiki/Partiti...mber_theory%29

From the outset it looks like i'll need to increment and decrement different variables on each recursive call, but have no idea where to start. Sorry if this seems trivial, but i think it's rather difficult for a beginners tutorial :)

Thanks for your help
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> King Richard III found in 'untidy lozenge-shaped grave'
>> Google Drive sports new view and scan enhancements
>> Researcher admits mistakes in stem cell study
Thread Closed
Thread Tools


Similar Threads for: Partition Function
Thread Forum Replies
Partition Function Advanced Physics Homework 3
partition function Advanced Physics Homework 5
Zeros of the partition function Quantum Physics 1
Partition function Advanced Physics Homework 4
divergence of a partition function Quantum Physics 9