« first day (2365 days earlier)      last day (2567 days later) » 

4:01 PM
@BernardoMeurer there's a couple of approaches. I would probably read the whole file into a character array in on block, then step through the array changing the '\n' to '\0' and storing the offset to the start of each word in a separate array.
 
@JohnRennie Can't I just do fread or something?
 
Ah well
Let's edit it
 
@BernardoMeurer yes. Get the file size, allocate an array that size +1 and fread the whole file into your array.
Then tack on '\0'
 
Wait
it was tex'd
But
The bracket notation has < instead of langle
Seems a bit flimsy to edit
 
Ooh, ooh, my advance copy of Borne by Jeff VanderMeer has just arrived.
That's tonight's reading sorted then :-)
 
4:05 PM
FILE *wordlist = fopen(argv[1], "r");
fseek(wordlist, 0, SEEK_END);
long size = ftell(wordlist);
fseek(wordlist, 0, SEEK_SET);
@JohnRennie Then I malloc with size+1?
 
@BernardoMeurer Can't you just stat the file to get the size?
 
@JohnRennie Not portable, that only works on POSIX compliant os's
 
stat will work on every OS that supports the C run time libraries. It even works on Windows for god's sake!
But, yes, you can calculate the size by seeking to the end of the file.
 
@JohnRennie Hmm? Isn't stat from sys/stat.h?
 
Everything supports that.
 
4:09 PM
I'm not betting my horses on that kind of lib :P
I will use the stdlib, it's safer
 
OK :-) Your method is fine. Get the size, malloc that size + 1 and fread the whole file into it.
 
@JohnRennie Hmm, but then I won't be able to reference this with array syntax, will I?
words[0] and so on
 
Allocate an array of *char called words and set each member of the array to the address of the start of the word. So words[1] is a *char pointing to the start of the second word, and so on.
 
Wait, let me process this
So the same old array of pointers :P
Can't I
Hmm
 
It's not hard. Allocate an array called raw_data or whatever, then allocate a second array called words.
Then words[0] = array, words[1] = array+n where n is the offset to the second word and so on.
The only thing is you won't know in advance how many words there are. But you can always parse the raw_data array twice, the first time to get the number of words in it.
 
4:17 PM
Hmm
I think I'm better offloading this into a function
 
"The probability model of quantum mechanics is different from the Kolmogorov model, is due to von Neumann, and actually predates the Kolmogorov model."
Dammit :V
Why does everything have to be so cryptic
 
@JohnRennie Brr, what a PITA exercise
 
@BernardoMeurer this sort of thing is quite common though. In Windows you'd use a memory mapped file, which automatically treats the whole file as an array.
i.e. maps the file into memory.
 
Meh, I hate file handling in C
it's bad enough in C++
 
Files are plenty easy in C
 
4:32 PM
@Slereah How would you do this then
I have a file with one word per line
I want to load this file into an array words[], each cell of the array has a word in it.
 
Make a char* buffer, read the file char by char, copy the buffer into a new char* when you encounter a newline
 
@Slereah But the the memory holding each word won't be dynamically allocated will it?
 
That's why you use a buffer
Make it large so that it's unlikely to overflow
Then you can create a new char array of the appropriate size to put in the array
 
@Slereah I can just count the size of the file and allocate accordingly, no?
 
Well, if you're worried, you can do a first scan, calculate the size of the largest word, and allocate appropriately
 
4:40 PM
    fseek(wordfile, 0, SEEK_END);
    *length = (int)ftell(wordfile);
    fseek(wordfile, 0, SEEK_SET);


    char *buffer = malloc((size_t)length);
 
Then just give the buffer that size
 
@Slereah Why not just that?
 
Making the buffer the size of the whole file is a bit much, maybe
 
@Slereah Why? It's just a txt file, the buffer will have all of it in it, no?
 
The buffer is to put a single word in
Then you can copy the buffer into the appropriate string of fixed size
 
4:41 PM
If you're not comfortable with allocating a big, static chunk of memory, another solution would be to implement a linked list structure for each word that grows appropriately until the word ends
 
@JaimeGallego That still involves caching the whole file into memory
Unless I did some trick with gets
 
