2.21.1 Top new questions this week

2.21.1.1 How to solve the Monty Hall problem?
2.21.1.2 Change Opacity along a ListLinePlot
2.21.1.3 Use Cases with empty cells in the list
2.21.1.4 Writing compiled functions as fast as Python’s Numba
2.21.1.5 Why are more highly nested lists often not more memory and time-intensive?
2.21.1.6 Correcting the Color Scale of a MatrixPlot
2.21.1.7 Verify an inequality of many parameters
2.21.1.1 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

2.21.1.2 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

2.21.1.3 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

2.21.1.4 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

2.21.1.5 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

2.21.1.6 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

2.21.1.7 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