2.21 Thursday, July 9, 2020

2.21.1 Top new questions this week
2.21.2 Greatest hits from previous weeks
2.21.3 Can you answer these questions?

2.21.1 Top new questions this week

How to solve the Monty Hall problem?
Change Opacity along a ListLinePlot
Use Cases with empty cells in the list
Writing compiled functions as fast as Python’s Numba
Why are more highly nested lists often not more memory and time-intensive?
Correcting the Color Scale of a MatrixPlot
Verify an inequality of many parameters

How to solve the Monty Hall problem?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225238

Problem For purely recreational purposes I would like to solve the Monty Hall problem with Mathematica using the function Probability (dedicated to the calculation of probabilities). About the Monty ...

asked by mlpo https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=11155 12 votes

answered by Sjoerd Smit https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=43522 16 votes

Change Opacity along a ListLinePlot

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225337

I’m trying to change the opacity of a line in a ListLinePlot for increasing x-value. E.g. the line should have opacity 1 at beginning and shade than down to opacity along the line. I want to take the ...

asked by piolio https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=73660 10 votes

answered by C. E. https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=731 8 votes

Use Cases with empty cells in the list

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225360

I work with a complex dataset. The most simple form of this list looks like:

dat1 = {{a, b, c, {}}, {d, e, f, {1}}, {h, i, j, {2}}} 
 
I want to select the nested {} part. 
Cases[dat1, {___, {a_}} :>  ...

asked by Michiel van Mens https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=9590 9 votes

answered by flinty https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=72682 9 votes

Writing compiled functions as fast as Python’s Numba

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225277

I want to write some code to simulate a damped oscillator that is just as fast as code written using Numba's @njit decorator. I’ve written the mathematica code and mine is 20-40x slower than the ...

asked by Diffycue https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=46327 9 votes

answered by xzczd https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=1871 16 votes

Why are more highly nested lists often not more memory and time-intensive?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225540

I would expect more highly nested lists, being deeper and more complex than flatter lists, to take up more space (bytecount) and take more time and memory to operate on in general. Consider the ...

asked by Just Some Old Man https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=12697 7 votes

answered by Henrik Schumacher https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=38178 10 votes

Correcting the Color Scale of a MatrixPlot

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225186

I did a MatrixPlot of a set of values that range between 0 and 1. I got the following first plot with no problems:

As we can see from the legend, the values range between 0 and 1. Now, I am doing ...

asked by Naps https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=73570 7 votes

answered by C. E. https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=731 5 votes

Verify an inequality of many parameters

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225380

I’ve got an inequality of 10 non-negative parameters (arising from a 5x5 matrix) and would like to verify whether it holds. I tried the following, which doesn’t seem to work:

asked by Vicky https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=73675 6 votes

answered by flinty https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=72682 4 votes

2.21.2 Greatest hits from previous weeks

How to calculate scalar curvature Ricci tensor and Christoffel symbols in Mathematica?
Figuring when the minute and hour hand coincide on a clock
xkcd-style Plots
Are you interested in purchasing David Wagner’s "Power programming with Mathematica"?
Parallel and perpendicular symbol from Mathematica to LaTeX
Mathematica Minecraft
Labeling individual curves in Mathematica

How to calculate scalar curvature Ricci tensor and Christoffel symbols in Mathematica?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=8895

I am seeking a convenient and effective way to calculate such geometric quantities. I’ve used packages like TensoriaCalc, but they don’t work at all time. Sometimes, I run into the following error:

asked by Zoe Rowa https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=1713 38 votes

answered by Yi-Zen Chu https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=4869 18 votes

Figuring when the minute and hour hand coincide on a clock

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=573

I would like to list all possible times in a 12-hour period, where the hour hand overlaps the minute hand completely. This is really a question about three distinct things - to be done in Mathematica ...

asked by Steve D https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=191 15 votes

answered by Verbeia https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=8 21 votes

xkcd-style Plots

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=11350

I received an email to which I wanted to respond with a xkcd-style graph, but I couldn’t manage it. Everything I drew looked perfect, and I don’t have enough command over PlotLegends to have these ...

asked by Amatya https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=2039 613 votes

answered by Simon Woods https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=862 472 votes

Are you interested in purchasing David Wagner’s "Power programming with Mathematica"?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=16485

I recently contacted McGraw-Hill to see if they have a mechanism in place for printing out-of-print books that are still of interest. Specifically, I asked about "Power programming with Mathematica" ...

asked by Todd Allen https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=249 158 votes

answered by Todd Allen https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=249 233 votes

Parallel and perpendicular symbol from Mathematica to LaTeX

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=46538

I want to get the following expression from Mathematica to LaTeX:

 
\begin{bmatrix} 
E_{\parallel} \\ E_{\perp} 
\end{bmatrix}

I have tried to use inbuilt ’symbol’ character from the special ...

asked by Steve Hatcher https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=13314 18 votes

answered by Sjoerd C. de Vries https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=57 26 votes

Mathematica Minecraft

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=19669

Some time ago I asked myself: with all these great graphics and interactive capabilities of Mathematica, what kinds of 3D games can be implemented in it? And the answer which came to mind is ...

asked by faleichik https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=219 164 votes

answered by faleichik https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=219 234 votes

Labeling individual curves in Mathematica

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=4444

I need to create a plot for export and inclusion in a report. Is there a better way to label curves than PlotLegends? From what I’ve read and my personal experience, PlotLegends is pretty bad.

asked by Tianxiang Xiong https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=1041 62 votes

answered by Artes https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=184 46 votes

2.21.3 Can you answer these questions?

How to include a meter in Manipulate that shows a value calculated from the manipulate dynamic variable?
Measuring the time remaining until completion for built in functions
creating uppertriangularized matrix

How to include a meter in Manipulate that shows a value calculated from the manipulate dynamic variable?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225465

I’m trying to make a visualization of grid (representing magnetic states) and I want to include a meter that shows a variable calculated from the manipulate index

(of the form J1/J2 = (index)*0.1) so  ...

asked by mike1994 https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=73104 1 vote

Measuring the time remaining until completion for built in functions

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225436

All of the functions in How to create a progress bar?, the ProgressIndicator built-in and Monitoring lengthy computations estimate the completion time for implementation of operations that are ...

asked by thinkingdude https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=73139 1 vote

creating uppertriangularized matrix

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=225231

I am trying to create an uppertriangularized matrix of arbitrary size,max of the form

{{1,2,3,4,5},{0,1,2,3,4},{0,0,1,2,3},{0,0,0,1,2},{0,0,0,0,1}} 
 
using the code 
table = Table[mu^(j - 1)  ...

asked by Z Ming Ma https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=70345 1 vote