473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Binomial coefficient

Hi

I'm very sorry for maybe posting something which was already posted.

--How can I compute the binomial coefficient in C++? <--

Is it possible that there is no existing library for that out there
(expect something that big like the gnu scientific library)?

I searched the groups but couldn't find some good answers to this
question except something like "Hey you - why are you posting that? We
already answered this stuff." but without some _usefull_ links.

Of course I can write something on my one - which I actually did - but
then I have to handle with problems like type-overflow and the
largeness of some factorials (which I can actually compute till 12
with datatype long - not big at all).

So if someone out there knows a good solution for this - I would be
very appreciative.

Thanks a lot
- Egg

Aug 24 '07 #1
9 10007
ma**@mathiasbader.de wrote:
I'm very sorry for maybe posting something which was already posted.

--How can I compute the binomial coefficient in C++? <--
You write a program that does that. You fire up your text editor,
type the program up, save it to a file, compile it, work out all the
syntax errors, link, run, test on known cases, then use it to solve
the cases you don't yet have a solution for.
Is it possible that there is no existing library for that out there
(expect something that big like the gnu scientific library)?
Yes, it is possible. Have you tried looking on the Web?
I searched the groups but couldn't find some good answers to this
question except something like "Hey you - why are you posting that? We
already answered this stuff." but without some _usefull_ links.
Oh... We're sorry. Here is the link where I'd start looking:

www.google.com (don't say I didn't provide any links; I bet that
Google has billions of links available for consumption), or, if you
prefer German, try www.google.de
Of course I can write something on my one - which I actually did - but
then I have to handle with problems like type-overflow and the
largeness of some factorials (which I can actually compute till 12
with datatype long - not big at all).
Oh, yeah. I know what you mean. All those problems with program
writing and debugging -- one actually needs to make programs *work*
before they can *work for him*. Been there, done that. Every day
(well almost), as a matter of fact.
So if someone out there knows a good solution for this - I would be
very appreciative.
Try the Google thing, you might actually find it useful, and not just
for this particular case.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 24 '07 #2
Hi

First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...

Victor? I'm not sure that you know what you are doing here ...
Actually your answer indeed didn't help me anything - apart from
feeling defensive. Don't you have better things to do??

- Egg

Aug 24 '07 #3
<ma**@mathiasbader.dewrote:
First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...
You have to be alert for synonym's and what some people might think are
synonyms.
I did a google search for <"pascal's trinagle" code cand trhe second hit
(CS1003, which I looked at first) seems to have code for a recursive
Pascal - the language - code. I figure most programmers should be able to
_read_ (but not write) Pascal. And if I were suufficiently driven I could
probably find something better.
Aug 24 '07 #4
ma**@mathiasbader.de wrote:
Hi

First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...

Victor? I'm not sure that you know what you are doing here ...
Actually your answer indeed didn't help me anything - apart from
feeling defensive. Don't you have better things to do??
Victor may have been a bit snippy, but the question was off topic here.

When you post, ask yourself, "Would the answer be essentially the same
if it was in another language than C++?" If you reply "yes", then it's
OT here, and probably belongs in comp.programming, comp.graphics,
comp.object, comp.algorithms, etc...

Then ask yourself, "Does this question make sense if I go to another
platform (e.g. Linux instead of Windows)". If the answer is no, then
you're better off asking in a platform-specific newsgroup
(microsoft.public.*, comp.unix.*).

The OP's question fails the first test -- it's not a C++ specific
question, hence it doesn't belong here.