$\mathfrak o$
$\mathfrak v$
why does that one look like an o with a trump haircut
 
in The Periodic Table, 3 mins ago, by CowperKettle
> Why do you drink vodka?
Because it is liquid. If it were solid, I would have gnawed on it.
 
DON'T ever use gets
 
Anonymous
@paracetamol And if it were a gas?
 
4:47 PM
@BernardoMeurer You can also build a growable array structure, that allows writes in O(1) time on average (though any particular write may be O(n)).
It's not hard, but is more complexity than a simple project justifies.
 
@blue Breathe
 
@JaimeGallego Why not? I use gets sometimes, it's alright
 
As a side effect you get 'array' bounds checking automatically.
But you must not access it with the [] operator.
 
Read the manpage
 
@dmckee I'm going to read the file into a buffer, an
 
4:49 PM
@BernardoMeurer If you are on linux (and this is not an assignment that disallows such APIs) it is faster to memory map the file.
 
For heavens sake people go easy with the flagging. That was a joke.
 
@JohnRennie Then a mod can unban him, no?
 
@JohnRennie Still...not an appropriate thing to another user if someone takes offense. Alas, I would have preferred the flagger voiced their offense instead of immediately flagging.
 
4:51 PM
@BernardoMeurer gets really is broken for almost all uses. getline is in POSIX and is much better.
(And it uses that growable array trick under the hood, come to think of it.)
 
@0celouvskyopoulos It depends on who flagged. Mods will generally not undo bans imposed by other mods as a mark of mutual respect. If it was jut 10K users then an ameanable mod may be prepared to lift the ban.
But Bernardo's comment was a bit close to the edge.
 
Hmm, what does linear growth mean on a manifold?
 
I did not take offense on what Bernardo said.
 
Probably $Hf=0$.
@JaimeGallego Other people might have.
 
Well, someone flagged it. I would not have flagged it or acted on it because it was rather obviously meant as a joke, and I'd be interested in hearing the flagger's perspective here.
 
4:56 PM
So is there any fundamental difference between the Kolmogorov probability and the von Neumann one
According to one site, it is
THE BELL INEQUALITY
Is that correct
 
Hello back
Thanks @mods
 
Back from the dead!!! :-)
 
@BernardoMeurer You can talk again, but apparently you should watch your language a bit more.
 
@ACuriousMind I don't think we should be threatening people with physical violence in chat.
 
@ACuriousMind I will try not to threaten people with violence
 
4:57 PM
@BernardoMeurer Thank you.
 
I will threaten u all
With my rippling musculature
 
@0celouvskyopoulos And you feel you don't know Bernardo well enough to politely ask him to not do that instead of flagging?
 
@dmckee @JaimeGallego Come to think of it, that was bad language, when I said "some gets trickery" I meant something from the gets "family" of functions
 
^ inappropriate
It has been made very clear that accusations of trolling go agains the Be Nice policy.
@BernardoMeurer Please remove that.
 
1 message moved to Trash
 
4:59 PM
@ACuriousMind So, after Morte and Fall from Grace
Who will be your next avatar
 
Settle down children
2
 
@0celouvskyopoulos Go back to your cave
 
Will it be Nordom
 
@BernardoMeurer What does that even mean?
 
Will it be Ignus
 
5:00 PM
Anyone here have experience with PBS Professional?
 
@0celouvskyopoulos Plato reference, probably
 
@Slereah I was Ignus already, that's where ocelot's idea of me being Alicia Keys comes from :P
 
@JohnRennie Alright, so back at, it, what's the best way of doing this?
 
user228700
Pretty sure there are at least 10 ghosts in my vicinity at the moment :-/
 
Should I load it all into a buffer
count the number of words as the number of \n
 
5:01 PM
@Kaumudi.H why? What's happening?
 
@Slereah I can't remember exactly, but I think I also used Nordom for a while
 
What the hell, why am I having such a hard time with such a silly thing
 
user228700
@JohnRennie Oh, nothing at all. I just happen to be inside a forest (at night).
 
@Kaumudi.H remember what happened to Red Riding Hood!
If you see any grandmothers then run away fast. No, hang on ...
 
user228700
@JohnRennie Ah, u'd make a fine grandpa indeed!
 
