12:23 AM
@SjoerdCdeVries Yeah... oh well.

1:08 AM
@JM are you around?

@RM How may I help?

@JM well, I've been trying to put a column under the chinese roof and can't get the intersections quite right...
I'm fairly certain there's a decent way to go about it, but I seem to be falling short
```roof = With[{
fauxLame = {#2 Abs@Cos@#1 Cos@#1, #2 Abs@Sin@#1 Sin@#1,
9 #2 ((9 #2/10 - 2/3) Cos[2 #1]^2 - 4/3)/20} &,
tRoof = ExampleData[{"ColorTexture", "Roof"}]
},
ParametricPlot3D[fauxLame[u, v], {u, -Pi, Pi}, {v, 0, 3/2},
Mesh -> None,
PlotStyle -> Texture[tRoof]]
]```

@RM Oh, that... in one of the artwork I did, I didn't bother. I just used perspective and set things up so that the `Cylinder[]` objects forming the columns just touch (i.e. tangent), as opposed to actually intersecting...

```column = With[{
fauxLame = {#2 Abs@Cos@#1 Cos@#1, #2 Abs@Sin@#1 Sin@#1,
9 #2 ((9 #2/10 - 2/3) Cos[2 #1]^2 - 4/3)/20} &,
rad = 0.2, offset = 1
},
ParametricPlot3D[
u = ArcCos@
y , Min[z,
Last@fauxLame[u, y/Sin[t]/Abs@Sin@t]]}], {z, -2, -0.5}, {t, -Pi,
Pi},
Mesh -> None,
PlotStyle -> Darker@Red
]]```
@JM yeah, that's how I've set it up now... but since it's for a first-person view question, I'm trying to reduce the gaps
obviously, an overkill...
Combine with `Show[roof, column]`

The first thing I'd do is to slice the roof across a plane parallel to the \$x\$-\$y\$ plane.
Slice at the height where you want the top of the column to hit, and then you can consider a two-dimensional problem of finding tangent circles to a Lamé curve...

1:17 AM
hmm...
I'm getting slow... I had to do intersections of arbitrary 3D polygons by hand for my engg-drawing class as an undergrad and was decent at it. Now I fall asleep at the thought of it

Well, it's definitely easier than staying in 3D all throughout...
Once you have the tangent circles, you can go back to 3D, and extrude those tangent circles to become cylinders...

aha. Hmm... extruding the 2D tangent circles is certainly a better strategy than this one

Did I mention that I left the parametric equations for the roof with tweakable parameters?

@JM yeah. I've set the parameters... no point in having a tweakable building ;)

Okay, I was partly reminding myself. :) (I know I considered a family of roofs as opposed to just one...)
Now that I look at it again, it seems you went with the square cross-sections, so finding tangent circles would even be easier...

1:28 AM
Yeah... I'll take a look again this evening. Gotta bike home now
Thanks :)

Okay. See you later.

6 hours later…
7:55 AM
@RM I thought you lived in car-land! So there's still hope? :-)

8:06 AM
@Szabolcs Maybe RM meant bike as in motorcycle.

Need to do a spherical smooth histogram and I'm so lazy ...

What's a spherical smooth histogram?

@Heike I mean: I want to show the density of points on the surface of a sphere. The density is almost constant, but not quite. Just plotting all points as `Point`s won't make it really visible. I think I need to do "kernel density estimation", as binning doesn't seems easy on the surface of a sphere. So first step: finding a function for the kernel?
Naively I can use a kernel function like this: `kernel[point_, x_] := Exp[-const ArcCos[point.x]^2]`, where `point` is one of the points on the surface of the sphere, represented as a unit vector, and `x` is the point where I'm evaluating the function (another unit vector).
@Heike A question: if you go to the doc page of Texture, under Applications there's "Volume Rendering". Does that example work for you? I cannot see the texture in the output of the Manipulate.
All I see is this:

