« first day (161 days earlier)      last day (3052 days later) » 
00:00 - 20:0020:00 - 00:00

12:12 AM
Good night, all
 
Good night!
 
Night.
 
Bedtime indeed.
Thoughtful guy, that Déak
 
(almost:D)
I have two ás
 
ándrás deak
there you go
now I'm off to bed :P
 
12:15 AM
good night to the sleep folks
 
12:44 AM
@TroyHaskin @AndrasDeak I sent it...
Thanks for your help!!!
I will go to sleep now.. and tomorrow we will talk about something else ;)
Good night!!!
 
Night. Be well.
 
1:26 AM
7
Q: Calculate the Arithmetic–Geometric Mean

MaltysenThis question was inspired by this HNQ. The Arithmetic–Geometric Mean of two numbers is defined as the number that repeatedly taking the arithmetic and geometric means converges to. Your task is to find this number after some n iterations. Clarifications You take three numbers, a, b, n in any...

MATL: 13 bytes
ii:"tYmwpX^h]
Example:
>> matl ii:"tYmwpX^h]
> [24 6]
> 2
13.5      13.4164
(Please note there's a new version of the compiler and spec at Esolangs)
 
Nice changes, a do while is nice
 
I always missed that in Matlab
 
and conditional break!
 
I feel like most breaks are preceded by if
so that saves some bytes
It's if (...) break; end, in a single statement
 
Yep
 
1:29 AM
I hope it's a good decision
Sometimes you do need if (...) [statements here] break; end
But a conditional break can be turned into non conditional by prepending T
So it's just one byte panalty there
 
1:52 AM
Yeah I think conditional break will be better more often
 
 
2 hours later…
4:12 AM
iPYOd
just a copy of Stewie Griffin's answer
 
 
5 hours later…
9:17 AM
@David DAMN YOU APPLE
I read iPod :(
 
 
2 hours later…
11:40 AM
@Adriaan keep trying, lad:P
 
 
1 hour later…
1:07 PM
@David Nice! It's good to know that MATL can beat Pyth sometimes. Oh wait, there's no Pyth answer on that one... :-)
@Adriaan Hahaha. Same here!
Hey, @rayryeng just got to 50k! Congratulations my friend!!!
 
1:23 PM
aaah this @ray, stealing our reputation!
:P congrats!
 
1:51 PM
@AnderBiguri Indeed! @rayryeng go give back your reputation to those who supported you over the years :D
 
hahaha
 
@AndrasDeak: is there a good website for public transport information in Budapest? I'm using Google Maps now, but that's not always the best around here... (it says bus 200E, Metro 3, metro 1 to out hotel)
 
2:08 PM
@AndrasDeak oh, and with lack of other plans: 15:30 at one of those coffee places seems like a good idea to me. Which one you wanted to meet? I'll write a note of it in that case. To recognise me: grey, half-long coat, beard, brown felt hat and a girlfriend (also 1m80) with blonde curls. We both probably look like lost tourists :D
 
2:39 PM
0
Q: saving the results of for loop seperately in matlab

LaluI have a set of values say A1, A2, A3....A2000. I want to perform some operation to these variables using for loop, How should I save them separately in each iteration as say B1, B2, B3...B2000? Regards,

That moment when everyone agrees
 
oh, interesting duplicate marked. I do thing that answer is much less comprehensive than mine though...
I still honestly do not understand why people would ever want to have 2000 variables named A1(...)A2000 floating around in their workspace. How's that easy to use/access/keep track of?
 
I don't like the duplicate because now the user may use eval without reading the end of the question
 
@HamtaroWarrior see the post I linked in my comment, that explains it more adequately I think
 
No, it's because they don't know there is a better way haha
@Adriaan What is lacking in your answer is cell arrays maybe. But except this, it is great
But eval should be used as less as possible..
 
@HamtaroWarrior I just updated it with a large paragraph that eval is bad :P
cells do not fit in this answer, as that was not the question
I merely added that new paragraph since I, and the others frequenting this chatroom, often use it as a pointer to say "eval bad, tree pretty!"
@LuisMendo as I only speak MATLAB, I just wrote what I got from reading other SO articles. Can you explain a wee bit about eval prediction in compiled languages, so I can add it in for completeness?
 
2:58 PM
Spear heading my new project today, yay \o/
 
@Ballbreaker who are you spearing?
 
What's your girlfriends name again?
jk ^-^
 
@Adriaan I don't know about that either. My point is that compiling cannot help, because the expression to be eval-ed may not be known at compile time. Consider for example str = input('','s'); eval(['x = rand(' str ')']);. The compiler doesn't know if str will be 3,4' or '1e3,1e3'
 
@LuisMendo I see what you mean. I think I'll just edit the compiling stuff out and perhaps revisit once I actually learn to use a compiled language. Thanks!
 
@Adriaan Welcome! Yes, if in doubt just remove that part. it's not necessary to understand the main point anyway. Nice answer!
 
3:06 PM
@LuisMendo I think it's better to use as a pointer than the one Daniel used as a duplicate, even though mine is not a duplicate. Dan's answer does not make very clear that you should try to avoid using eval at all costs
which boils down to noobs keeping on using it and asking questions about it on SO no-one is willing to answer :D
 
@Adriaan I get it, but then the question is : does the duplicate fit with the question? :P
 
@HamtaroWarrior No, since it does not tell you how to create 2000 dynamically named variables, it tells you how to evaluate them once you have them, after I shoot down the usage of eval in a paragraph or two :p
 
3:36 PM
Yo!
 
@Dev-iL Lo!
 
Yo,YO!
 
AYO
In the YAYO
 
Im volunteered for an experiment in the uni in the psicology department
I just learned the room where the experiment is performed is called "The pain lab"
wtf
 
Any of you guys knows the basics of linear regression and can tell me why this solution method with the matrix division works?
 
3:45 PM
lol never volunteer for psychology experiments
 
? Are you asking about mldivide?
the \ operator?
 
Usually you can get paid like $10-20 an hour for doing psychology experiments
(at least at my university you could)
 
yeah they pay 7£ in here
 
I did a bunch of them in my freshman year.. was interesting lol
 
@AnderBiguri I am asking why this solves the overdefined linear equation system
 
@AnderBiguri Still ... the pain lab haha
 
because that is what mldivide does
 
I usually did the sex/sexuality ones
 
it doest do matrix division
@Ballbreaker pervert :P
in this one it is required to go with someone of the opposite sex
so BDSM?
 
@Ballbreaker I'd never volunteer since psychology studies are plain bullshit, since 90% of the studies is conducted amongst students, mostly psychology freshmen. That said: there are those that require you to fill some form out in 5 mins for €10, or eat something, stick around for an hour whilst studying, then fill out another form for €25. Easy money for time you'd spent studying anyhow
 
3:49 PM
@AnderBiguri I am also asking about the addition of ones at the beginning of the LHS vector
 
When I was in Denmark, there was a farmacy department that would make test on humans. One of them was "100£ for 4 hours of your time! We will inject a neuroparalizing venom on your spine and give you an antivenom. Worst case scenario, youll be paralized for about 4 h"
WTF
@Dev-iL Tikhonov regularization, maybe
nah it doesnt look like no
@Dev-iL hum werid. Creates a Nx2 array? and then Y is Nx2 also? This is very problem dependant i guess
 
@AnderBiguri You're not helping :D
 
Im not XD
 
@Dev-iL Well, the documentation says
If A is an M-by-N matrix with M < or > N and B is a column
    vector with M components, or a matrix with several such columns,
    then X = A\B is the solution in the least squares sense to the
    under- or overdetermined system of equations A*X = B.
In the linked answer, it appears they only collapse dimensions 2 and 3 into dimension 2
and then unpack those two dimensions, right?
 
4:04 PM
@Adriaan I wanted beer money :D
 
Psychology...? :-)
 