5:02 PM
what does that mean?
 
Anonymous
@Kaumudi.H Look back. You might see someone following you ;).....
 
The Lie algebra of a Lie group is the tangent space at the identity element
 
user228700
@blue Nah, I'm on the front porch; the house is behind me :-P
 
Then you can regain the whole group via the exponential map
So basically they are vectors
 
@BernardoMeurer: reading in the whole file is always a bit risky unless you're sure it's always small enough to fit in memory. But in this case I don't see what the alternative is. If you want an array of words they'll all be in memory anyway.
 
5:04 PM
yeah, but what do they mean by "SL seen as an abelian vector group"?
it is most certainly not an abelian vector group
 
Anonymous
@Kaumudi.H Your eyes are deceiving you :P Have a nice time with the ghosts.....
 
@BernardoMeurer: if you're going to read the whole file into memory anyway the quickest and simplest method is the one I described. It's one malloc and one file I/O operation for the whole data.
 
user228700
@blue :-/ Thanks(?)
 
Anonymous
Good time to watch Conjuring 2 actually :D
 
5:06 PM
@BernardoMeurer How are you going to use the array words? Depending on what the operations you are going to perform are, there might be more exotic ways to store the data
 
user228700
@blue No, no, I'm good.
 
How... how does wavefunction collapse work for formalisms without wavefunctions
How do you perform a wavefunction collapse on a path integral
 
@Kaumudi.H that's what they always say in the horror films just before the giant spider with the dripping fangs attacks!
 
@AccidentalFourierTransform It sounds like total non-sense to me, where did you get that from?
 
user228700
5:07 PM
@JohnRennie -_- Thanks.
 
Don't worry though, the giant spider is no danger.
The giant rat ate it! :-)
 
>product of a group and an algebra
what
 
right lol
didnt notice that one
 
Yeah i'm not sure what that's about
Maybe $\mathfrak{sl}$ is also a group?
I dunno
 
5:10 PM
I think they explained the notation before
 
user228700
@JohnRennie I'm not scared of giant animals (other than snakes!). I'm afraid of the quintessential lady in the wide dress.
 
I kinda hate products on math structures because they're always a bit ambiguous
 
@Kaumudi.H lady in the wide dress?
 
You don't know how much structure the product means
 
5:11 PM
@AccidentalFourierTransform Ohhhhh
I know what they mean
 
Do tell us!
 
user228700
@JohnRennie Yes. Around here, a ghost is represented by a lady in a white dress with anklets on that alert you when she comes around to eff with you.
 
user228700
A White Lady is a type of female ghost dressed in all white reportedly seen in rural areas and associated with some local legend of tragedy. While White Lady legends are found in many countries around the world, they are most prominent in parts of the United States, Ireland and Great Britain. Most famous is the lady in white in Rochester New York. Common to many of these legends is the theme of loss of a daughter or betrayal of a husband, boyfriend or fiancé. == White Ladies in different parts of the world == === United Kingdom === In popular medieval legend, a White Lady is fabled to a...
 
user228700
Huh. You should be knowing about this...
 
5:13 PM
@Kaumudi.H if a ghost appears just start explaining electrodynamics to it and it will flee in terror.
 
@JohnRennie Okay, i think I'm closer now
 
user228700
@JohnRennie Hehe, alright! x'D I'll tell u if it works.
 
@AccidentalFourierTransform We have $\mathfrak{sl}(2,\mathbb{R}) = \mathbb{R}^3$ as vector spaces. Now, the action of the $\mathrm{SL}(2,\mathbb{R})$ in that semidirect product on the $\mathbb{R}^3$ is precisely such as if the components of the $\mathbb{R}^3$-vector were the coefficients of the standard basis of $\mathfrak{sl}(2,\mathbb{R})$ and the SL were acting by the adjoint action
 
