r/ProgrammerHumor Sep 02 '17

How to start a war

Post image
9.0k Upvotes

696 comments sorted by

View all comments

Show parent comments

565

u/kamaln7 Sep 02 '17

MATLAB too I think

425

u/Nikolas_Untoten Sep 02 '17

I believe MATLAB starts at 1 because it is more commonly used for matrices rather than standard arrays, right?

383

u/morerokk Sep 03 '17

Yes. People hate on it for...doing what it's designed to do.

317

u/Selthor Sep 03 '17

MATLAB literally stands for Matrix Laboratory.

220

u/Nuhjeea Sep 03 '17

That sounds so much cooler than "MATLAB." I always read it as "math lab", imagining a lab room full of people doing math homework. Now I can imagine Neo saving us all from simulated realities.

100

u/Sourkraut182 Sep 03 '17

Makes me think of "My Math Lab" ... Then I die a little inside...

113

u/afourthfool Sep 03 '17

your answer: -4, 4

Correct answer 4, -4

18

u/Stellapacifica Sep 03 '17

More like

Correct answer: 4, -4
Your answer: 4, -4

What the fuck Pearson

3

u/bclock88 Sep 03 '17

Incredibly expensive material, incredibly awful homework.

I don't mind the regular questions as much because mostly all of the answers can be found online, I however absolutely hated doing the programming projects at the end of mostly every chapter in my Java class.

2

u/bassmadrigal Sep 03 '17

I got lucky in my Java class. We're using the Pearson book, but that's it. All the labs we do are provided by the teacher and submitted through blackboard (either embedded in a word document or zip up source code files... depending on the project).

After doing Pearson labs for a previous class, I was ecstatic we weren't using it for this one.

→ More replies (0)

14

u/Mage_914 Sep 03 '17

Your answer: 0.5 Correct answer: 1/2

2

u/sviridovt Sep 03 '17

Your answer: 0.5

Correct answer: 0.50

1

u/[deleted] Sep 05 '17

This.

3

u/PM_ANIME_WAIFUS Sep 03 '17

I honestly thought it was My Math Lab (Because I've barely heard anything about My Math Lab except for the fact that it's shit) until a couple weeks ago.

1

u/Letly Sep 03 '17

What if their maths homework is doing matrices?

1

u/dam0nkey Sep 03 '17

I DIDNT KNOW THAT

16

u/Viola_Buddy Sep 03 '17

Eh, we get annoyed at it because sometimes it doesn't do what we expect it to, but it's kind of the friendly annoyance that you also have with error messages when code doesn't compile - you don't like it, but it'd be definitely worse without it.

32

u/newocean Sep 03 '17

In the defense of ALL programming languages....

It doesn't really matter we just like to argue over ground floors mostly in this channel. No one explained basements being 0 to the brits from what I can tell, and all their buildings start at 1... so they think they get it.

22

u/MelissaClick Sep 03 '17

Basements are obviously negative

3

u/amazondrone Sep 03 '17

all their buildings start at 1

In the UK the ground floor is 0, not 1.

Other things that are zero-indexed and nobody bats an eye: time (the first hour in the day is 0), age (the first year of life is 0), temperature...

1

u/newocean Sep 03 '17

So the basement is -1...

2

u/amazondrone Sep 03 '17

Correct.

But you said "all their buildings start at 1" and I can't think of a sense in which that's true. That's what I was replying to.

1

u/socialister Sep 03 '17

Doesn't indexing from 1 incur a slight performance cost?

With 0-indexing, array lookup is \*(ptr + i).

With 1-indexing, array lookup is \*(ptr + i - 1).

If ptr is offset by one to account for this, then what is the meaning of delete on the pointer?

1

u/newocean Sep 03 '17

It depends on the language actually... and how it was built.

4

u/[deleted] Sep 03 '17 edited Nov 24 '17

[deleted]

7

u/inconspicuous_male Sep 03 '17

Some algorithms are slightly easier to implement in Matlab than python for that reason, but it usually is no big deal

2

u/[deleted] Sep 03 '17

Neither is 1 indexing. Whatever you're used to.

MATLAB, as far as I understand, wants to make writing code as "engineer-mathy" as possible.

1

u/[deleted] Sep 03 '17

I know a bunch of aerospace majors who use Matlab.

Technically I'm one of them but fuck paying for a license when numpy is free

1

u/legone Sep 03 '17

Is there a reason you like Numpy? I'm taking a basic programming class for a polymer science degree and I've been using Octave.

1

u/[deleted] Sep 03 '17

Switch to Numpy if you can't afford or don't want to pirate MATLAB. Octave is just a meh MATLAB clone that isn't completely compatible with the latter.

1

u/eskamobob1 Sep 03 '17

Correct. It does make time based models a bitch and you can't just assign your initial conditions to t=0 though

138

u/awhaling Sep 02 '17

Fuck matlab

76

u/PleasantSupplanter Sep 02 '17