@AnderBiguri O.O lmao. Worth it.
 
Hmmm.... What I have is a 3 dimensional array, in which every vector in dim3 is a separate "problem" that I need to solve (i.e. polyval(xVec,yMat(ind1,ind2,:),1) )... I'd love to be able to solve it with some matrix division magic instead of some ugly arrayfun, since it's a linear problem and all...
 
@LuisMendo <3 xkcd
 
@AnderBiguri I asked my coworker if he was into xkcd (he was a fellow applied physicist) and his response was : "Well.. I did go to university you know" rolls eyes
 
4:07 PM
hahahahaha
 
@Dev-iL I think it can be done. You'd probably need to create a Vandermonde matrix to formulate the linear problem
 
Hahah such a sarcastic reply , I didn't even know what to say back
 
oh wow
anyone check out the R2016a prerelease yet?
 
@excaza nope, what's so exciting about it?
 
it's like christmas :D
 
4:10 PM
Christmas came early this year? :)
 
@LuisMendo Interesting... This may be related to the ones in the vector... @AnderBiguri
P.S. A similar solution to the one I previously linked is better elaborated [here](http://www.mathworks.com/matlabcentral/answers/214656-least-square-curve-fit-for-function-y-a-x-b-1-x-c)
 
Wait, so you have a set of points and you want a quadratic function fit to it?
lots of them
In here its an inverse parabola, but shoudl be easier just with onw
 
@AnderBiguri That should prove useful :) Now I only need to do this in 3d :D
 
