473,321 Members | 1,669 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,321 software developers and data experts.

Math programming with C

Hi, I need to learn the necessary and sufficient C programming knowledge
in order to be able to implement number theory and graph theory
algorithms (as RSA or Dijkstra algorithms). No system programming no
network programming nor graphic programming.

Any advice ? Any link to a non verbose reference ?

Thanks in advance,
La Tortue
Nov 14 '05 #1
6 5119
none wrote:
Hi, I need to learn the necessary and sufficient C programming knowledge
in order to be able to implement number theory and graph theory
algorithms (as RSA RSA is cryptography, not graph theory
or Dijkstra algorithms). No system programming no
network programming nor graphic programming.

Any advice ? Any link to a non verbose reference ?

Thanks in advance,
La Tortue


Start with http://nr.com/ or http://directory.fsf.org/libs/GNUsl.html

gtoomey
Nov 14 '05 #2
Gregory Toomey a écrit :
none wrote:

Hi, I need to learn the necessary and sufficient C programming knowledge
in order to be able to implement number theory and graph theory ~~~~~~~~~~~~
algorithms (as RSA
RSA is cryptography, not graph theory


Sure. RSA is basically number theory stuff.

or Dijkstra algorithms). No system programming no
network programming nor graphic programming.

Any advice ? Any link to a non verbose reference ?

Thanks in advance,
La Tortue

Start with http://nr.com/ or http://directory.fsf.org/libs/GNUsl.html


Thanks, interesting links (although not exactly for _learning_ C
programming language for math).

La tortue

Nov 14 '05 #3
@(none) wrote:
Hi, I need to learn the necessary and sufficient C programming
knowledge in order to be able to implement number theory and
graph theory algorithms (as RSA or Dijkstra algorithms). No
system programming no network programming nor graphic
programming.
C is not a precise language, which makes it very hard to do hardcore
mathematics in it. Its possible, but you basically have to compromise
either on portability or speed, unless you are willing to really become
expert on the language.

Just learning how C deals with integers should give you reason to
reconsider using it as a language for this kind of thing. To get some
sort of sanity out of the language you have put letters like "U" or "L"
at the end of all your inline declared numbers. I would recommend
testing on no less than 7 compilers all with maximum warning settings
and using lint if you plan on having any degree of portability.

But, no compiler or lint-like utility that I am aware of can actually
assist programmers with any kind of numerical determinism. You are
basically forced to become an expert at the language which may take
many weeks or months (Python can be learned in a few hours and doesn't
have these problems).

Here are some examples:

int a, b;
unsigned int c, d;
...
if (a < 0) a = -a;
return sqrt (a); /* Undefined result. */

b = a >> 24; /* A completely meaningless operation */

if ((a % c) == (b % c))
/* a and b having the same residue mod c is insufficient
to make this condition true */

d = (a - b) % c;
/* d is zero when a and b are equal mod c, but otherwise
will not necessarily be equal to the correct residue
mod c */

And just to annoy mathematicians, C uses "*" for two different
operations as well as part of the comment brackets (and uses "/" for
comment brackets as well).

C is just a rotten language for doing real mathematics. Most of these
problems go away in other languages -- especially those that support
arbitrary precision integers (like Java, Python, etc.)
Any advice ? Any link to a non verbose reference ?


Yeah, pick a different language.

---
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/

Nov 14 '05 #4
we******@gmail.com wrote:
@(none) wrote:
Hi, I need to learn the necessary and sufficient C programming
knowledge in order to be able to implement number theory and
graph theory algorithms (as RSA or Dijkstra algorithms). No
system programming no network programming nor graphic
programming.
C is not a precise language, which makes it very hard to do
hardcore mathematics in it. Its possible, but you basically
have to compromise either on portability or speed, unless you
are willing to really become expert on the language.