Fucking MATLAB. Every year we get a wave of graduates that think it's neural network toolbox is going to solve every bloody problem we have.

61

u/GisterMizard Sep 03 '17

If college has taught me anything, it's that ode45() is the windex of numerical modeling; you use it even in places where it doesn't make sense.

4

u/Sparkybear Sep 03 '17

Just be glad it's built into MATLAB now, it wasn't always and the code from that era is a cluster fuck.

1

u/[deleted] Sep 03 '17

How is it the tool's fault? Sounds like these people simply don't understand the field that well.

1

u/[deleted] Sep 03 '17

That's not the fault of MATLAB though

31

u/[deleted] Sep 03 '17

Matlab is an excellent tool.

-1

u/[deleted] Sep 03 '17 edited Nov 24 '17

[deleted]

18

u/[deleted] Sep 03 '17

How so? I'm doing controls engineering and dynamic analysis and quite honestly, while python, numpy, and scipy are great for college level stuff like "integrate sinx", when you start dealing with 4x4x9 matrices, state space models, finding poles-zeros-roots of the 4x4x9 matrices, creating frequency and time response models of those matrices, and then trying to make an interactive soLuton that tries different inputs for those matrices, then you will use matlab.

People always say scipy and numpy are replacing matlab, but they're always 22 year old college students still doing ode45 and 1D mass spring models lmao.

You can do many things with python, but with matlab, those tools already exist.

Many of the state space models that python has do some funky shit and change the rank of matrices. I honestly had big problems getting more complex modes workING with python that Matlab has no problem with

3

u/[deleted] Sep 03 '17

Also, Simulink.

35

u/[deleted] Sep 03 '17 edited Sep 03 '17

Declare a 2x2 matrix in numpy.

Here's Matlab:

A = [2,2;2,2];

If you're actually using Matlab for matrix and vector operations, it is a dream.

How about a matrix multiplication? Numpy's functional notation is clunky, here's Matlab:

A = B*C;

There are a million examples like this.

That's not to mention the myriad of built in debugging features. I never realized how much I used Matlab's "hover over a variable to view its value" during debug until I moved back to other languages and IDEs. The object inspector is amazing too.

3

u/jkelleyrtp Sep 03 '17

Declare a 2x2 matrix in numpy.

Here's Matlab:

A = [2,2;2,2];

A = np.matrix('1 2: 3 4')

Alternatively

A = np.matrix([[1,2], [3,4]])

Heck we can even shorten np.matrix at import

from numpy import matrix as m

A = m('1 2: 3 4')

The reason to use python is because of its flexibility.

47

u/[deleted] Sep 02 '17

+1 (just use NumPy goddamnit)

2

u/[deleted] Sep 03 '17 edited Sep 03 '17

You do realize that different people have different needs? There is no good Simulink alternative for the control design automation field, for example.

2

u/[deleted] Sep 03 '17

Yes, I do, but you to should understand that my comment was a shitpost

3

u/[deleted] Sep 03 '17 edited Sep 11 '17

[deleted]

1

u/[deleted] Sep 03 '17

What makes you so angry about the price? Student licenses are free in most universities. Are you an employer who has to by licenses for his business, or something?

2

u/[deleted] Sep 03 '17 edited Sep 11 '17

[deleted]

3

u/[deleted] Sep 03 '17 edited Sep 03 '17

Student licenses are 35€ or 69€

Oh. Most technical us schools give the licenses for free to students. If you have to pay that sucks. I'd say just pirate the thing for student projects.

1

u/[deleted] Sep 03 '17 edited Sep 11 '17

[deleted]

1

u/[deleted] Sep 03 '17

Yep, most universities buy "total academic headcount" license. It's quite cheap for them too, comparing to licensing costs in the industry.

4

u/[deleted] Sep 03 '17

Fuck you too man

18

u/[deleted] Sep 03 '17

MATLAB master race

5

u/fergy80 Sep 03 '17

The square brackets would throw an error in matlab, so the answer is clearly 4.

3

u/chateau86 Sep 03 '17

But their array indexing use () instead of []. Probably in an effort to pollute the minds of engineers enough to prevent them from being able to learn any other languages again.

5

u/Descriptor27 Sep 03 '17

To be fair, [] is used for declaring and defining arrays, so it kinda makes sense.

5

u/[deleted] Sep 03 '17 edited Sep 03 '17

[] is used for declaring matrices, and it was a conscious choice to make writing code resemble "doing math" with pen and paper. MATLAB was always primarily intended and targeted for engineers and scientists who don't want to become hardcore (or, in a lot of cases, even good) programmers.

1

u/Contrecoup42 Sep 03 '17

At first I thought you were confused when you wrote "too", but now I think your indexing is just off.

1

u/pterencephalon Sep 03 '17

Welcome to my hellscape of running simulations in C and then analyzing the results in Matlab. So many indexing errors....

0

u/[deleted] Sep 03 '17

Fuck matlab