Please see the FAQ (http://www.parashift.com/c++-faq-lite) for this
group, in particular the netiquette section -- section 5
http://www.parashift.com/c++-faq-lite/how-to-post.html

Thanks

--
red floyd
Aug 24 '07 #5
Hi

Thanks for your help. I admit that I'm not a google-groups profi yet.
Sorry for that.

Greetings
- Egg

Aug 24 '07 #6
On 2007-08-24 18:05, ma**@mathiasbader.de wrote:
Hi

Thanks for your help. I admit that I'm not a google-groups profi yet.
Sorry for that.
Then I'll teach you a bit more. comp.lang.c++ and a lot of other groups
are not Google groups, but newsgroups (or usenet groups). Google groups
is just an interface through which you can access them (an not a very
good one either), and some other Google specific groups.

--
Erik Wikström
Aug 24 '07 #7
ma**@mathiasbader.de wrote:
Hi

Thanks for your help. I admit that I'm not a google-groups profi yet.
Sorry for that.
Read this:

<http://en.wikipedia.org/wiki/Usenet>
In particular the part:

<http://en.wikipedia.org/wiki/Usenet#Google_Groups_.2F_DejaNews>


Brian

Aug 24 '07 #8
"red floyd" <no*****@here.dudewrote in message
news:mW*******************@newssvr12.news.prodigy. net...
ma**@mathiasbader.de wrote:
>Hi

First at all thanks to osmium and Icaro. The link is very helpfull,
although I think there doesn't exist something like a library for this
problem - which I am really surprised of, cause I don't think I am the
only one who needs this function ...

Victor? I'm not sure that you know what you are doing here ...
Actually your answer indeed didn't help me anything - apart from
feeling defensive. Don't you have better things to do??

Victor may have been a bit snippy, but the question was off topic here.

When you post, ask yourself, "Would the answer be essentially the same if
it was in another language than C++?" If you reply "yes", then it's OT
here, and probably belongs in comp.programming, comp.graphics,
comp.object, comp.algorithms, etc...

Then ask yourself, "Does this question make sense if I go to another
platform (e.g. Linux instead of Windows)". If the answer is no, then
you're better off asking in a platform-specific newsgroup
(microsoft.public.*, comp.unix.*).

The OP's question fails the first test -- it's not a C++ specific
question, hence it doesn't belong here.

Please see the FAQ (http://www.parashift.com/c++-faq-lite) for this group,
in particular the netiquette section -- section 5
http://www.parashift.com/c++-faq-lite/how-to-post.html
Also ask yourself, "did I google for the answer first?"

If an answer is easily found by googling it, that's what you'll usually get
from the newsgroup, try www.google.com, which is what you got. If you don't
know how to use google, learn.
Aug 25 '07 #9
"Jim Langston" wrote:
If an answer is easily found by googling it, that's what you'll usually
get from the newsgroup, try www.google.com, which is what you got. If you
don't know how to use google, learn.
As I understand it from what he said, the OP searched Usenet (google groups)
instead of searching the Web (using the google search engine). That was his
basic mistake and I can sympathize with that; most of us have to learn
things, our instincts aren't as highly developed as most animals. .

Aug 25 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matthew | last post by:
Hello, For a few days now, I have tried a number of methods that are supposed to provide the a(k) and b(k) coefficients for a Fourier series. These methods are listed at the end of this post (in...
2
by: Pasi Havia | last post by:
Hi, I am making a little program which calculates Wright's inbreeding coefficient. What I have a trouble with is converting the formula into a code. The formula is: Fx=? As I'm using...
2
by: PengYu.UT | last post by:
Hi, I know they are simple to implement, although I have to take care of overflow. But I just do not want to reinvent the wheel. Do you know if there is any library for them? Thanks! Best...
7
by: Nena | last post by:
Hi there, I'm trying to include the Numerical Recipes for C++ for the Dev-C++ Editor Version. But so far I've failed. Therefore I've copied all head-files (for example nr.h) into the folder...
18
by: robert | last post by:
Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: m, m-err, o, o-err, r-coef,r-coef-err ? Or a formula to to compute the 3 error ranges? ...
5
by: Carramba | last post by:
theorem states that: Integer n is prime if and only if (x +1)^n ≡ x^n +1 (mod n) in Z. so I testing it, but values doesn't match ... and I don't se why.. I guess :) it's some thing wrong in...
2
by: thatwhiteguy | last post by:
I have worked out all the bugs on my program. It is compiled and it actually runs. The problem I am having is it is not giving me the right answers. I know it must be something in my equation, but...
5
by: gracia | last post by:
I need to compute the value of binomial(n, k)=n!/k!(n-k)! * (1-p)^n * p^k. When n and k is very big (e.g. n 160), the step to compute n!/k!(n- k)! is always overflow even when I used unsigned...
7
by: siddharthkumarr | last post by:
hello everybody...i m a newbie and struggling with a small assignment which involves 1- creating a dynamic array for floating point numbers 2- comparing adjacent numbers and finding the CORRELATION...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.