« first day (360 days earlier)      last day (4425 days later) » 

04:09
When I find the last message here is something like The last message was posted 5 hours ago. I feel like a motherless child
 
2 hours later…
06:03
@LeonidShifrin Yeah, makes sense and I agree
@LeonidShifrin I went for a Hold-ReleaseHold solution
@LeonidShifrin You want another weird buggy observation? Check the ordering of definitions like f[]/;la:=1;f[]:=2;g[]:=2;g[]/;la:=1;h/;la:=1;h:=2;Information /@ {"f", "g", "h"};
f, and hs buggy/weird reordering lead me to use definitions like f[] /; True := 2
g's definitions were pasted wrongly, it's supposed to say g[Blank[]]
 
2 hours later…
08:31
@image_doctor I think you should stop wasting your time improving user #4988's questions. He never bothers to format them correctly and he apparently refuses to Accept any answers either.
09:16
@Rojo Yep. I was aware of this particular one, was bitten by it a few times in the past. Somehow I think that this behavior is unlikely to change, though. Too bad.
 
1 hour later…
10:25
@Mr.Wizard Just as an aside note, he and his pal (user #4972) share too many interests and behaviors (including the date "they" started using the site)
10:41
@belisarius Thanks, I'll look into that.
@Mr.Wizard It was just a question about Dynamic vars that made me think about it as I dropped by the two of them in a row
@belisarius Same class perhaps?
@Mr.Wizard Yeah, may be
and same bad attitude
Unfortunately so.
11:19
@Mr.Wizard You around
?
Yes.
@belisarius
@Mr.Wizard A good joke: a few statisticians discussing why conditional probability makes sense. Here:
(our friend whuber among them)
2
Q: Mathematical basis for conditional probability

JonesTheAstronomerIn order to get more fundamental in my understanding of probability I watched mathematicalmonk's lectures involving $\sigma$-algebras etc. - good. One of my main concerns was to better understand the basis for conditional probability: $P[A|B] = P[AB]/P[B]$. My question is simple How do we know...

Okay, let me look.
It all starts with a naive question :)
@Rojo both of your examples are quite surprising to me. Your test cases are so simple that it makes me wonder why we don't encounter problems all the time.
@Ajasja this is a nice idea. Which post did you have in mind? Visual C++ or MinGW-w64? The problem with the latter is that I have to advocate modifying the Mathematica source code, which is against the licence terms and may or may not be legally enforceable depending on the user's locale. On the other hand it is a common problem with a solution that is not that easy to express in the question and answer format, and I would like to contribute something to the blog.
11:27
@OleksandrR. What am I supposed to notice there?
@Mr.Wizard in what?
@OleksandrR. The comment you linked to; the f[], g[], h thing.
@Oleksandr Hello?
11:49
@Mr.Wizard sorry, I went into the lab
No problem. :-)
Anyway, usually one would expect rules with Condition attached to be ordered first. But as Rojo's example shows, whether this is actually done seems to depend on the exact pattern.
Incidentally, this behavior is the same at least since version 5.2, despite the changes in rule ordering made in version 6.
Okay, thanks. That is indeed interesting.
@Oleksandr Are you aware of any method to change the background of an existing SparseArray, besides extracting and substituting its parameters with replacement rules?
@Mr.Wizard good question. I had looked at this a couple of days ago actually and wasn't able to come up with anything.
@OleksandrR. Do you mean besides extracting parameters or not at all? I've got a method that works, just not well.
11:59
@Mr.Wizard yes I mean beside extracting the parameters. Since SparseArrays are atomic one would obviously prefer not to have to decompose them into an expression and then rebuild from scratch.
Okay, that's what I mean. I was hoping you knew some Internal` function that set it directly.
Hmm. Okay. Apparently just adding or subtracting a constant from a SparseArray does change the background. I had never realised this before but it does seem to work.
Of course one then has the problem that the non-background entries are also changed.
I was aware of that, but as you note the change to all elements is a problem. Do you know what SparseArray`SparseArrayOp does by any chance?
No idea, sorry. Does not seem to be any easy way to find out what arguments it expects.
@Mr.Wizard apparently e.g. SparseArray`SparseArrayOp[Plus, sa, 1] is the same as sa + 1. But again who knows what operations are allowed.
12:16
@OleksandrR. Nice work. :-) I found something that could be described as a bug, but perhaps it may be useful in some way too. Give me a couple of minutes to put my thoughts together.
Consider:
In[1]:= SparseArray[{1}, 3, 5] // Normal

