Jump to content

Combinations and Permutations:any one can help ....


Recommended Posts

hi evryone i want to know if there are any expression can give me a value lik this:

($CY)*($CY - 1)*($CY - 2)*($CY - 3)*($CY - 4).....................................($CY-{$NCY-1})

so if any one know please help ..........and thanks very much......................................

Edited by xoctan657
Link to comment
Share on other sites

Can you describe exactly what you're trying to do please? Why do you need that type of expression? What's the purpose? There might be other ways of doing what you want.

Cheers!

steven

i did what i wanted just a few minuts back but anyway it will be helpfull if there are like this expression:

if we have $NCY=6

so with $CY=5 it will give me this value: ($CY)*($CY - 1)*($CY - 2)*($CY - 3)*($CY - 4)

and for $CY=4 give : ($CY)*($CY - 1)*($CY - 2)*($CY - 3)

and for $CY=3 give : ($CY)*($CY - 1)*($CY - 2)

and ..................................like this

as in the Combination in the mathematics

http://en.wikipedia.org/wiki/Combination

Edited by xoctan657
Link to comment
Share on other sites

so you need factorial. In python, assuming that the input is in the "tx" channel:

param = int(ch("tx"))
if param <= 1:
	return 1
fac = 1
for i in range(2,param+1):
	fac = fac * i
return fac

i did what i wanted just a few minuts back but anyway it will be helpfull if there are like this expression:

if we have $NCY=6

so with $CY=5 it will give me this value: ($CY)*($CY - 1)*($CY - 2)*($CY - 3)*($CY - 4)

and for $CY=4 give : ($CY)*($CY - 1)*($CY - 2)*($CY - 3)

and for $CY=3 give : ($CY)*($CY - 1)*($CY - 2)

and ..................................like this

as in the Combination in the mathematics

http://en.wikipedia.org/wiki/Combination

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...