8:23 AM
@Szabolcs That example works for me

@Heike You mean you see the textures in the output, not just the three uniformly coloured planes, like on the image above?

@Szabolcs Yes, that's what I meant. You need to evaluate slices and data first though

I did of course.
I think it's because of my very old graphics hardware.

That's what it looks like

Oh, that's very nice :-)
Let me see on Linux, be back in 5 min.

8:25 AM
@Szabolcs Texture rendering does seem to rely heavily on the graphics card.

It works on Linux, same graphics hardware.

strange

Let's see if the image uploader palette works fine as well ...
@Heike Another question: what happens if you copy and paste that manipulate (the output cell) into a new notebook?

@Szabolcs That works fine by the looks of it.
after clearing data the manipulate looks like this:

The Linux version still has serious problems with keyboard focus ...

8:39 AM

Yep
That's what I see as well
This affects the uploader palette too
Because it's based on copying

@Szabolcs Yes, that's why I copied and evaluated data and slices to a normal notebook.

I think it has to do something with cell contexts

@Szabolcs symbols in the help files seem to live in `Cell\$...` contexts

@Heike Yes! Here's an experiment: open two notebooks. In the first one, set `data={3,2,1}`. In the second one, first set Evaluation -> Notebook's Default Context -> Unique to Notebook, then set `data = {1,2,3}` (i.e. something different). Then in the second one, do `Manipulate[data[[i]], {i,1,Length[data],1}]`. Copy the output of the Manipulate into the first one.

8:45 AM
@Szabolcs There probably is a very good reason, but why have you opted not to use SmoothKernelDistribution[] or KernelMixtureDistribution[] ?

