Register to reply

Partition Function

by mak
Tags: function, partition
Share this thread:
mak
#1
Nov25-05, 06:00 AM
P: 1
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
Phys.Org News Partner Science news on Phys.org
Flapping baby birds give clues to origin of flight
Prions can trigger 'stuck' wine fermentations, researchers find
Socially-assistive robots help kids with autism learn by providing personalized prompts

Register to reply

Related Discussions
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