in 3D? so what equation are you fitting?
 
4:19 PM
hehe no no.. my data is only organized in 3d, as I have explained previously
 
so the equation, but you just need to combine diferent pairs of data, i.e. XY, XZ ,YZ ?
then it shoudl be "easy" with some fancy matrix reordering+replicating
 
Maybe post a small example? @Dev-iL
 
@LuisMendo I'll prepare something... Will post it as a question if I see it's too long
R = 0.3;
IT = 600:600:3000;
P = 0.97;
DL = R*IT.^P + 0.05*randn(size(IT));

% generate matrices:
pMAT = 0.01*randn(3)+P;
rMAT = 0.1*randn(3)+R;
dlMAT = bsxfun(@times,rMAT,bsxfun(@power,permute(IT,[3,1,2]),pMAT));
sol = cell(size(rMAT));
% regression:
for ind1 = 1:size(dlMAT,1)
  for ind2 = 1:size(dlMAT,2)
    sol{ind1,ind2} = polyfit(log(IT(:)),log(squeeze(dlMAT(ind1,ind2,:))),1);
  end
end

fittedP = cellfun(@(x)x(1),sol);
fittedR = cellfun(@(x)exp(x(2)),sol);
then fittedP estimates the unknown pMAT and the same with fittedR and rMAT
 
4:43 PM
I'm trying to find the right spelling of the word "rouse" which is another word for deception... like
Possibly distraction also.. in context "The shooting was a rouse for the bank heist happening down the street"
 
ruse
 
ah thank you
 
np :)
 
The polyfit line is equivalent to this (the Vandermonde matrix here is just a column of ones and then the data, since you have degree 1 polynomials):
flipud([ones(numel(IT),1) log(IT(:))]\log(squeeze(dlMAT(ind1,ind2,:)))).'
@Dev-iL ^^
Does that help?
 
@LuisMendo I should benchmark it with a larger matrix and get back to you :)
 
