[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 107 KB, 300x330, dexter.png [View same] [iqdb] [saucenao] [google]
4852103 No.4852103 [Reply] [Original]

What's a good first programming language to learn if you're in the sciences? Something that's not super difficult to learn but is still useful?

I want to get a jump start on learning a language over the rest of the summer, be more prepared to help out with faculty research in the Fall... but I'm not sure what a good language to begin with is.

Wanted to get /sci/'s opinion

>> No.4852110
File: 137 KB, 758x743, coolface.jpg [View same] [iqdb] [saucenao] [google]
4852110

java

>> No.4852113

Not C

>> No.4852115

Python

>> No.4852114

python, for sure, there are many scientific libs to use and loads of learning material

>> No.4852117

>>4852113
He may have to learn it eventually, so might as well as start now.

>> No.4852118

Fortran

>> No.4852128

>>4852118

fortran and python

>> No.4852137

Definitely NOT C. Not Java/C++/C# either.

Python is a good choice because it's very very user friendly and has tons of build-in libraries. The syntax is more clear that in C and the like, focus is on algorithmics, and it forces you to take the good habit of indenting your code properly.

Functional languages like the ML languages, Lisp, Haskell etc are also nice especially if you are going to code complicated algorithm, rather than straight-forward computations in a nice environment (in which case forget about them). My favorite is OCaml, but it might be hard to learn it by yourself, I'm not sure about that.

>> No.4852139

C has a steep learning curve
Fortran is a dying language
Java is fucking useless.

Python's easy to learn and is seen by many as the "up and coming" language in the sciences. Matlab's another good one

>> No.4852141

matlab

>> No.4852145

>be maths major
>be 1st year
>our department anal raped us with C
>butt now becoming sore
>be graduate
>scars wont disappear

>> No.4852143

>>4852117
I disagree. Learning C is something people should do when they have a decent level in algorithmics, and either:
- need to learn C because they are provided with C code that they have to use, or are asked to produce C code (even though you can usually interface most languages with C both ways around... but doing so requires some knowledge of C anyway),
- really want to get a better understanding of how, deep down, your high level language works.

But pedagogically, starting with a low-level language is a bad choice. It doesn't have the focus on what you really want to learn: programming. There's too much focus on syntax and on low-level behaviours that are really distant from implementing algorithms etc.

TL;DR: Maybe you'll have to learn C at some point, but learn a high level language (like python) first. The more languages you know, the faster you learn the next ones anyway, so better start with one that is good to start with.

>> No.4852146

If you can get a copy - Mathematica. You won't be able to do a lot of "functional programming" with it, but it's good for learning the basics and it's fucking great for research work. After that maybe work up to Matlab or Python or something.

The nice thing about languages is that once you learn one, it's easier to learn another.

>> No.4852148

>>4852139
Fortran actually died years ago. Only 50+ years old mathematicians keep using it. Not computer scientist, no computer engineer uses it, and scientists that still use it clearly do so for the sole reason that they are too fucking lazy to learn a better language (which is a shame, because take a few days to learn a better language would save them weeks of using that old pile of crap language).

>> No.4852154

>>4852148
Yeah, really the only reasons to learn Fortran are to act as a translator for older professors, or to leech off 20 year old programming instead of writing your own.

>> No.4852171

I will say first learn Python, for the reasons everyone's already mentioned, and then once you've found solid footing, learn C because it will teach you how your computer actually works.

>> No.4852175

>>4852139
>>4852141
Matlab is proprietary though so it may not be a good option.

>> No.4852176

MATLAB/Octave

>> No.4852188

Not OP here, but the general consensus is:

Python first, then C.

Right?

>> No.4852200

>>4852188
I woul go with:
Python, Java, C++
This way there would be a slower in abstraction

>> No.4852203

>>4852200
So Python > Java > C++ > C ?

Python is close to Java which is close to C++ which is close to C?

Would those intermediate steps be needed? Also, I saw you left out C, was this intended to say that C isn't needed or good to know?.

>> No.4852207
File: 61 KB, 300x301, billnyeconsiderthis.jpg [View same] [iqdb] [saucenao] [google]
4852207

>>4852103
Haskell.

>> No.4852214

>>4852203
If you truly learned C++ you already know most of what's important to know in C. The main difference to a layman is that C is not OOP

>> No.4852211
File: 188 KB, 800x1100, 2.jpg [View same] [iqdb] [saucenao] [google]
4852211

C++

>> No.4852210

R bitches
people are doing all their data analysis in R now
http://www.r-bloggers.com/

>> No.4852217 [DELETED] 
File: 183 KB, 566x690, 1280786169585.jpg [View same] [iqdb] [saucenao] [google]
4852217

>>4852203
>Java > C/C++

metal retard detected

>> No.4852224

>>4852200
Ehhhh I dunno about sticking Java in there. I mean, it's not a bad way to segue into C but I haven't found it to be particularly useful.

Maybe that's just me though.

>> No.4852232

Learning python first is nice because it's pedagogical. Sets, maps, lists, etc are easy to implement, so you get a feel for the different data structures.

But eventually learn C++. It is the language of the gods.

>> No.4852234

>>4852203
Java is a horrible slow and retardedly designed language. No one uses it in science or if they have more than half working brain (i.e. not a CS major)
Python is an interpreted (slow) language, if you're going to go interpreted then you be much much better off just to go to Matlab with it's gigantic matrix/numerical/math tool sets and practical standard in many Math/Science/Engineering domains
C/C++ is the only high speed compiled programing language in wide use today. The earlier you learn it the better you be as a coder.

Learn Matlab and C++, then python just to uses it for quick algorithm prototyping and misc scripting.

>> No.4852238

>>4852234
>matlab, C++, python

What order?

>> No.4852248

>>4852238

Not him, but I would say python first to get a feel for OOP and programming in general. Then matlab, because by then you'll have a feel for loops, so it will be intuitive to vectorize your code (if you try learning matlab with no programming experience, vectorized code might be confusing). Then C++.

>> No.4852249

Perl

Python good too.

MATLAB or IDL are musts for publication quality figures and dealing with big datasets in scientific formats like .netcdf in my field.

>> No.4852247

>>4852224
It is useful, but than again it depends on what you work with.

Let's consider Math, both Matlab and Mathematica have changed there API use more Java and make the programs more accesible to Java programmers even the languages have changed their syntax to be more Java-like.

Also, it's easier to grasp the nature of OOP with Java than with Python, where it's way to abstract, and with C++, when it's a feature, but not a rule. Since most of software development blows with OOP have a good ground in Java makes everything easier to understand. Don't even have to say that most of the books use either Java or a Java-like syntax.

>> No.4852250
File: 52 KB, 500x1105, programmer_hierarchy[11].gif [View same] [iqdb] [saucenao] [google]
4852250

ignore the python-fags.
Learn C++0x

>> No.4852254
File: 40 KB, 700x358, ridetheworm.jpg [View same] [iqdb] [saucenao] [google]
4852254

>>4852238
Learn Python first - it's a lot easier to pickup and you'll get a good understanding for the basics of programming. Then move onto Matlab, it's more difficult but it's much better for doing modeling, data analysis or anything science-related, finish off with C++.

Learning C is like taming the sandworms in Dune - hard as fuck but if you somehow manage to do it, you can conquer empires and topple gods.

>> No.4852259

>sciences
FORTRAN

>> No.4852266

>>4852238

Go straight into C++ first. Everything you learn there with carry over to all other good languages.

>> No.4852271

>>4852234
Two things:
1 - In benchmarks most of the time Java and Python have really close results, tough they loose to C/C++ most of the time it's cpu-time wich shows the later true value.

2 - Nasa, ESA, Cern, Fermilab and many other use Java, but then again it depends on what environment/system/project you are working. We will never see a rocket system with Java, probably.

>> No.4852272

>Perl
>Python
>C
>C++
>Java
>Matlab
>Mathematica

Pros & cons of each, and in what order?

>> No.4852275
File: 25 KB, 476x393, binarycode.jpg [View same] [iqdb] [saucenao] [google]
4852275

>>4852254

C/C++ is a lot easier to learn than retards ruined on other languages make it out to be

>> No.4852279

C if you're hardcore
C# if you're a casual
(C# is probably better, more forgiving)

>> No.4852281

>C++
>C quick to learn after C++
>Matlab
>Mathematica (or Maple)
>Python

>don't waste your time learning
>Perl
>Java

>> No.4852292

>>4852281
What's wrong with Perl and Java? I've heard some arguments for and against Java here already, but what about why Perl should or shouldn't be learned?

>> No.4852294

Java code :
class main{
void main(){
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
try{
>single line of code
}
catch{
try{
>single line of code
}
catch{
exit()
}
}
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
try{
>single line of code
}
catch{
}
>20 lines of code to print out results
}}

C++ code:

void main(){
>10 lines of code
if(<span class="math">[/spoiler]>single line of code<span class="math">[/spoiler] < 0) exit(-1);
cout<<"These are the results:"<<results<<endl;
return;
}

>> No.4852300

>>4852294
>implying saging does anything on /sci/

>> No.4852306

>>4852272
>Python
Pro: Lightning speed coding time, very easy to read and learn, tons and tons of available packages for just about everything you could wanna do (including scientific computing). Free!
Cons: Interpreted, so it's slow running. Not good for simulations or very hefty computation.

>C
Pros: Lots of control over the memory and low level aspects of your machine. Compiled, so it's extremely efficient and executes quickly.
Cons: Hard to write code in. The lack of interpreter makes it hard to implement certain things like genetic programming. Memory management is not automatic. Not object oriented.

>C++
See C. Changes: Object oriented, so it's easier to write full scale software. Slightly less efficient and omfg too many files.

>Java
Pros: Will work on just about every single machine you bring the software to with no additional effort. Good to learn on.
Cons: Runs on a virtual machine but writes like a compiled language. Doesn't code as fast as python, doesn't execute as fast as C.

>Matlab
Pros: Interpreted, but uses C DLLs to optimize certain common mathematical operations. Just about every lab on the planet uses this.
Cons: Not compiled, so some operations are a little slow. Uglier than python. Costs money, and getting libraries costs more money.


I do most of my programming in Python, but I do use matlab and C++ occasionally. I've also used R before, which is a great language if you have to do a lot of statistical processes (which is why bioinformaticians love it so much).

>> No.4852311

>>4852272
Order of learning:
>>1- Python
Easy to learn;
Simple implementation of data structures;
Given a week one can learn to build GUI/Websites almost as good as many "professionals"
>>2 -Java
Great documentation/books avaible
Enterprise's favorite
SDK and main IDEs are multiplatform
Main language used to learn OOP
>>3- C++/C -
Great for develop low-level, quick, resource-friendly programs/system;
Main scientific libs are written with C++, but have bridges to other languages
>> 4 - Matlab/Mathematica
Mainly used by math, but it's a great tool for any kind of calculation
Many time a differential on the CV

Perl is way to complex and easy to write programs hard to read, the only ones who activelly used it are old project maintainers.

>> No.4852319

>>4852306
That said, I advise prioritizing python or matlab, and then learning C or C++ once you're comfortable.

Learning a C language forces you to understand your computer at a low level.

>> No.4852338

>>4852306
>Java Pros: Will work on just about every single machine you bring the software to with no additional effort. Good to learn on.

Both of them are fifthly lies. Running java code from one system to another isn't always guaranteed to work. I've run into shit like that before and there is NO easy fix (compared to C which just involved inlining some functions like bzero and round to port it). Learning Java also cripples you want to start wiping the droll off your face by yourself (memory management, pointers, pass by ref/value) and teaching you where and WHERE NOT to use classes.

>Matlab Costs money
how do i shot "matlab torrent"? Also all Companies/Universities all have legal copies already bought.
>Matlab Uglier than python
No it isn't. Plus python is fucking white space sensitive.

>> No.4852340

>>4852272
>Perl
Pros: Phenomenal for (text) data processing, which is also exactly what it was designed for
Cons: Impossible to read once written. The syntax is simply that horrible.

>Python
Pros: Huge amount of libraries. Automatically gives you cross-platform support unless you go into weird OS-dependent areas
Cons: It's so slow you'll be a skeleton before your 1billion data point analysis is complete.

>C
Pros: Sort of a portable assembly language. Only beaten/rivaled in speed by Fortran.
Cons: Doesn't really offer anything in the way of language constructs, other than data types and procedural, imperative functions.

>C++
Pros: Makes object hierarchies easy to manage
Cons: Fails horribly right down to assembly level

>Java
Pros: It has a great, and extremely fast virtual machine to run your code
Cons: The language itself is terribad. It literally brings nothing new to the table.

>Matlab
Pros: I honestly can't find any; perhaps that it has a large library of functions? but all math-oriented languages have that.
Cons: It's slow as balls. The interpreter is shit. The entire language operates only on numerical data (ie. no symbolic math here!). It's ridiculously expensive, especially considering that GNU Octave have replicated something like 99% of it. And the syntax makes any sane person wanna vomit.

>Mathematica
Pros: Functional, fast and generally a good math language. It does well with data processing too; especially since version 8. Fantastic editor typesetting functionality. If you need to prototype algorithms, this is definitely the best way to do it. You can write entire papers with this thing.
Cons: Proprietary horror (and no free implementations). Does not hold to typical functional language jargon, making it hard to transition into from more conventional functional languages like Lisp or Haskell.

>> No.4852352

>>4852338
You must have had a shitty teacher.
And the JVM code is pretty much completely portable, assuming you're not trying to run it on like fucking JRE 1.0

>> No.4852365

>>4852352
unless you want to run it on a open source JVM on a OS oracle doesn't support

>> No.4852381

>>4852352
> And the JVM code is pretty much completely portable
Oh really?
Can I run this code on a Z80?
What about DOS without DPMI?

>> No.4852384

>>4852365
"oh boy, this situation that comes up once every ten years sure proves my point!"
Okay. So 99.9% of the time, the JVM code is completely portable. Happy?

Also, OP doesn't need to worry about memory management or pointers, pass by ref/value, etc.

I mean, yeah it helps. And it would make him one of the hot shots in his department. But he's going into fucking research. I'm in an experimental physics lab, and I can tell you that my programming skills pretty much go to waste because we use matlab all day.

Thank god, because I fucking hate programming.

>> No.4852389

>>4852381
Being pedantic does not make you smart, it just makes you autistic.
Seriously, shut up and let the adults have a conversation.

>> No.4852393

>>4852389
Is there an argument somewhere in there, ``faggot''?

>> No.4852407

>>4852393
You're right, sorry. Here's my argument:
"you're a useless sack of shit, and are violating global rule #2"

>> No.4852417

>>4852407
https://en.wikipedia.org/wiki/Ad_hominem

>> No.4852436

>>4852338
Not all programming (or programmers) requires manual memory management or even neat implementation. As I'm sure you know, a lot of programming is creating a run-and-done script that bypasses menial data re-representation or parses something in some way.

Sure, universities may have vanilla matlab installed, but individual labs are responsible for purchasing licenses to specific libraries (with precious grant money). A lot of this is totally bypassed by using a language like python or R.

>> No.4852665

Common Lisp
Scheme
Haskell

>> No.4852854

If it ain't Lisp, it's crap. Lisp is shit.
Regard /prog/

>> No.4852950

C or nothing, lisp is shit, scheme is shit, java is shit, english is shit, C is shit

>> No.4852961
File: 11 KB, 200x235, 50414_2222719992_1247_n.jpg [View same] [iqdb] [saucenao] [google]
4852961

>mfw arguing over which language is better is meaningless when you take into consideration that good programmers memorize tens of languages

>> No.4852996

>>4852294
>void main

>> No.4853088

>>4852950
Go away summer

>> No.4853271

>>4853088
/polecat kebabs/

>> No.4854160

You're all fucking idiots

>> No.4854202

>>4852128
This

There's a disturbing lack of FORTRAN on here. Python is going to be the next widely used interpreted scientific language, but it also doesn't get much more basic than FORTRAN in the sciences.

>> No.4854206

ladder logic

/thread

>> No.4854233
File: 165 KB, 500x500, bearded vulture 2.jpg [View same] [iqdb] [saucenao] [google]
4854233

Depends which science. In physics, you'll find that Fortran and C/C++ are the standards, with a number of research groups moving to Java to improve development times. I know of one group which uses Haskell.

Basically everyone should learn R.

Python's overrated. Anything you can do in it, you can do better in some other language. The only advantage is that it's pretty flexible in terms of available libraries.

My group uses Fortran. I tend to use LISP for most things that don't need to be shared with others in the group, do processing and file conversions in Perl, and build anything that requires graphics in Java. R for stats, Octave and Maple for mathy bits, C++ for quick and dirty test code. Currently working on porting our data to a relational database instead of flat files, so it's been a fair bit of SQL and PHP lately, but this is probably atypical.

I recommend C++ as a place to start because it'll give you a more solid foundation for learning other languages than starting with any other will. You want to be doing things object-oriented and functionally. Get Stroustrup's book... it not only teaches the languages, but explains the design decisions behind it, which is something you will not get anywhere else. Next go to some flavour of LISP, and then you're ready to see why Python and Fortran are such shit languages.

>> No.4854626

>>4852103
I hate these threads. Just when I'm sure I've headed off on the correct learnings curve, someone else puts doubts in my mind and I think I'm wasting time.

>> No.4854643

C++

Bit of a learning curve for a newbie at programming, but once you get it down you can fly through any other language. I went this route and remember pulling my hair out in the beginning due to having absolutely 0 programming experience but have no regrets now. After a baptism by fire everything else is just tweaking what you already know rather than learning a whole new level.

>> No.4854645

Haskell
Matlab
Mathematica
R
C
C++
Python
Java
Fortran
Lisp
Perl

>> No.4854737

>>4854645
If someone were to learn all of those, what order would they do it in?

>> No.4854943

>>4854737
Cluster them into language groups, such that you have
>Haskell, Mathematica, Lisp
in one group, and the rest in the other. Now it's just a question of finding out the two "best" ones to learn in each group. The rest will then come naturally. I suggest you go with C from the imperative group and Haskell from the functional. I'd say Lisp, but Haskell being lazy makes it a serious exercise for most people; I mean it really takes you back to school.

>> No.4856187

Bump

>> No.4856896

>>4856187
Agreed

>> No.4856925

>>4852340
>The entire language operates only on numerical data (ie. no symbolic math here!).
...except for the Symbolic Math Toolbox and MuPAD. Not that either is great (they are ridiculously slow for anything more than simple manipulations) but at least some symbolic manipulation is possible


>And the syntax makes any sane person wanna vomit.
I'll admit I prefer many other languages to MATLAB simply because it seems to be full of "gotchas" that vary from builtin function to builtin function, and the whole global namespace thing kinda sucks, but I've never understood the immense hatred so many academics have for MATLAB syntax. I definitely prefer it to something like Mathematica.


I would recommend learning MATLAB and C because they are so ubiquitous, and Python because it's so useful. If performance ever becomes an issue with MATLAB, you can optimize by compiling it to C code (if you've got MATLAB Compiler or MATLAB Coder). I think you can do the same with Python, but I don't have experience with it.

>> No.4858296

So C vs. C++?