FILE *wordfile = fopen(path, "r");
    //Count lines in file
    int ch, lines = 0;
    do {
        ch = fgetc(wordfile);
        if (ch == '\n' || ch == '\0') ++lines;
    } while (ch != EOF);
    rewind(wordfile);
    //Get file size
    fseek(wordfile, 0, SEEK_END);
    *length = (int) ftell(wordfile);
    rewind(wordfile);
    //Allocate array
    char **words = calloc(lines, sizeof(char*));
    if(words == NULL) catchError("Memory allocation failed");
    for(int i = 0; i < lines; ++i){
        words[i] =
@JohnRennie Now I gotta figure out how to allocate the words with the right size
so I can use getline() after
 
@ACuriousMind hmm but what is the addition rule on $\mathfrak{sl}(2,\mathbb R)$?
how is it even defined?
 
5:15 PM
Ah!
I don't need to!
 
@AccidentalFourierTransform Every Lie algebra is a vector space, no?
 
getline allocates it!
beauty
 
how do you add two $\mathfrak{sl}$ vectors? and what is the multiplication by scalar?
oh fuck
yes, I was being stupid
 
You just add them. The reason why the algebra is easier than the group is precisely that it's a vector space :P
 
Anonymous
@Kaumudi.H These ghosts should start wearing colorful dresses. White dress ghosts are too common. Ugh, these ghosts have no dressing sense. If you spot one lend them a dress or two :P
 
Anonymous
5:16 PM
Also feed them well
 
Anonymous
They must be hungry
 
yes, I was thinking that given $a,b\in\mathrm{GL}$, $a+b$ need not be in $\mathrm{GL}$. But its about the algebra, not the group :: facepalm ::
thanks!
 
@BernardoMeurer is getline in C?
 
user228700
@blue I agree! x'D I'll try...if I get the chance before they go into my body/laugh etc. (Jesus Christ, their laugh scares the crap out of me)
 
@JohnRennie yes
I hope
Yes
 
5:17 PM
did u remember to thank Muḥammad ibn Mūsā al-Khwārizmī for inventing algebra
 
@AccidentalFourierTransform Still, that section is written rather weirdly, it could have been expressed a lot better.
 
user228700
Yeah, no, I should stop talking about them :-P I really am in the middle of a forest.
 
Hi, everybody.
 
Hey @DanielSank
 
user228700
Yello!
 
5:18 PM
I'm afraid I'll have to read a bit of your thesis
 
@BernardoMeurer ah yes, it is.
 
15 mins ago, by AccidentalFourierTransform
user image
 
Apparently there's some quantum measurement stuff in it!
 
@Slereah Why afraid?
 
$\mathfrak{ls}$ is the abelian vector group, not $\mathrm{SL}$
 
5:18 PM
@Slereah Perhaps. What exactly are you looking for?
 
There might be ghosts in it
@DanielSank What the hell a measurement is
What count as a measurement for quantum systems
 
The measurement stuff in my thesis is somewhat "engineeringy". If you are interested in more quantumy things, I can direct you to interesting resources.
@Slereah Ah.
 
Is it any interaction between the two systems?
Something that make an entanglement develop?
 
@Slereah No.
You need entanglement.
 
What interaction produces no entanglement?
 
5:19 PM
(which usually, but not always, happens when you couple things)
@Slereah Well, lots of couplings lead to periodic motion, so there are, for example, times when the entanglement is zero.
 
for instance, take two static charges moving through spacetime
 
In general, coupling --> entanglement.
 
Do they get entangled once they enter into each other's light cones?
 
I am tired of people saying "maximum principle" and then writing some insane inequality
 
@Slereah Ufff, relativity...
I dunno, probably.
 
5:21 PM
Why do you care about the maximum principle anyway, doesn't it involve the axiom of choice?
Yeah a lot of my questions involve relativity and QFT :p
 
@Slereah wot
 
A lot of quantum measurement stuff is with point particles
 
I am unfortunately poorly trained in relativity.
 
@0celouvskyopoulos Oh wait, was thinking of another maximum thing
 
according to recent conversations, you only need to know that $\mathrm ds^2=-\mathrm dt^2+\mathrm d\boldsymbol x^2$
 
5:23 PM
Also a lot of measurement stuff involves splitting the Hilbert space in twain
 
it's magic!
 
Since you consider products of wavefunctions for the whole system
but I'm not sure that works out so great in QFT
Also I'm not sure how the wavefunction collapses work with relativity
Does that work with any spacelike foliation???
 
@Slereah I have no idea and my thesis won't help.
My thesis tells you how to measure a superconducting qubit really fast and with reasonably high accuracy.
I didn't go into this kind of stuff at all.
 
yeah it's pretty hard to find for some reason
 
I'm convinced people write papers to be purposefully obfuscatory.
 
5:28 PM
A lot of measurement stuff is only for non-relativistic QM
 
@0celouvskyopoulos Some times.
@Slereah Yeah because the really good experiments are all in that domain.
 
Or if it's for QFT as well, it does not really explain well how it's supposed to work there
@DanielSank Probably!
 
One of the delights of superconducting qubits is that you can do really good experiments on exactly what happens when you measure.
 
But I'm sure there's plenty of gedanke experiments you can do with it
at least
 
There was recent work with simultaneously measuring $\sigma_x$ and $\sigma_z$ on a two level quantum system.
@Slereah Oh, for that kind of thing, look up Bell violation papers.
That's a case where people care about space-time separation and all that business.
In fact, I will ask my colleague, who did a famous Bell violation, for references.
 
5:30 PM
thx
 
IIRC, DeWitt does some analysis on quantum measurements in his book
 
I'm also curious to know how it's supposed to work for fields, too
 
and the book is about (general) relativistic qm
 
How do you pick an "observer" in a field?
Technically it fills the entire space
or a system, really
It's fairly simple in QM since it's just a point particle and the total system is just a product, but conceptually it seems harder in QFT
 
@Slereah I have indicated your plight to Dr. Marissa Giustina.
Now I must go.
 
5:33 PM
Thx
Later
 
Adieu
 
tips hat
 
If we take a machine and an electron
They are both technically part of the same Hilbert space of electrons
Can you split it to make sense of the tensor product usually used?
 
@JohnRennie Here's a nice one, I have a char array containing a string terminated with a newline
How do I remove that trailing newline?
I was thinking of doing a realloc with size-1
 
5:36 PM
Replace the newline with \0
 
Then my array is larger than necessary
 
hey guys. good evening! i've a question. i wanted to calculate the partition function of the hydrogen atom but it diverges. wtf is this?
 
your body is larger than necessary
@mathvc_ QFT?
also via what process
Path integral or operators
 
statistical mechanics not in QFT
 
Oh
then I don't know
 
5:38 PM
\sum exp^{\beta E_0/n^2} diverges
it's actually \sum n^2 exp^{\beta E_0/n^2}
 
10
Q: Partition function of a hydrogen gas

Boy SimoneHi I have a doubt (I'm not very expert in statistical mechanics, so sorry for this question). We consider a gas of hydrogen atoms with no interactions between them. The partition function is: $$ Z=\frac{Z_s^N}{N!} $$ where $Z_s$ is the partition function of one atom. So we write $$ Z_s =Tr\{e^...

@mathvc_ ^
 
Hmm
I can't directly apply the maximum principle
The maximum could be at infinity
 
@AccidentalFourierTransform hmm it has introduced a revised partition function but i guess i can always find a system (maybe with ridiculous energy levels) that its partition function diverges.
 
The one I was thinking about was Hausdorff's maximal principle, btw
which is ~ AC
 
6:04 PM
Ah
I've needed that before
For the ol Besicovich covering lemma
 
obviously wrong, since it uses the axiom of choice
 
those 1900s covering lemmas are pretty magical
 
6:34 PM
spectral density functions, mass has a continuum of states after $2m$ because of relative momenta not contributing to overall momentum, PS 7.1, Sred sec 5. Yeah that makes sense, but how do you see it mathematically?
 
@blue Remember me!
 
Anonymous
@Utkarshfutous Ah yes
 
Anonymous
What's up ? :)
 
My training on web development has started
Once I can do a website alright I should make a little server
Put all the science papers on it
and make a lil site for it
Database of GR stuff
 
hello all
 
6:49 PM
hey
 
For Thomson scattering, do I need to worry about the retarded position vector?
i.e., for $\vec{r}$ do I use regular old $\vec{r}$ or do I use $\vec{r}-\vec{w(t_r)}$?
 
@0celouvskyopoulos what's the fancy formula for a wavefunction being $\sum \alpha_i \psi_i$ for the eigenvalue of an observable
 

« first day (2365 days earlier)      last day (2567 days later) »