Your trolling has been getting more and more pronounced over
the last few months.
Just learning how C deals with integers should give you
reason to reconsider using it as a language for this kind of
thing. To get some sort of sanity out of the language you
have put letters like "U" or "L" at the end of all your
inline declared numbers. I would recommend testing on no
less than 7 compilers all with maximum warning settings and
using lint if you plan on having any degree of portability.
Ok, it's now clear that you have trouble with C .. that doesn't
mean you should tell everyone else on comp.lang.c to avoid it.
C is just a rotten language for doing real mathematics. Most
of these problems go away in other languages -- especially
those that support arbitrary precision integers (like Java,
Python, etc.)


C supports arbitrary precision integers (for example, the GMP
library).

You could have said something like 'Mathematics takes less coding
time in a higher-level language', instead of that rant.

Nov 14 '05 #5
we******@gmail.com wrote:

<snip>
C is just a rotten language for doing real mathematics. Most of these problems go away in other languages -- especially those that support
arbitrary precision integers (like Java, Python, etc.)
Any advice ? Any link to a non verbose reference ?


Yeah, pick a different language.


These seem like overly strong statements. Googling "arbitrary precision
arithmetic C" produces many hits -- can't one use one of these
packages? I think many Fortran and C compilers support both 8 and 4
byte integers nowadays, whereas Python uses either 4 byte or arbitrary
precision integers (ABI). ABI's are much slower to work with than 8
byte integers, which may be all that is needed for a particular
calculation.

C99 (the latest C standard) has added many features for numerical
computation. One of the few books covering C99 is "C Primer Plus", 4th
Edition, by Stephen Prata.

Nov 14 '05 #6
CBFalconer <cb********@yahoo.com> wrote:
Richard Bos wrote:
we******@gmail.com wrote:
C is not a precise language, which makes it very hard to do
hardcore mathematics in it.


As usual, Paul Hsieh is talking complete bollocks. If you know
your C and take just a little care, it's quite possible to do
maths in C, and number and graph theory are not even the hardest.
Of course, this does require that you are willing to learn the
language properly, which Paul has never been.


Oh my - prepare for a flood of invective.


Feh. I only care about invective if it comes from people I take
seriously.

Richard
Nov 14 '05 #7

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

Similar topics

6
by: Bibby | last post by:
I'm interesting in studying OOP programming languages on my own: C, C++, Java. I haven't studied the big 4 math subjects in my last year of high school, Calculus, Algebra, Geometry, Statistics....
12
by: xeys_00 | last post by:
I decided I need to understand math more to help me with programming. Not to mention, eventually in my degree plan I will need to do it anyway. How much math have people in this forum taken, and...
17
by: cwdjrxyz | last post by:
Javascript has a very small math function list. However there is no reason that this list can not be extended greatly. Speed is not an issue, unless you nest complicated calculations several levels...
110
by: Gregory Pietsch | last post by:
I'm writing a portable implementation of the C standard library for http://www.clc-wiki.net and I was wondering if someone could check the functions in math.h for sanity/portability/whatever. I'm...
3
by: Bart Vandewoestyne | last post by:
Simple question: does the Java standard specify what random number generator algorithm should be used for Math.random() ? If 'no', then can anybody tell me what PRNG is behind Sun's version of...
7
by: C.W.Holeman II | last post by:
For info on the context of my question see the end of this posting. From http://www.w3.org/TR/XHTMLplusMathMLplusSVG/: How can I validate the result of client-side XSLT transform which has...
4
by: aguirre.adolfo | last post by:
Hi, I am a very newbie who would very much appreciate some hints. Python 2.52. on Windows XP for now. Soon on Ubuntu 8 I am teaching myself Python following free tutorials. I can solve...
17
by: Lenni | last post by:
Hi, I'm currently writing a web application for bicycle wheel builders that calculate the spoke length for all sorts of variations of hubs and rims. I have translated the formula from an...
9
by: DaiOz | last post by:
Hi guys im doing a course which includes some JavaScript and I need help with the following question please, The code I have so far is below but I don't think its right please help as I need...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.