« first day (601 days earlier)      last day (3889 days later) » 

12:45 AM
Hao
 
 
4 hours later…
4:35 AM
Could someone besides @Mr.Wizard try this out, preferably on v9? It's a very real issue for me, but I wonder how widespread it is:
3
Q: Poor quality Rasterize output when Background -> None

kirmaI am attempting to generate partially transparent images for PNG Export, but seem to run to the following issue. If I Rasterize a simple piece of Graphics with Background -> None (transparent) it looks worse: rings = Image[ Rasterize[ Graphics[{Black, Disk[], White, Disk[{1, 1}/64, 1 - ...

 
4:57 AM
I see it in v9 on Windows, but it works as expected if I set the Background option in Graphics instead of Rasterize.
rings = Image[
Rasterize[
Graphics[{Black, Disk[], White, Disk[{1, 1}/64, 1 - Sqrt[2]/64]},
Background -> #], RasterSize -> 400,
ImageSize -> 400]] & /@ {None, White}
 
5:08 AM
@MichaelHale Can you generate a four-channel (ImageChannels) raster image without the artifacts? If so, post an answer, if not, give a comment confirming I'm not alone with the issue. :)
 
 
2 hours later…
7:27 AM
Oops. I was too tired to fully verify the expected output. I posted a simple hack to make the image you want though.
 
 
1 hour later…
8:46 AM
@kirma I don't think the rasterize issue it is a bug, because the only thing you see is, that your image is not antialiased!
 
8:58 AM
Hi @halirutan, are you still around?
 
@IstvánZachar Yep.
Hi Istvan.
 
I have a Q-editing question you might be able to give me some advice
 
@IstvánZachar Shoot.
 
The actual problem here is much simpler, i.e.:
g = Graphics[{}, Frame -> True]
AbsoluteOptions[g, PlotRange]
returns inconsistent values.
So I would like to edit the Q to make it simpler, and to be a flagship of the "AbsoluteOptions is crap" problem.
But then I would have to remove most of Silvia's material. What do you suggest?
Perhaps (as a side matter) we should migrate this from SO: stackoverflow.com/q/4288713/712498.
 
@IstvánZachar I'm not sure, but what I do like is an introductory paragraph where everyone, who doesn't want to read the whole story gets a first, clear idea about what is going wrong.
 
9:04 AM
So you think it is acceptable if I add an intro of the simplified problem?
 
@IstvánZachar Yes, I think it is OK and everyone sees instantly, that AbsoluteOptions bugs.
I do this myself sometimes, for instance here.
 
@halirutan Ok, thanks for the idea, I'll do that!
 
9:38 AM
@halirutan I think it is a bug, since the result looks to me like antialised polygon. Antialiasing is not really missing from the picture (at least with my quality settings...)
 
 
2 hours later…
11:11 AM
@halirutan Are you here?
 
11:22 AM
@syed you are invited to chat
 
12:13 PM
@syed I would preffer to talk here :)
 
Kuba, thanks for the code it worked
 
@Syed I'm glad it works. I'm assuming you have new questions ;)
 
Now with the binary image, i would like to calculate the surface area coverage of a black region in the central region of the image which is changing along the samples.
 
@Syed use this on image Counts[#, 0] &@Flatten@ImageData@Binarize@img
You can skip Binarize if you are going to do this on already binarized pics
 
So if i enter this code for image 1?
Counts[#, 0] &@Flatten@ImageData@1
 
12:27 PM
@Syed 1 can't be an image...
 
@Mr.Wizard Ups, yes. Was and am.
 
@halirutan Hello. You're my go-to guy for scripts to improve the site usability. Do you have time to work on a custom utility just for me? It's not complicated, hopefully.
 
@halirutan Hello, what do you think about:
http://mathematica.stackexchange.com/q/32035/5478
 
@Mr.Wizard I'm pretty sure I cannot help you, because my java-script knowledge is very limited and all things I did, only happened because others did already great work.
@Mr.Wizard But you can of course tell me ;-)
@Kuba Hi. Let me read.
 
@halirutan Well, you tell me. I have gotten into the habit of formatting links like this: (32035)
I believe it is helpful to do so, but it is taking a surprising amount of my time in a repetitive action. Do you think it would be possible to give me a custom button next to comment boxes that pastes links like that automatically?
 
12:36 PM
@Mr.Wizard What link exactly do you mean?
Or more clear: What exactly to you expect the button to do?
 
I want it to take text on the clipboard like this:
http://mathematica.stackexchange.com/q/32035/5478
And paste it like this:
[(32035)](http://mathematica.stackexchange.com/q/32035/5478)
Extracting the 32035 part from the URL.
 
@Mr.Wizard If the number can be extracted with some regexp, I'm pretty sure I can help you
 
Ideally it would be flexible enough to handle the long form links as well, e.g.:
http://mathematica.stackexchange.com/questions/32035/possible-bug-with-second-argument-of-dynamic
@halirutan Okay, great. I don't think that should be a problem. It would be the first numeric string bounded by / / in every case.
 
@Mr.Wizard But it's a finite number of possible forms, so one could check a list and if one matches, try to extract the number.
@Mr.Wizard Are http://mathematica.stackexchange.com/q/ and http://mathematica.stackexchange.com/questions/ the only possible prefixes?
@Mr.Wizard Btw... I was following this link and was looking around were you made an edit or a comment, because I didn't realise the (123445) was already your wish link.
 
@halirutan lol
Sorry, not the best communicator I am. :-p
@halirutan I guess ideally it would handle /a/ URLs as well: http://mathematica.stackexchange.com/a/32041/121
Once again it's the first numeric string bounded by / /.
 
12:46 PM
@Mr.Wizard OK, I think then it should be no problem to extend the Ref button we already have.
 
@halirutan Wait, I want this for comments rather than answers, though I wouldn't mind it in the main editor too.
My primary use it creating "Related: (123), (456) ..." comments.
 
@Mr.Wizard Do you know a script which already introduces some functionality to the comment section?
Because the hard part is to debug the SE site and find out how site is built up and where you have to inject the code.
 
@halirutan No, but I haven't looked yet. Speaking of which for all I know this has been done by someone else for another site.
I suppose I'm the only nut doing it often enough to need a button however. :-p
 
@Mr.Wizard Isn't it a good question for meta.so?
 
@Kuba I'd be glad to post it there.
Oh, the main Meta or our site Meta?
 
12:54 PM
@Mr.Wizard I think main, it could be helpful not only for Mathematica.SE and also there is more people who can help you.
 
@Kuba There is also stackapps.com which I failed to search first. I am looking now.
 
@Mr.Wizard OK, I guess I could tweak this script for you.
 
@Mr.Wizard I'm afraid I do not know the SE network so well to give you advice where to post it :)
 
14
Q: Add keyboard shortcuts to comments

Kip About This script adds Ctrl+B (bold), Ctrl+I (italic), Ctrl+K (code), and Ctrl+L (link) shortcuts to comments. My script doesn't work exactly the same as the question/answer text editors, but it's similar. One difference is that hitting Ctrl+B when no text is selected just puts ** in the ...

It works with short-cut keys, but I'm pretty sure I could implement it in a short time
 
@halirutan I would appreciate it, but don't spend too much time on it; the idea is to save my time, not waste yours.
 
12:59 PM
@Mr.Wizard As you see it already supports links, so the only thing which needs to be done is to make the match against the url
 
So if i enter
Counts[#, 0] &@Flatten@ImageData@img
 
@Syed You will get number of Black pixels of the binarized img
0
Q: Possible bug with second argument of Dynamic

KubaAccording to the documentation, Dynamic Details & Options section, especially: For interactive mouse operations Dynamic[expr,{f_start, f, f_end}] typically evaluates f_start[val,expr] once when the mouse is pressed, then evaluates f[val,expr] whenever the mouse is moved, and then evaluates f_...

 
1:43 PM
Check out XKCD's Mathematica reference in today's "What If" what-if.xkcd.com/62
 
 
1 hour later…
2:54 PM
@Kuba can i send you a picture? The reason is i have black pixels in the middle of my image, which i want to count but also black pixels around the outside
 
Can anyone get a Mean for RenewalProcess or CompoundRenewalProcess with a discrete rdist distribution, or even UniformDistribution? Am I having too high expectations of this functionality, or what? Basically everything on these lines I try stays unevaluated.
With relatively fresh probability/random process stuff, Mathematica is relatively poor substitute for just using ones' brains. Like in this case: Expectation[Norm[v + {1, 0, 0}], v \[Distributed] TransformedDistribution[Evaluate[FullSimplify[Normalize[{x, y, z}], {x, y, z} \[Element] Reals]], # \[Distributed] NormalDistribution[0, 1] & /@ {x, y, z}]]
I wonder if it ever gets the result.
 
3:27 PM
@Syed Take a look and type MorfologicalComponents to the query too, I think that's all I can help you. I'm not experienced in image processing.
 
@Kuba Thanks @Kuba, will have a look now.
 
4:02 PM
@Kuba The unnecessary calling of the dynamic function is really weird.
I guess it never lead to any bugs because no one uses dynamic functions which depend on the number of function calls :-)
@Kuba I wonder if one could gain more insight by looking at the communication with the LinkSnooper. I guess not since the mouse position could be handled directly in the FE.
 
4:28 PM
@halirutan I find it strange that this issue was hidden. Working with second argument of dynamic is usually the best way to get interface with good performance. Well, I missed it too :P Even if this could be explained with the knowledge how Mathematica checks that variable is updated it still is undesired behaviour.
 
5:23 PM
Thoughts at bar... What is average distance between two random points on unit hypersphere in infinite-dimensional euclidean space?
Why I come up with such so useful thoughts?
Ah, it's Sqrt[2].
 
Monte-Carlo series from 3 to 10 dimensions: Table[Mean[
Table[Mean[
EuclideanDistance @@@
Partition[
Table[#/Norm@# &@
RandomVariate[NormalDistribution[], d], {1000000}], 2]], {d, 3,
10}]
 
Yep... I used fancier TransformedDistributions though.
It's possible to nicely create a distribution that produces random variates just from those distances at a specific dimension.
 
5:40 PM
Pretty cool. I don't know how to do that.
 
It certainly got a bit more complicated than your short example, but not actually bad...
 
6:07 PM
Hi everyone,
Its my first time here
 
@barznjy Hi! Activity on the chat tends to be... spotty.
 
6:42 PM
@kirma Here's my guess of how I would approach the problem with TransformedDistribution, but it doesn't do anything.
With[{dist =
MultinormalDistribution[Table[1, {3}], IdentityMatrix@3]},
Mean@TransformedDistribution[
EuclideanDistance[a/Norm@a, b/Norm@b], {a \[Distributed] dist,
b \[Distributed] dist}]]
 
@MichaelHale I wonder if MultinormalDistribution with IdentityMatrix is actually not so great idea for performance...
(no idea)
 
Me neither. I'm curious to see how you approached it though.
 
It's not really written for brevity.
If you insist...
distdist[dim_] :=

With[{udist =
TransformedDistribution[
Evaluate@
FullSimplify[
Normalize@#, # \[Element] Reals], # \[Distributed]
NormalDistribution[0, 1] & /@ #] &@Table[Unique[], {dim}]},
TransformedDistribution[
Evaluate@
FullSimplify[EuclideanDistance @@ #, Flatten@# \[Element] Reals],
# \[Distributed] udist & /@ #] &@Table[Unique[], {2}, {dim}]]
stupid simplification rounds there.
I might have developed a perverse interest for creating dynamic symbols lately.
Table[Unique[], ...] that is.
 
I understood what you were doing. How did you arrive at Sqrt[2] from there?
 
6:58 PM
Looking at numeric sampling... intuition. It could well go wrong, too.
 
Fair enough.
 
Should write my symbolic integrals to take dimension as a parameter, but I suspect it doesn't take much more than three dimensions to make Mma cough badly...
It is pretty easy to compute purely symbolic values for three-dimensional case and it actually evaluates...
 
7:28 PM
In version 8 or 7, did func[a_,_]:=a; func[test] return test?
I'm looking at a piece of code in the Mathematica Coobook where he explicitly says that he defined the function as func[a_,] even though he means to use it as func[a] because of "extensibility in the future" but that it doesn't matter because _ matches blank or nothing.... but it still means, in version 9, he has to use the function like this: func[test,] which he doesn't.
Underscore disappeared where the italics began. func[a_,_]
 
Isn't that what BlankNullSequence is for?
 
7:54 PM
@Calle Ahh, that's Anon :P
 
@MichaelHale You're right! I've noticed that underscore tends to disappear here and there in that book so this fits right in. Thanks.
@Kuba hehe
 
8:14 PM
No problem. It's definitely useful to know the _, __, ___ and the .. and ...
 
8:26 PM
@Calle I've asked the question we were talking about earlier. About double dynamic evaluation
but it seems it was new to the community
 
8:42 PM
@Kuba I'm keeping tabs on that Q&A. :)
Maybe someone will be able to explain it, but it doesn't feel like it's been done that way intentionally at all.
 
9:08 PM
Argh. I give up. I don't remember how to do all the rotations in four dimensions and above any more.
 
9:24 PM
Hello
For no particularly good reason, I made a version of my iterative gradient filter on a 3D image. It doesn't run very fast, as you might imagine, so I uploaded a movie here
 
@SimonWoods Looks nice, although I think the 2D version is more impressive.
 
@halirutan, I like that the 2D version is fast enough to run as an animation in the notebook
I was just curious what it would look like in 3D
The youtube compression and resizing doesn't help - the original looks a bit crisper
 
@SimonWoods It seems you uploaded a very small version. Which image dimension has the original video?
 
It's only 300x300
The 3D image is 100x100x100
 
@SimonWoods OK, then this makes sense.
 
9:35 PM
I would have done a bigger one but I need a better PC :-)
The latest way I have found to use my expensive math software for frivolous entertainment is this:
n = 1000;
r := RandomInteger[{1, n}];
f := (#/(.01 + Sqrt[#.#])) & /@ (x[[#]] - x) &;
s := With[{r1 = r}, p[[r1]] = r; q[[r1]] = r];
x = RandomReal[{-1, 1}, {n, 2}];
{p, q} = RandomInteger[{1, n}, {2, n}];
Graphics[{PointSize[0.007], Dynamic[If[r < 100, s];
Point[x = 0.995 x + 0.02 f[p] - 0.01 f[q]]]}, PlotRange -> 2]
 
Several mass centers and some free particles, right?
 
Not quite, each particle is attracted to just one of the others, and repelled from another.
 
@SimonWoods Therefore the jumping of the particles between the centers..
 
Yep, every so often one of the particles changes its attractor and repeller, so it constantly changes
 
@SimonWoods both examples are awesome ;)
is code for 3D image big?
 
9:43 PM
@VitaliyKaurov, no it's tiny, hang on a sec
i = RandomReal[{0, 1}, {100, 100, 100}];
Do[i = Rescale[i - GradientFilter[i, 2]];
 t = 2 Pi j/300.;
 Export["image_" <> ToString[j] <> ".bmp",
  Rasterize[
   Image3D[i^10, ViewPoint -> {3 Cos[t], 3 Sin[t], 2},
    SphericalRegion -> True], ImageSize -> {300, 300}]], {j, 800}]
Each frame is calculated and exported in turn, I use other software to convert the frames into a movie file
 
wow this code snippets ... i love when they are short and mighty ;)
 
Same here :-)
One of the things I really like with Mathematica is the way you can do so much with so little code
 
yep ;)
too bad they will disappear in chat flow. Do you think I could post them on Wolfram Community?
 
Fine by me
 
cool - i'll post a link later here ;) thx
let me know if u got more of this thingies
 
9:49 PM
How is the community going these days?
It was horribly slow when I first looked in
The website I mean, not the participation
 
we opened it to public - so quite active now. website is much faster - we tuned it up
it came out to be like a collaborative medium. For example we figured here together the fastest peak compiled detection community.wolfram.com/groups/-/m/t/96823
but I love both sites. I post here too very often.
 
@SimonWoods Btw, about your 2D animation: I played with it a while and found, that many other approaches are too stable to be used in a similar approach.
How did you find that the numerical issues of the GradientFilter work?
 
@VitaliyKaurov, yes it's much faster now! Nice work on the peak detection code, it's good to see people building on each others work
@halirutan, I found it by accident
 
@SimonWoods what does exactly that 2D animation do?
it still going with no repetiton
 
The particles one?
 
10:01 PM
yes is it chaotic?
 
No, the randomness is deliberately injected. Here's how I described it to my other half:
1000 dancers assume random positions on the dancefloor. Each randomly chooses one "friend" and one "enemy". At each step every dancer moves 0.5% closer to the centre of the floor, then takes a large step towards their friend and a small step away from their enemy. At random intervals one dancer re-chooses their friend and enemy. Here is the dance...
 
@SimonWoods I played quite some time but the only thing which brought some nice looking was to give it a bit more water-like feeling:
a = DiskMatrix[10, 200]; Dynamic[
 Colorize[Image[
   a = Rescale[
     RotateRight[.01 a] - GradientFilter[a, 2, Method -> "Sobel"]]],
  ColorFunction -> "GreenBrownTerrain"]]
 
@halirutan, nice!!
Actually wave propagation was what I was originally trying to simulate when I stumbled across the pretty patterns
 
@SimonWoods nice storytelling ;)
@halirutan cool image
 
@VitaliyKaurov @SimonWoods Indeed, it looks really nice. Very sad that it's completely your idea ;-)
 
10:49 PM
Is there an easy way to convert RGBColor[1, 0, 0] and other Graphics Directives back into their shorthand form?
I was on the verge of asking such a question here but ended up asking IMO the wrong question.
 
@Liam Something like Red is instantly evaluated to RGBColor[1,0,0]. It is like asking whether 2 can be converted back to 1+1..
 
@halirutan Couldn't there be some way to force at least the colors back. I am not the best with Mathematics Graphic system but is RGBColor[1,0,0] really ambiguous representation or is converting it back to Red safe?
 
@Liam The problem is the moment you evaluate it it gets instantly converted to an RGBColor. What do you try to achieve? I mean, it will not help you if you have to Hold your code all the time.
What are you trying to do?
 
InputForm[Graphics[{Red, Circle[]}]]
Graphics[{Red,Circle[]}]
I guess it would end up being Circle[{0, 0}] unless you can revert default locations to.
 
@Liam HoldForm[InputForm[Graphics[{Red, Circle[]}]]]
 
11:01 PM
;) Well that was a simplified example. Try this
gr = Graphics[{Red, Circle[]}];
HoldForm[InputForm[gr]]
 
@Liam The moment the first line gr=.. is evaluated, everything is too late, because your graphics is already converted.
 
Certainly but unless RGBColor[1,0,0] can mean possible things, then there certainly should be some way to convert back to the Graphics Directives.
 
@Liam You could use SetDelayed:
gr := Graphics[{Red, Circle[]}];
HoldForm[InputForm[gr]] /. OwnValues[gr]
But again, if you evaluate your gr at some point in the chain and assign it, everything is lost.
 
Currently I am use Drawing Tools to edit already rendered Graphics. I am then trying to convert them back to the simplified forms(Graphic Directives) forms.
 
@Liam The other way around is to create color rules and convert everything back.
 
11:08 PM
@halirutan That is what I am hoping. Ideally there might be a function already inside Mathematica which does something similar, or maybe I could train a function based on a list of inputs.
 
@Liam Do we have a list of named colors anywhere?
 
guide/Colors in docs
 
@MichaelHale Yes, I've seen them. What I mean as valid Mathematica list ;-)
 
;) I had figured that was the case
 
11:12 PM
Ah
 
Something like ColorData["Named", "ColorList"] but with the system colors and the names instead.
@MichaelHale @Liam ColorData["Named", "ColorFunction"] // InputForm
And what we want is ColorData["HTML", "ColorFunction"] // InputForm
@Liam give me a sec
 
That should work quit well for colors.
Ultimately I think the code should be generalized to simplify other Directives. I have opened such a question here for the community. Having a solution that works solely for Colors is probably the first most important thing.
 
@Liam Here we go
rules = Cases[
   MakeExpression[#] /.
      HoldComplete[expr_] :> (HoldPattern[Evaluate[expr]] :> expr) & /@
     ColorData["HTML", "ColorFunction"][[3, 1]],
   HoldPattern[Verbatim[HoldPattern][_RGBColor] :> _]];

gr = Graphics[{Red, Circle[]}];
With[{expr = InputForm[gr]},
 HoldForm[expr] /. rules
 ]
 
With to the rescue again.
 
@Liam You don't need it, but I'm not sure whether this looks better
HoldForm[gr] /. HoldPattern[gr] -> InputForm[gr] /. rules
 
11:27 PM
You are right I should have paid closer attention.
I thought you were using it as the replacement technique.
 
@Liam I use it to evaluate expr before I protect it with HoldForm
HoldForm[gr] will not work, because gr is never going to be evaluated.
 
Ok that makes sense. I see. I recall doing that before inside a Replace statement for Head values now.
 

« first day (601 days earlier)      last day (3889 days later) »