4:51 PM
@Dev-iL In one go:
([ones(numel(IT),1) log(IT(:))]\log(reshape(dlMAT,[],size(dlMAT,3)).')).'
 
ooh :D
 
I think you need fliplr to match polyfit:
fliplr(([ones(numel(IT),1) log(IT(:))]\log(reshape(dlMAT,[],size(dlMAT,3)).')).')
 
Elapsed time is 0.013139 seconds. %My method (loops + polyval)
Elapsed time is 0.005975 seconds. %Your method #1 (loops + Vandermonde)
Elapsed time is 0.000435 seconds. %Your method #2 (no loops)
 
:-D
 
now let me try it on a larger problem
 
4:54 PM
Did you check they give the same results? That does appear to be the case on my end:
>> vertcat(sol{:}) %// original approach
ans =
   0.961051590131863  -1.044572675263392
   0.971782698016096  -1.056829772635005
   0.970560166065457  -0.864091498873374
   0.964414691688648  -1.042068845907248
   0.970808369020042  -1.921980448981676
   0.964326965344530  -0.763427746217795
   0.960076608824616  -1.031136675948165
   0.964262600355872  -1.189942059686284
   0.972968144291507  -1.144038536855507
>> fliplr(([ones(numel(IT),1) log(IT(:))]\log(reshape(dlMAT,[],size(dlMAT,3)).')).')
except for last decimal, or course
 
Not yet, just benchmarking currently
umm the 2nd method doesn't scale well at all
due to squeeze I suspect
but the 3rd method is lightning-fast to compensate for it :D
 
@LuisMendo lmao I just noticed the hover-over text.. "physicists like to say that physics is to math, like sex is to masturbation" hahaha
 
@Ballbreaker Haha. Hover texts by xkcd are often very funny too
 
I'll post this as a question.. Should be a helpful test case and possibly useful to other people in the future.
@LuisMendo Would you like to post your solutions as an answer, or do I post it as CW ?
 
@Dev-iL Go ahead, post it as CW :-)
 
5:02 PM
Ok
 
Good idea to post it. It may be useful for others
 
But I will expect you to participate in the CW and explain how you came up with it :P
 
Omg hahahahah
 
@Dev-iL Hahaha. Well, as you said, it's a linear problem (linear regression). And that always can be formulated as a matrix problem, which \ (mldivide) can solve in a mean-square error sense
 
@LuisMendo When do you think Matl will be ready for PPCG?
 
5:10 PM
Lol god, reading these comics distorts my humour
 
@Ballbreaker What comics?=)
 
Me in a different chat room: "This chat room is so dead"
Another person: "Not as dead as... no, never mind"
Me: "Well it's not as dead as 100 dead babies. I know that for sure"
me: "for sure"
@flawr xkcd :)
 
@Ballbreaker Oh, just discovered it or what?
 
@Dev-iL Maybe post the general case, for arbitrary degree. In that case the Vandermonde matrix is easily built with bsxfun:
N = 1; %// degree of polynomial
VM = bsxfun(@power, log(IT(:)), 0:N); %// Vandermonde matrix
result = fliplr((VM\log(reshape(dlMAT,[],size(dlMAT,3)).')).')
and add a link to the Wikipedia article about the Vandermonde matrix. It explains it all
 
@flawr Nah, I just rediscover it frequently, and haven't read through all of them yet.. so keep finding new ones
 
5:13 PM
@flawr I expect to have it ready in a week or two. Hopefully for Christmas :-) I'm still identifying some things to be improved. What do you think?
 
@LuisMendo great idea
I'm on it
 
@Dev-iL Give me a ping here when you're done, so I can check (and upvote) the Q&A
 
lol sure :)
 
@LuisMendo Great! Well I didn't test it myself so far (busy with tons of other stuff atm) but I am really looking forward to that=)
 
@flawr If you find something missing, or something that could be improved (without totally redefining the language) just let me know. Other than the n-th prime function, that is :-) That has been included already; and your contribution and @David's duly acknowledged in the document
 
5:25 PM
Man hahahahahah this is one of my favourite xkcd's yet I think hahahaha oh man
 
@Ballbreaker :-D
This is one of my favourites
 
hahahaha
 
@LuisMendo turns out the 3rd solution results in some complex numbers
maybe randn went a bit overboard...
 
@Dev-iL Huh? Does it not give the same results as polyfit?
 
@LuisMendo It does not
Let me upload the codes for easy reference
got to run... I'll come back to this in about an hour
 
5:50 PM
Interesting, I received a downvote on this question even though I can't seem to find fault in it, other than that you might say there's lots of questions like this on SO
 
@Dev-iL They do give the same results on my end, only that method3 interchanges fR and fP
>> numEl = 4;
>> R = 5;
IT = 600:600:3000;
P = 0.97;
%// Impose some believable spatial variations:
pMAT = 0.01*randn(numEl)+P;
rMAT = 0.1*randn(numEl)+R;
%// Generate "fake" measurement data using the relation "DL = R*IT.^P"
dlMAT = bsxfun(@times,rMAT,bsxfun(@power,permute(IT,[3,1,2]),pMAT));
>>
>> [fR,fP] = method1(IT,dlMAT)
fR =
   5.035840847673053   4.901228008717469   4.960925151105796   5.031013839841227
   5.083621965322517   5.086586255748207   4.863949064149238   4.802186992633490
   4.924089972194528   4.987546614995114   5.019053075990197   5.099433735612265
 
Sure. I follow the logic against dynamic naming. It is the best solution to this problem, however, and your code works perfectly. The tabs will be fixed and only different combinations of them will be chosen. Their names however will not change. Thank you! — Mary 10 mins ago
 
@excaza flag as offensive.
I also think that Matthew might have been a bit more strong in his wording of DONT YOU FUCKING USE EVAL MORON
 
Thanks @Adriaan. No I am not familiar with the pitfalls of using eval. I leave the question open to alternatives if you have them? — Mary 4 mins ago
:D
@MatthewGunn it's also not the end of the world to use globals, that doesn't make them a good idea. — excaza 25 secs ago
my hero xD
 
6:10 PM
I see his point I just don't like the argument
 
now he has copied your solution, but used i as a variable, the nightmare continues
 
No, he's using cells
 
ah, he just my commented solution without reference, and with i as variable ;(
 
programmer fights are so nerdy
 
lovely!
he put up another solution.... might as well get rid of the eval solution in that case...
 
6:22 PM
@LuisMendo Doh. Sorry about the false alarm
 
@Dev-iL No problem at all!
 
booh, he's not taking down the eval and thinks using i as a variable is perfectly fine :(
 
@Adriaan i is perfectly fine as a variable... it's just MATLAB has stolen it ;)
stoopid nerdy math geeks
 
@beaker sister ray put like something like this once: "When you move to another country you're not forcing your habits and language on the locals; programming is the same in that aspect"
 
and as someone pointed out the other day, if you use 1i there's no problem
@Adriaan very true, too
but I can still forgive non-native English speakers for using the wrong preposition...
 
6:35 PM
and @beaker regardless of your stance towards i, eval is even unrecommended for use by MathWorks itself, see Loren's blog
@beaker I forgive your American spelling as well hon
 
@Adriaan I have no defense for eval. I think there was one instance that I've see where the use of eval was justified.
LOL
we just spell the old-fashioned way
 
@beaker it's especially interesting that he still has it up there as his top solution with a mild "not recommended", and continues to give 2? 3? other way better solutions. Might as well drop the eval, since you're not recommending it anyway
 
the way the English colonists did before Sam Johnson got ahold of the Brits ;)
 
@beaker don't the British do that? You dropped all the excessive, unspoken letters like "u", "re" to "er" etc
so in a sense your way of spelling should be more natural and to the point, especially for a non-native speaker
 
those were British affectations to make their words seem more elegant :)
they were added to the language in the 1600's
 
6:39 PM
@beaker really? Interesting. I always thought them to stem from the fact that most of your vocab is basically French (who don't pronounce their syllables either)
 
English spelling was really non-standardized up until Johnson and the other dictionary writers started up
note the number of ways that Shakespeare wrote his own name (none of them "Shakespeare")
 
@beaker ah, same with German and Luther who wrote his bible in Hoch-Deutsch
 
Chaucer wrote the same word several different ways, sometimes in the same sentence
 
@beaker I can imagine that that was the "civilised" way of writing stuff, since French was still the diplomatic elitist language (sad times), and that those educated few who standardised the written language based themselves on that
 
@Adriaan bkk.hu is the website of the transport company (we have the one), and I just found this trip planner: futar.bkk.hu/?map=13/47.501/19.053&layers=SVB
 
6:46 PM
absolutely
 
they used to use google maps
but the 200E -> metro3 -> metro 1 seems reasonable
metro 1 is really cute:)
@Adriaan cool:D My mother (...) just told me of another place nearby where she went once, and liked it a lot. We'll check out if it has a nice website, then get back to you
 
@AndrasDeak cool. Metro 1 is just 1 or 2 stops, 600m only
@AndrasDeak You listen to your mother boy!
 
@AnderBiguri haha, good to have known you:D
 
@AndrasDeak what's a "Trolley"? I use those things only in the supermarket. Are they the busses with electrical overhead wiring?
 
@Adriaan exactly (the latter)
it's trolibusz
 
6:51 PM
ah. We've got only one city which uses them
 
Russian relic
 
We planned our morning, we're going to the zoo :D
 
@Adriaan it's walking distance, probably
@Adriaan awesome!:)
 
