Grasshopper

algorithmic modeling for Rhino

Is there a factorial function in VB? I found a factorial Grasshopper component, but I'd like to write an equation using factorials, as opposed to forming the equation from components.

I want to calculate n choose k, as seen in below image.

Views: 713

Replies to This Discussion

Do you mean this?
Attachments:
I tried that, but I need (0!) to be defined as 1. It is turning up null using that expression.
Here's the component version:

could you just insert a vb component in between n-k and (n-k)! that checks if its 0 and if so sets it to 1
Attachments:
No. That way will calculate n=0 or n=k to be equal to the same result as n=1 or n=k-1, but n=0 and n=k should evaluate to 1. See above example.

I'm sure it's easy to write a VB function to do it, but I was just hoping there was one already.

thx

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service