Notice how now it picks up the `data` variable from `Global` ` instead of the cell context
@image_doctor Because I'm on the surface of a sphere. I thought they only worked in Euclidean space. It would be great if I were wrong though.

Hmm, A Manipulate keeps crashing on me and I can't figure out why.

Let me see if I can remember that nice book on spherical statistics that I once saw...

@Szabolcs they're multivariate ... so in 3D you get a 3D density ... and in your case you just want to evaluate that on the surface that represents your sphere ?

@image_doctor good point
@image_doctor instead of working strictly on the surface of the sphere, I can work in 3D, and at the end just restrict everything to be on the surface of the sphere. Is this what you're saying? A ParametricPlot3D with a ColorFunction might work for plotting the thing. Seems like a good idea, thanks! :-)

8:49 AM
@Szabolcs yes I think that's the gist of my idea

If it works, then you just saved me a lot of work.
@Heike Which Manipulate? Texture-related?

@Szabolcs No, something with a graph

@JM You're on Linux, right? What distro do you use? Are you having trouble with keyboard input focus?

@Szabolcs Xubuntu. If there is, I don't notice it...

@Szabolcs then I hope it works ! :)

8:51 AM
I'm trying to highlight a path in a graph, but for some reason FindShortestPath causes problems in the Manipulate.

@Heike `Graph` is crashy ... If you can send me details, I'm interested. I complained about Graph-bugs before. A crash was fixed in 8.0.4, but some possibly related incorrect behaviour was not. I think the internal representation of `Graph`s gets corrupted sometimes. `IsomorphicGraphQ` returns wrong results for me sometimes if I delete edges/vertices from graphs, or generate graphs using `Subgraph`.

Ah, found it.

Now I only wish this didn't happen ...

@Szabolcs Sadly it won't be coming back soon. I have it on good authority that the admin is very much busy, apart from the legal troubles...

@JM Thank goodness for Russian alternatives ;-) unfortunately they make me guess a password about monthly, for which one would need to be familiar with Russian pop culture ... (those children's books I had with folk stories from Russia helped a lot!)

8:59 AM
@Szabolcs Oh, that. Yes, every month's a puzzle...
(Actually, the troubles of Kim Dotcom were the opening round in all of this... damn SOPA/PIPA.)

@Szabolcs It looks like things go wrong when I try to calculate the shortest path in a weighted graph

@Heike is it that "geometric graph" question?

@Szabolcs Yes
I tried to include lengths of the edges when calculating the shortest paths, but just adding EdgeWeight -> lengths seems to make things crash spectacularly

@Heike (before I try it) --- only the kernel crashes, right?

@Szabolcs No, the front end as well

9:13 AM
I can reproduce it.
```Table[
gr = RandomGraph[{10, 20}, EdgeWeight -> RandomReal[1, 20]];
FindShortestPath[gr, 1, 10],
{10}]```
Evaluate this a couple of time, and it will crash the kernel.

Maybe it's worth a bug report to WRI.

I just got one of these (quite unusual):
@Heike Got a minimal example: `FindShortestPath[Graph[{1, 2, 3}, {2 <-> 3}, EdgeWeight -> {1}], 1, 3]`
@Heike I think the crash happens when there's no shortest path (in this case `1` is not connected) and there are some `EdgeWeight`s.

@Szabolcs That is pretty minimal

You could use that to report the problem.

@Szabolcs So as a workaround I could determine if there is a path first before actually calculating the shortest path.

9:27 AM
I believe so. But let me just test that.
@Heike Well, trying to test that lead to discovering another crash ... I was trying to remove all EdgeWeights. I used `RemoveProperty[g, EdgeWeight]`. It does not work: `PropertyValue[g, EdgeWeight]` still gives me weights. Then I tried `RemoveProperty[g]` which will remove all properties. It seems to work.
@Heike But then try `FindShortestPath[RemoveProperty[Graph[{1 <-> 2, 2 <-> 3}, EdgeWeight -> {1, 1}]], 1, 3]`: it crashes again. `FindShortestPath` will crash on any graph that once had EdgeWeights, but then all its properties were removed.
I'm really frustrated with the bugginess of the graph-related functionality.

@Szabolcs I can add that to the bug report
At the moment I do If[FindShortestPath[Graph[vertices, edges], v1, v2]=!={}, HighlightGraph[gr, FindShortestPath[gr, v1, v2]], gr] where gr is the weighted graph
@Szabolcs I think the problem is that WeightedGraphQ[RemoveProperty[g1]] returns True.

9:44 AM
@Heike Oh, that's a good find! I asked a question on how to remove `EdgeWeight`s. I would really like to find this out.

1 hour later…
10:54 AM
@image_doctor One difficulty is that it's not trivial to convert that 3D density into a true 2D density on the surface of the sphere, nor to find the maximum density for plotting purposes.
A `ParametricPlot3D`'s `ColorFunction` receives 6 arguments. Out of the 6, only 5 are documented (x, y, z, u, v). What is the function of the 6th one?
In my tests it seemed to always be zero.

@Szabolcs Wait, six? Where did you see this?

@JM `Reap[ParametricPlot3D[{Cos[u] Cos[v], Sin[u] Cos[v], Sin[v]}, {u, 0, 2 Pi}, {v, -Pi/2, Pi/2}, ColorFunction -> ((Sow[{##}]; Gray) &)]]`
I get a list of 6-tuples.

But the sixth component is always zero?

In this example, yes.
I wonder what its function is, and if it could even be non-zero.
@JM The one-parameter form of the same function gives 6-tuples as well: `Reap[ParametricPlot3D[{Cos[u], Sin[u], 0}, {u, 0, 2 Pi}, ColorFunction -> ((Sow[{##}]; Gray) &)]]`. Here the last two are always zero. Maybe there's a special case of `ParametricPlot3D` where the 6th value can be used as well?
The two-dimensional version gives me 5-tuples.
This is the same thing: for the two-parameter form of `ParametricPlot`, the four numbers passed to the ColorFunction should be x, y, u, v. But what is the 5th one?

11:10 AM
Huh. This really is weird...

I'll post a question on the main site. Maybe someone knows, or one of the devs will appear.
It's not very practical, but it's definitely an answerable question ...
If it has a good use, then it may be practical too.

Yeah. (Many strange things under the hood, indeed.)

@Szabolcs I can see what you are getting at. The global scale factor the maximum value of the probability function on the surface of the sphere must be the sum of the individual max probs for each of the points. I suppose the 3D probability represents a local approximation to the true probability. Is there a suitable Gauss map from perhaps a 2D probability ?

11:25 AM
Is anyone familiar with `NCAlgebra`? See this comment. Do capital letters have a special meaning in NCAlgebra?

@Szabolcs Plot3D gives 4 numbers with the fourth being 0

Alright, in NCAlgebra capital letter variables are assumed to be commutative by default.
@image_doctor Since all the points are strictly on a surface, I think the actual values we can get from the 3D distributions will depend on the spread of the kernel function (bandwidth)

11:41 AM
@Szabolcs Yes, the peak value for a point will be the peak of the kernel function. For the Gaussian kernel: PDF[MultinormalDistribution[{0, 0,
0}, {{\[Sigma], 0, 0}, {0, \[Sigma], 0}, {0, 0, \[Sigma]}}]][{0,
0, 0}] -> 1/(2 Sqrt[2] \[Pi]^(3/2) Sqrt[\[Sigma]^3])

2 hours later…
2:10 PM
@Szabolcs I do, and this part is the worst in the entire country re: car density and usage... I try to bike (bicycle), although I do have a car. It takes about an hour each way, so not really a favourite option if I have to work late

3 hours later…
5:07 PM
posted on May 16, 2012 by Wolfram Blog Team

For the first time, we’re holding a virtual event in a new talk-show format. We’ll put Mathematica experts live on camera to answer your questions about visualization. Our host will accept questions in real time and pass them to three of our graphics experts. You can also submit your question when you register for the [...]

5:25 PM
Perhaps we cann try some of our unanswered questions, though that probably won't be graphics related. Not many of those remain unanswered.

@SjoerdCdeVries for what?

5:53 PM
@JM For the Mathematica Experts Live: Visualization
I submitted a question when signing up: what are some tips to ensure fast render times?
(described in more detail)
I'm not expecting much ...
I had trouble with slow render times.

@Szabolcs (apart from changing your hardware, that is... :D )
Now if we could only get all those experts to hang around here, we'd have something...

@JM One of my complaints is that `ToBoxes` often takes as long as the rendering itself. Just using `g /. {Graphics -> GraphicsBox, Line -> LineBox, etc.}` can be more than 10 times faster. Of course `ToBoxes` does more than that ... but still ... also `ToBoxes` is limited by `\$IterationLimit` in some cases meaning that certain graphics just won't show without `\$IterationLimit = Infinity`.
@JM three of the four do!
Yu-Sung Chang, Brett and Vitaliy
The fourth one is a "Public & Community Relations Associate" so he is probably going to pass the questions to the experts.

@Szabolcs I know Brett and Vitaliy, but now checking, I didn't realize that Yu-Sung's here, too!
(Apparently he arrived while I was on leave.)

@JM Here ~2900 rep.

1 hour later…
7:19 PM
@Szabolcs I doubt `ToBoxes` are the kind of thing that'll be in focus during the event

7:50 PM
@all quick math question: the roots `a` to an equation `Tan[a]==-b a`, for varying `b`'s has likely been studied to death -- any good references? i have a nifty technique, but I assume it's been done before

8:04 PM
@EliLansey method to obtain what? analytical approximations? a graphical technique? what sort of thing do you have in mind?

@Heike Do you remember what Brett said about using `PlotRange` as a function? Did he just not recommend it or did he say that it was deprecated and fragile?
I don't remember if it was in chat or a comment...

@acl like, i've been able to work out a table of values `c` for which a is approx m+ArcTan[-b c]
where m is an integer

ok, found it:
Apr 22 at 1:08, by Brett Champion
@Heike This is not a reliable feature (undocumented, could be removed in a future version, etc...) As a general rule, option and function names are supposed to be different.

but i've done it numerically, by fitting a whole series of numerically found roots with that expression
i assume someone's done something much like this before

@EliLansey probably, but I doubt it's the sort of thing people would publish.
at least, when we have happened to do similar things, we quietly do them and claim that the calculation was done numerically
but perhaps things are done differently in fields other than theoretical physics.

8:10 PM
@acl i suppose? i mean, these sorts of functions turn up all the time in quantum mechanics (and elsewhere). someone must've published something on this ages ago
i'm not about to publish this method, but i'd prefer to just cite it, if i can

@EliLansey maybe in books. but usually you get the graphical method for finding roots
I don't know anything else

@EliLansey Are you sure that is m and not m*Pi or something?

I always thought it's a shame that people do this sort of thing silently, because then you end up having to reproduce lots of clever tricks to obtain there results
(and yes it looks like it should be Pi!)

@Heike oh, yeah, m*pi
my bad, i typically calculate the root / Pi

@acl Or start naming well known techniques after yourself...

8:14 PM

@Heike Ha!

@EliLansey but you can simply state that numerically solving the equation indicates that the roots have the form m*Pi+atan(-bc) with \$c\approx blah\$

sometimes, opportunities are missed. I was too lazy to learn someone's popular program for simulating X and wrote my own simple method to do the simulation, thinking "well, this is an obvious way to do it". It was so obvious that I never bothered to mention in presentations. Turns out, it wasn't that obvious to others in the field ("in the field" being key) and 2 yrs later, someone else presented the very same "idea" at a conference and was planning on publishing it and making it a library...

@acl yeah, i know. this is a (small) part of my thesis, so i figure it's always safer to just cite the source

@EliLansey cite this

8:21 PM
@RM I once heard the story that Kepler had tried all sorts of curves before he settled on an ellipse for orbits of planets around a star just because he assumed other people had tried that already since it's so obvious.

if the reader of your thesis knows the book, they'll be too intimidated to check
if they don't, they'll be intimidated the moment they set eyes on the book

@EliLansey You might want to look up asymptotic expansions.

@Heike you're saying I could've been the next Kepler? Dammit!

@acl Ha!
there are all sorts of papers like this
i'm sure there's one on this somewhere

@EliLansey of course it depends on your definition for exact and analytical

8:23 PM
@acl i'm using a physicists definition ;-)

@EliLansey no I mean, if the exact expression is an infinite series that converges slowly (say) then it's not of much practical use

@Heike Do you know how to find the center (or base) of an arbitrary graphics3d? For example:
`With[{c1 = Graphics3D[Cuboid[RandomReal[10, 3]]], c2 = Graphics3D[Cuboid[]]}, Show[c1, c2]]`
I'd like to be able to do something like `Show[Graphics3D[Translate[c1[[1]], vec]]], c2]`

@RM What do you mean by center? Mean/@PlotRange or something?

think this is worth a question on math.SE?

@Heike Basically, I need that `RandomReal[10, 3]` (or anything that's close enough). That's what I tried (hence the earlier question on `PlotRange`), but it didn't work in a more complicated case
It does though in this simple example... let me think of a better illustration
oh, crap. The fault is mine. I offset by `Mean/@PlotRange` when I should've done `-Mean/@PlotRange`... facepalm

9:07 PM
@EliLansey for what it's worth, you can approximate the roots of Tan[a]==-b a for a -> Infinity by 1/(2 b k^2 Pi) + 1/(b k Pi) - Pi/2 + k Pi + (-4 - 12 b + 3 b^2 Pi^2)/(12 b^3 k^3 Pi^3) where k is a positive integer.

@Heike thanks!

To get a better approximation you could include higher orders of 1/k