@Adriaan Andras' house?
 
Say hi to the giraffes:P
 
6:52 PM
@AndrasDeak family of yours?
 
You guys ever read blogs?
 
@Ballbreaker books? Yes!
 
Nah, blogs
Books r for nerdz
I suppose I am a nerd then actually, I read lotsa books
 
@Ballbreaker I think we established time and time again that we're all nerds here :D
 
Anyways, this one hilarious blog I read had a line that made me spit my coffee out
 
6:55 PM
I read approximately 800 pages a week
 
It goes like this:
"Lentils are amazingly good for you - they're high in protein, fiber, B-vitamins, and zinc, and the Romans practically jacked off to them as a result."
 
@AndrasDeak can we buy some 3day public transport pass for Budapest or something, so as not to have to buy single tickets each time?
 
Won't find a beautiful line like that in a book .. hahah
 
@Adriaan yeah you should, single tickets are damned expensive
 
@AndrasDeak airport, or the bus/metro stop we change from 200E to metro 3?
 
6:58 PM
hmm...good question. There should be a ticket vending machine at the airport (you already need a ticket for the bus), but I don't know if it'll give you an n-day pass
here's this thing
72 hours
 
and do I pay everything by card, or do I get some cash to throw around?
 
either
I mean
most places are fine with cards
 