Out[1]= {1, 5, 5}
So the background is 5. This can be confirmed by looking at the InputForm.
Likewise:
In[2]:= SparseArray[{1, 2}, 3, 7] // Normal

Out[2]= {1, 2, 7}
Yes, fair enough. This much is documented.
But now:
In[3]:= SparseArray[{SparseArray[{1, 2}, 3, 7], SparseArray[{1}, 3, 5]}] // Normal

Out[3]= {{1, 2, 7}, {1, 7, 7}}
@Mr.Wizard I had exaclty the same idea:
It seems to me that the background of the array was changed from 5 to 7.
Hello @halirutan
SparseArray[SparseArray[{1}, 3, 5], 3, 6]
12:20
@Mr.Wizard novel. This seems to be the way forward!
Hi all
@halirutan hello!
But my example does not work.
The background is not changed.
At least not here on Linux
@halirutan not on Windows either. Honestly I doubt these sorts of things are platform-dependent.
I think what happens is, that it is transformed to a normal array and then given as input to the next SparseArray.
12:22
@halirutan This does a different operation. The background of the array is changed, but the old background is hard-coded as non-background values.
Yes, I see..
SparseArray[SparseArray[{1}, 3, 5], 10, 6]
Normal this one
If you look at the InputForm of the one that yields {{1, 2, 7}, {1, 7, 7}} above you will see that 5 is simply MIA.
@halirutan This behaves as I expected. The nested SparseArray (with different Backgrounds) does not.
changeBackground[sa_SparseArray, bg_?NumericQ] := SparseArray[{SparseArray[{}, Dimensions[sa], bg], sa}]
@OleksandrR. Now let's see if it is fast.
@OleksandrR. Wait, that doesn't work? What are you getting?
More experimentation needed.
Oops!
changeBackground[sa_SparseArray, bg_?NumericQ] := Last@SparseArray[{SparseArray[{}, Dimensions[sa], bg], sa}]
:)
12:30
@OleksandrR. Well that too, but actually what I've found is that it does not work if the background is Real rather than Integer. The fact that these do not behave the same suggests to me that it may in fact be a bug or corner case.
It works with Reals if the array was Real to start with. But you can't change an Integer array to a Real one using this process apparently. I assume the same goes for complex arrays.
I guess this must be the result of the fact that the internal array representation is not perfectly reproduced by the InputForm--there is also type information present.
@OleksandrR. So it does. Since SparseArray can contain mixed types I did not anticipate this.
I'm not sure if they're supposed to be able to contain mixed types.
@OleksandrR. Sadly I must report that this is slower than decomposing on my test case. I suppose it may be faster elsewhere.
@Mr.Wizard well, that's a shame. I suppose this is not the way forward after all.
BRB... buying lunch
12:37
Enjoy!
12:48
@Oleksandr when you get back, as a diversion I'd love to know if you can figure out what Internal`DenseToSparse is doing, e.g. Internal`DenseToSparse @ RandomInteger[9, {5, 5}]
@Mr.Wizard I suppose it's conceivable that SAs are passed around and manipulated in their InputForm for as long as possible until their internal representation is really needed for some linear algebra library call &c. As such, perhaps "decomposing" doesn't necessarily decompose, which may explain why it's fast.
Hi everyone!
@LeonidShifrin hi Leonid!
Thanks, Leonid.
No prob, @Mr.Wizard. What's up?
12:55
We're talking about changing the background of a SparseArray.
I figured you might have some ideas or at least experience, since you almost always do. :-)
As the man with access to the source code, do you have any insights? ;)
@OleksandrR. Actually I never had the time to really dig into the kernel code, up to now at least. It's a shame, I know :)
@OleksandrR., @Mr.Wizard I usually do what @OleksandrR. suggested, changing the background via its position in the FullForm of SparseArray. So, @Mr.Wizard, are you saying this is slower then breaking all into pieces and recombining back again?
@OleksandrR. I can confirm that decomposing takes much less memory than ToString[sa, InputForm] but the time it takes is also nontrival so I assume it's still doing some kind of unpacking.
@LeonidShifrin If I understand you that is actually what I described at the very beginning of the conversation. More specifically:
sa /. f_[a_, b_, _, x__] :> f[a, b, 99, x]
That's to change the background to 99.
I'm not certain how Oleksandr does it but I assumed something similar.
That's the fastest method I've yet found.
@Mr.Wizard yes I would do essentially the same. Probably wouldn't have used ReplaceAll but I don't think this really matters.
@Mr.Wizard Yes, that's more or less what I was also doing. Is it too slow?
@Mr.Wizard Do you have some benchmark code which shows that somehow this is slower than one would have expected from it?
13:02
It takes several times as long as the creation of the original SparseArray (by a highly optimized method). It's not slow, but I nevertheless wonder if there is a more direct way.
(I also would like to know if either of you can figure out what Internal`DenseToSparse does simply as a matter of curiosity.)
@Mr.Wizard I normally use this "API", although it may be a little fragile.
@Mr.Wizard I would have to do what anyone else here does. I probably could find the code and look into it, but it would take a while. I think people like @ruebenko may know more about sparse array internals.
@LeonidShifrin Okay, thanks. By the way that "API" is very nice.
@Mr.Wizard what it does seems clear enough... what it's for is another matter. I'm not convinced that this is anything to do with SAs, though.
@OleksandrR. Not clear to me, but then again I'm a bonehead. :^) Will you tell?
@Mr.Wizard I've used it in quite a few cases already, as you can see by the links un that answer. Worked fine for me.
13:14
@Mr.Wizard takes the items along the first non-packed dimension of the argument and returns a list of them with a decreasing value prepended... at least as near as I can tell.
@OleksandrR. Thanks; I didn't see that. (Bonehead, remember?) Be right back...
@Mr.Wizard since it doesn't seem to work properly with packed arrays I would guess that either it is some sort of prehistoric cruft or has a very specific use.
Time for other things. Thank you both, and see you later!
Nice talking. Bye then!
@Mr.Wizard I wasn't very helpful, alas. See you!
@OleksandrR. I must be going too... was summoned by @Mr.Wizard, apparently to no avail, since I wasn't able to add anything meaningful :) See you later!
13:31
@LeonidShifrin bye and have a good day!
@OleksandrR. Thanks, and same for you!
Incidentally, anyone know when those stupid sleighs will finally disappear?
 
3 hours later…
16:10
Is GraphicsBox etc documented?
16:32
@ssch A lot of the low-level boxes are undocumented, mostly because they're not of much use for the end user (i.e., you almost never have to use them directly).
@rm-rf I see, was just trying to understand the result of a WA query (ended up copying the Graphics instead)
 
1 hour later…
17:55
@rm-rf I always thought the lack of documentation was more to actively discourage users from using them more so than because of lack of usage.
18:08
@jVincent Yes, also to encourage users, but I didn't say they didn't have any use...
What I meant was that there is little to no need for a user to explicitly use a low level box (instead, generate with MakeBoxes) and those who do need to manipulate them, are probably knowledgable enough to do fine without the documentation
I did use GraphicsBox in a recent application to detect which cell had an image in it
btw, @jVincent do you use mma 8 or 9?
18:28
I'm using 9. And I would normally think I fell into the catagory of those who does fine without documentation, but when dealing with templatebox and trying to do interesting frontend stuff, it's just a punishing experience.
@rm-rf And when I was just starting out with mathematica many years ago, I remember thinking that things, such as the Notations package, where the underlying logic is swept under the carpet actually makes thing much harder to deal with rather than simplifying them.
Hello people
@jVincent Hi
Fighting with boxes?
Boxing
Nha, but my past is littered with things I abandoned because it became a frustrating mess. I was just venting. :)
@jVincent Has happened to me too
Mostly, stuff that I started doing a certain way and learned so much in the process that I had to restart, and then became lazy
"Learned so much" can also be construed as "realized it was a mess", depending on how negative your outlook on life is
18:50
@jVincent I agree with that. My first days with mma were spent figuring it out alone (my first notebook was littered with For loops =D) and I never knew the existence of the Notations package... in some ways, I'm glad I didn't stumble upon it back then
@jVincent Could you perhaps try out this package I wrote? It provides a notebook that lets you type answers inside mma and copy it to SE markdown. It's still very much in development (and I haven't pushed anything in the past 10 days), so there definitely will be stuff that breaks (and stuff not supported yet).
If you're interested, I can give you installation directions
Bitbucket looks quite nice, but it looks like it's suffering from developer sickness like github. It would be nice if the vs systems web front ends figured out that a list of files in a project or a overview the revision history isn't a good "hello there" page for anything. I get the distinct feeling that they where all made by people who also consider all their code self documenting.
@jVincent Well, the lack of an overview page is my fault... I haven't gotten around to writing it yet, as stuff is still fluid right now, but I include a documentation inside that's more thorough
If you use git, just clone it and use the developer branch. It's essentially the same as the latest master... just added a usage message and made a notebook autoopen on load
I use bitbucket because it allows me to have private repos for free (and also collaborate with upto 5 users on private repos). As a student, I find this very useful and I don't have sufficiently worthy projects or even those of general interest to use a paid github plan
19:07
I'm currently using mercurial, but i'm sampling different systems. I'm in a group that's setting up some standard coding standards stuff, and we need to figure out a VS system that can easily be used by non-terminal people without having to put them through too much.
If you're on a mac, SourceTree.app is a pretty neat GUI app for both hg and git and it lets you connect to your github and bitbucket accounts to manage repos
I'm on mac, but the institute is on windows.
Hmm... you can perhaps suggest FogCreek's kiln to your group, but is a paid service
Your package doesn't seem to work for me. Pressing markdown does nothing.
Ok, it works if I start a new notebook, but not in the examples. Also just running the documentation notebooks returns a lot of warnings. I suppose it's the difference between the workbench / frontend syntax for inclusions.
19:24
What warnings do you get? I run v9 too (on a mac) and I get no warnings
The packages somethingsomething` don't load.
*something'something'
@jVincent Also, it copies directly to the clipboard... there's no confirmation gui or such (but warnings will be seen in the messages window). A visual guide that something is being done is in the works
Works now, the folder had a wrong name.
Ah, yes. Should be renamed...
I know, I tried pasting it to no luck.
But I'm retrying everything now.
Works fine now. So basically when testing this out it'll spam imgur with a lot of unused images? Are they cleaned up if unposted or how does that work.
19:31
No, I don't think they're cleaned up... SE has an unlimited account, but repeated requests from a single IP will make them investigate (the image uploader really is a hack... it's not a supported API and the hole in the system might be closed anytime if they pay attention to it)
However, the intention was that you write the answer to your satisfaction in mma (no uploading yet) and when all set, click upload once. Of course, there will be a second upload for revisions, etc., but I didn't expect people to press markdown repeatedly during the course of an answer,
Might be a good addition to have a click button to not refresh image updates and image urls, if someone adds to an answer or similar, so you don't have to do mental diffs with what you already posted.
*togglebutton
It does give me an idea though... I can probably present a markdown preview with image upload unchecked by default and when you click finished, it uploads
@jVincent Yeah, something like that.
 
2 hours later…
21:38
Here's a quick question. In PHP there is a function called array_intersect which will pick out the elements common to two arrays. And there is a function array_diff that picks out the difference between the two arrays. I need these functions but I don't think there are any built into Mathematica/I can't find one?
@Calle Check Intersection and Complement
@Rojo Thank you! That's exactly what I wanted. I think they should be listed on the "Elements of lists" page.
They should :P
Well actually it's called "Manipulating elements of lists"
And neither is a function that manipulates lists.
@jVincent I can only find a tutorial by that name. Here's the page I'm talking about reference.wolfram.com/mathematica/guide/ElementsOfLists.html
@jVincent But you are right, it's not the right page for it. I have now found them under "Rearranging & Restructuring Lists"
 
1 hour later…
22:50
@OleksandrR. I had in mind the installation of the MinGW-w64 compiler. (Also being the more difficult of the two choices:). Regarding the license: Are instructions on how to modify a file in violation of the license? (then all the KeyEventTranslations.tr posts are in trouble as well:)

« first day (360 days earlier)      last day (4425 days later) »