|
Page 1 of 1 |
|
|
Back to top |
|
 |
|
Posted: Wed, 29th Dec 2010 00:24 Post subject: |
|
 |
Well, C is not perfectly suitable for such mathematics. What you need is Matlab, which is technically a scripting language, but it's ideal for your needs, especially for algebra calculations. You can easily perform tasks such as differentiation and integration, which are not so easy to implement in other general or system-programming languages.
|
|
Back to top |
|
 |
|
Posted: Wed, 29th Dec 2010 00:32 Post subject: |
|
 |
If you use matlab you'll get everything done for you, which I don't think is what you want?
Personally I have never used Fortran but I have heard it get a lot of praise for math and physics stuff, and it's still widely used language in certain circles.
If you decide with C however, maybe the best way to start is some tutorials on the net. They're usually easier to understand than books in my experience.
|
|
Back to top |
|
 |
|
Posted: Wed, 29th Dec 2010 00:43 Post subject: |
|
 |
Fortran is used somewhat because it's really fast when it comes to math stuff. But these days ppl are using more and more C and C++.
On my uni tho the popular stuff is Python. And it's not complicated...
"Quantum mechanics is actually, contrary to it's reputation, unbeliveably simple, once you take the physics out."
Scott Aaronson chiv wrote: | thats true you know. newton didnt discover gravity. the apple told him about it, and then he killed it. the core was never found. |
|
|
Back to top |
|
 |
|
|
Back to top |
|
 |
Werelds
Special Little Man
Posts: 15098
Location: 0100111001001100
|
Posted: Wed, 29th Dec 2010 13:06 Post subject: |
|
 |
Well the biggest problem with math is that you have to be smart about the types you use. There are tons of numerical types, but which one do you want to use in what situation? It's a bit easier in weakly typed languages, where the interpreter or compiler handles the type conversions implicitly
And then there's the problem that not every "basic" math operation is necessarily directly available in a language; try 6^2 in C and watch it fail 
|
|
Back to top |
|
 |
|
Posted: Wed, 29th Dec 2010 13:32 Post subject: |
|
 |
Well making a function which takes to integers as input(n=6, m=2) and multiplies n with itself m times shouldn't be that hard to make. I see your point though.
I was thinking that if you understand how the computer calculates, it will be easier to guess uncertainties on your result and figure out where to write improvements.
|
|
Back to top |
|
 |
Werelds
Special Little Man
Posts: 15098
Location: 0100111001001100
|
|
Back to top |
|
 |
|
Posted: Wed, 29th Dec 2010 13:49 Post subject: |
|
 |
Atropa I think this should be a good start for C++:
http://www.learncpp.com/ (C++ is a superset of C, so if you know C++ you know C as well, plus is has some other handy features)
Also be aware that higher level languages like C#, Python or Java (C# being my preference) are much easier to learn than C/C++ because they hide a lot of the background details. For anything but the largest and most performance intensive apps, those languages are a much better choice.
However, I suppose there isn't a lot of math or physics stuff done in C# as there is in C++. So it might be a bad choice for the reason that you might not be able to understand other peoples work if you only know C#.
|
|
Back to top |
|
 |
Werelds
Special Little Man
Posts: 15098
Location: 0100111001001100
|
Posted: Wed, 29th Dec 2010 15:21 Post subject: |
|
 |
BearishSun wrote: | (C++ is a superset of C, so if you know C++ you know C as well, plus is has some other handy features) |
It's the other way around. If you know C++, you definitely don't know C. For example, in C++ you're not gonna use pointers or malloc unless you really have to (and for good reason). The other way around you'll understand how much of C++ works internally, even though you don't need to do it yourself anymore. You'd be surprised at how many people who know some basic C++ and use vectors or maps, but don't have a clue what a pointer is
Purely for the math, it really doesn't matter which language you choose. It can be done just as fine in C# or Java as it can be in C or C++ - they might be a bit slower depending on the situation, but they don't lack any mathematical power.
My advice: take one of the higher level languages. As a beginner doing some basic math stuff, there's no reason to learn what pointers are or how to manage memory yet. I'd also go for C#, as bloated as .NET can be, C# is a pleasant language for beginners. Once you're used to this stuff, you still should go all the way down to C though, because then you'll understand how much of the built-in classes and utilities work in the higher level languages 
|
|
Back to top |
|
 |
|
Posted: Wed, 29th Dec 2010 15:28 Post subject: |
|
 |
pwerelds wrote: | BearishSun wrote: | (C++ is a superset of C, so if you know C++ you know C as well, plus is has some other handy features) |
It's the other way around. If you know C++, you definitely don't know C. For example, in C++ you're not gonna use pointers or malloc unless you really have to (and for good reason). The other way around you'll understand how much of C++ works internally, even though you don't need to do it yourself anymore. You'd be surprised at how many people who know some basic C++ and use vectors or maps, but don't have a clue what a pointer is  |
? What are you talking about?
If you know C++, you know C. There's no other answer. If you don't know pointers, then you dont know C++.
I never learned C in my life, only C++. Every C++ book/tutorial teaches you about pointers extensively. You can't use C++ properly without knowing pointers so I don't know what you're talking about. References can be used instead of pointers, but they're more of a syntax convenience, and you still need to understand the underlying logic.
Last edited by BearishSun on Wed, 29th Dec 2010 15:29; edited 1 time in total
|
|
Back to top |
|
 |
Werelds
Special Little Man
Posts: 15098
Location: 0100111001001100
|
Posted: Wed, 29th Dec 2010 15:40 Post subject: |
|
 |
A reference is hardly the same as a pointer. Aside from the difference in syntax, indexing is done differently, a pointer can be NULL, and so on. References are also easier to understand and are extensively used in languages like PHP.
And I highly doubt any C++ tutorial shows you *alloc()/free() (I don't know, never used any tutorial for C++).
|
|
Back to top |
|
 |
|
Posted: Wed, 29th Dec 2010 15:46 Post subject: |
|
 |
they show you "new", and "delete", which are c++ equivalents of malloc/free. If you have never heard of new/delete then I really doubt you should be discussing this.
I never said they are the same, I said even if you only use references you will learn to understand how pointers work if you want to use references without getting confused.
|
|
Back to top |
|
 |
Werelds
Special Little Man
Posts: 15098
Location: 0100111001001100
|
Posted: Wed, 29th Dec 2010 16:40 Post subject: |
|
 |
Yeah because just like new malloc also calls constructors, free just like delete also calls destructors, and there's an equivalent of realloc. Notice how I said *alloc, not just malloc
The differences aren't big, but they are there, and you don't use realloc in C++ like you would in C. There are other means to achieve the same thing, but there is quite a big difference between what new/delete delete do as opposed to malloc/free. Comes with the nature of the language obviously, but the difference is hardly as trivial as you make it sound.
And nice try, but I never said I don't know C++, I just said I never used a tutorial for it. Having worked in fuck knows how many languages, I didn't really need tutorials. I already knew the OO principles, and I had worked in C before, so combining the knowledge of the 2 was plenty to dive straight into C++
Anyway, let's drop it, we're derailing like crazy here 
|
|
Back to top |
|
 |
Page 1 of 1 |
All times are GMT + 1 Hour |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group
|
|
 |
|