shit, 4100HUF? That's like 13€, you pay 30€ or more for that in Amsterdam :P
 
but you can never know, so have change as well
@Adriaan and that's quite expensive:P
monthly pass for adults is 10k huf
students, 3.5k or something
 
man, I'm moving there.
 
@Adriaan I think it's something like $100CAD in Toronto
 
@AndrasDeak who's the cute lass?
 
quite?
michelle trachtenberg?
 
@AndrasDeak yes, just found out. I was so flabbergasted I can't speak proper English anymore :P
 
yeah, she's quite nice
One reason to watch Buffy the Vampire Slayer:P
If you need one besides Sarah Michelle Gellar
 
7:04 PM
good thing my girlfriend ain't here :D
almost as embarrassing as getting anal emails.
 
:D
yo can practice
 
7:19 PM
@Adriaan oh yeah, that one's a real cock tease, as I believe the expression goes:D
right, @Ballbreaker?
 
@AndrasDeak all them jew girls....
I met a guy in the army who claims to be related to Michelle
 
@Dev-iL I end up with a surprising number of jewish girls lol
And I'm not even rich! go figure!
Maybe it's because of my massive pen......ny collection
I'm just going to pray you find humour in that hahaha and don't get offended
 
7:40 PM
it would be acceptable if you weren't the ideal aryan nazi archetype by appearence:P
just more of a wimp:D
 
@AndrasDeak also he should be more pro-Israel while we're at it :-P
 
7:56 PM
@AndrasDeak Yeah that's fair hahahah
I make fun of everything though, just let me have this
 
I don't offend too easily:P
Until someone says "For matlab programmers it's more familiar to use evalin and assignin"
then blood shall be shed
 
Why would that offend you? Because people are saying that matlab is programming?
:)
 
btw I'm not a matlab programmer:P
 
00:00 - 20:0020:00 - 00:00

« first day (161 days earlier)      last day (3052 days later) »