## Chapter 3Year 2018

### 3.1 Tuesday, January 16, 2018

#### 3.1.1 Top new questions this week

##### How can I access NASA images and APIs?

I &heartsuit; NASA. You &heartsuit; NASA. We all &heartsuit; NASA.

So how can I use the images and things they expose in their APIs in Mathematica?

##### Access last variable in a pure function?

# is the first argument of a pure function, #n the nth, ## are all
variables and ##n all beginning with the nth variable.

Now, I would like to access the last argument. In a list, this would be ...

##### Ordered RandomSample

This feels like a basic question yet I failed to ﬁnd an answer.

  (*arbitrary list of unique elements, does not need to be sorted*)
list = CharacterRange["a", "h"];
n = 5;

RandomSample[ list, n]

##### Possible bug in Refresh[x, None] on the very ﬁrst x = val

Bug introduced in 8 or earlier and persisting through 11.2.0


>From Refresh docs:

Refresh[expr,None] specifies that the value of expr
should never automatically be refreshed.

ClearAll[z]
...

##### How to launch a separate Java VM on each sub-Kernel?

I have some code that process very large ﬂat ﬁles in to separate HSQL(Standalone) databases using ParallelSubmit and JDBC for each ﬁle using the strategy in this post (19542). Lately I keep ...

##### Three diﬀerential equations

I have the next ﬁgure with inﬂow and outﬂow rates:

And I need to calculate the time for which the pollution will be 50% from the initial value. Assuming that all lakes have the same pollution ...

##### How can I create an enumeration variable by groups?

I copied the title and concept for this question from here. I have

data = {{"ID", "Value"}, {1, 48}, {1, 45}, {1, 52}, {1, 43}, {1,
41}, {2, 50}, {2, 42}, {2, 51}, {2, 52}, {bb, 52}, {bb, 54},  ...

#### 3.1.2 Greatest hits from previous weeks

##### Labeling individual curves in Mathematica

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.

Is ...

##### Where can I ﬁnd examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I’m always looking out for ways to either improve my way of doing things in Mathematica, or to see if there’s something nifty that I haven’t ...

#### 3.1.3 Can you answer these?

##### Why BoundingRegion does not work well?

Bug introduced in 10.0 and persisting through 11.2.0

I have a set of data points describing an ellipse in the plane. I want to obtain the best ellipse that ﬁts them.

As a ﬁrst attempt, I use ...

##### Are integrals with coalescing saddles available in the core Mathematica or in standard packages?

I was having a look at the DLMF chapter on integrals with coalescing saddles, and there are a few things that I’d like to try out with the functions it describes, including e.g. the Pearcey integral,

##### Can FindFit be used with units?

I am trying to use the units capabilities of Mathematica throughout a course that I am teaching, but am ﬁnding that it isn’t uniformly implemented across many functions. In particular, I would love ...

asked by Kevin Ausman (1 vote)

### 3.2 Tuesday, January 9, 2018

==================================
Top new questions this week:
==================================

[Why is Unevaluated[#]& diﬀerent from Unevaluated?] https://mathematica.stackexchange.com/questions/163291/why-is-unevaluated-different-from-unevaluated

{a, b, c} = {1, 2, 3};
Unevaluated /@ Unevaluated@{a, b, c}
(* {Unevaluated[a], Unevaluated[b], Unevaluated[c]} *)
Unevaluated[#]&amp; /@ Unevaluated@{a, b, c}
(* {Unevaluated[1], Unevaluated[2],  ...

—————————-

[Building a GitBook with Mathematica] https://mathematica.stackexchange.com/questions/163193/building-a-gitbook-with-mathematica

GitBook is a fun little website that will take Markdown source material and build a little book out of it.

How can I use Mathematica to build a GitBook with a minimum of eﬀort?

—————————-

[How to create a vertical bullet gauge?] https://mathematica.stackexchange.com/questions/163201/how-to-create-a-vertical-bullet-gauge

Originally posted in MathematicaMeta SE, titled "I can’t understand why Mathematica has an excellent (perhaps the best!) BulletGauge command (with multiple options)", as a reﬂexion about the ...

—————————-

[Specialized form of Outer[f, list, list] for symmetric f] https://mathematica.stackexchange.com/questions/163240/specialized-form-of-outerf-list-list-for-symmetric-f

Consider a function f that is symmetric with regard to its two arguments i.e. f[x,y] == f[y,x]. Using Outer one can for instance build a correspondence matrix that computes some distance measure f ...

—————————-

[How to convert a string having nested parentheses into an expression?] https://mathematica.stackexchange.com/questions/163184/how-to-convert-a-string-having-nested-parentheses-into-an-expression

I am a Wolfram Language/Mathematica beginner and trying to convert STEP ISO10303 commands into geometrical regions. A simple command looks like

(vector(a,(b,c)),line(d,(e,f))

I tried with String ...

—————————-

[Is there any way to speed up this code that’s Maximizing a function got from numerical integration?] https://mathematica.stackexchange.com/questions/163204/is-there-any-way-to-speed-up-this-code-thats-maximizing-a-function-got-from-num

I have this code below, which is calculating the Binding energy of an electron in a Quantum Well Wire with a hydrogenic impurity in it. Well you don’t have to care much about what kind of calculation ...

—————————-

[Joining all the keys of a list of rules that point to matching values] https://mathematica.stackexchange.com/questions/163068/joining-all-the-keys-of-a-list-of-rules-that-point-to-matching-values

Suppose I have a list of rules whose keys are not of identical structure (in my case, the keys are either lists of at least one symbol or symbols alone):

rules = {{a} -&gt; 1, {b, c} -&gt; 1, d -&gt;  ...

================================== Greatest hits from previous weeks: ==================================

[How to calculate scalar curvature Ricci tensor and Christoﬀel symbols in Mathematica?] https://mathematica.stackexchange.com/questions/8895/how-to-calculate-scalar-curvature-ricci-tensor-and-christoffel-symbols-in-mathem

I am seeking a convenient and eﬀective 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: ...

—————————-

[xkcd-style Plots] https://mathematica.stackexchange.com/questions/11350/xkcd-style-plots

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 ...

================================== Can you answer these? ==================================

[Is ClearAttributes built-in functon work in current cell only?] https://mathematica.stackexchange.com/questions/163223/is-clearattributes-built-in-functon-work-in-current-cell-only

I have a question. Is ClearAttributes the built-in functon work in current cell only? This is my code:

In first cell:

Set[a, 6]

In second cell:

ClearAttributes[Set, HoldFirst]
Attributes[Set]
...

- asked by SIJA (1 vote)

—————————-

[How to convert Piecewise into KroneckerDelta form by FullSimplify?] https://mathematica.stackexchange.com/questions/163274/how-to-convert-piecewise-into-kroneckerdelta-form-by-fullsimplify

The question comes from the last example of this topic in the Wolfram documentation.

SeriesCoefficient[E^x^2, {x, 0, n}]

However, my (v11.1) output is

\$\begin{cases}
\frac1{{\sf  ...

- asked by ooo (1 vote)

—————————-

[Code behind these Video Playback demos?] https://mathematica.stackexchange.com/questions/163008/code-behind-these-video-playback-demos

There are only two known examples of video playback (from a ﬁle) within a (non-cloud) notebook:

Visualizations in Graph Theory with the Wolfram Language (at time 3:32) Mathematica and CUDA, ...

### 3.3 Tuesday, January 2, 2018

==================================
Top new questions this week:
==================================

[What’s the default colormap (or color scheme) used in mathematica?] https://mathematica.stackexchange.com/questions/162883/whats-the-default-colormap-or-color-scheme-used-in-mathematica

or here: ...

—————————-

[$${\frac {\partial ^{2} u}{\partial {x}^{2}}} +{\frac {\partial ^{2} u}{\partial {y}^{2}}} =0$$ with one boundary at inﬁnity] https://mathematica.stackexchange.com/questions/162691/frac-partial2-u-partial-x2-frac-partial-2-u-partial

Is there a trick to make Mathematica solve

${\frac {\partial ^{2} u}{\partial {x}^{2}}} +{\frac {\partial ^{2} u}{\partial {y}^{2}}} =0$ with one boundary condition at $$\infty$$?

Boundary ...

—————————-

[How to make simple closed curve that can be smoothly morphed using locators] https://mathematica.stackexchange.com/questions/162711/how-to-make-simple-closed-curve-that-can-be-smoothly-morphed-using-locators

Given a simple closed curve in 2D with some locators on it, I would like to have be able to stretch and squish parts of the curve by moving the locators to morph the curve into another simple closed ...

—————————-

I want to approximate some functions with basisfunctions, which can be easy Fourier-transformed. So I got the idea to approximate my function with Gaussian normal-distribution curves. This led me to ...

—————————-

[How to Discretize the Following Region Using Reasonable Bounds?] https://mathematica.stackexchange.com/questions/162674/how-to-discretize-the-following-region-using-reasonable-bounds

I want to accurately discretize the implicit equation $$x^2+x+y^2+\sin (4xy)+\sin (3xy)=3.9$$.

To get the whole discretized shape, I’m forced to use oversized bounds x,-70,80 and y,-70,80

curve = ...

—————————-

[Replacement for GraphJoin] https://mathematica.stackexchange.com/questions/162900/replacement-for-graphjoin

According to MathWorld » GraphJoin, Mathematica could compute the join of two graphs with the GraphJoin command, part of Combinatorica. This command no longer works as of v10, and I cannot ﬁnd a ...

—————————-

[How can I make a DensityPlot3D over a triangle?] https://mathematica.stackexchange.com/questions/162852/how-can-i-make-a-densityplot3d-over-a-triangle

I know that I can plot over 3D-regions like balls via

DensityPlot3D[(x^2 + y^2 + z^2)^2, {x, y, z}  Ball[{0, 0, 0}, 1]]

But, not surprisingly, this breaks down for 2D-regions like triangles.

How ...

================================== Greatest hits from previous weeks: ==================================

[How do I clear all user deﬁned symbols?] https://mathematica.stackexchange.com/questions/850/how-do-i-clear-all-user-defined-symbols

Is there some way to do this other than going to Evaluation -&gt; Quit kernel and ﬁring a new one up?

—————————-

[How to calculate contour integrals with Mathematica?] https://mathematica.stackexchange.com/questions/34073/how-to-calculate-contour-integrals-with-mathematica

How to calculate the integral of $$\frac {1}{\sqrt {4 z^2 + 4 z + 3}}$$ over the unit circle counterclockwise for each branch of the integrand?

================================== Can you answer these? ==================================

[Apply a classiﬁer to a column in excel and export side by side result?] https://mathematica.stackexchange.com/questions/162901/apply-a-classifier-to-a-column-in-excel-and-export-side-by-side-result

I’m relatively new to using Mathematica, and I was able to create a Classiﬁer from a training set of about 3,000 pairs of non-numerical text strings.

I have my test set of about 20,000 records in an ...

—————————-

[Solving a cumulative distribution from a ﬁrst order condition] https://mathematica.stackexchange.com/questions/162825/solving-a-cumulative-distribution-from-a-first-order-condition

I could use some guidance in using Mathematica’s NDSolve. I’m attempting to numerically uncover a cumulative distribution function (CDF), $$F(p)$$, with density $$f(p)$$ from a ﬁrst order condition, ...

- asked by J.R. (1 vote)

—————————-

[Fourier | Examples | Applications | Frequency Identiﬁcation: high resolution: what trick is this?] https://mathematica.stackexchange.com/questions/162661/fourier-examples-applications-frequency-identification-high-resolution-w

My question is regarding one of the examples in the Documentation Center for the built-in symbol Fourier:

Fourier | Examples | Applications | Frequency Identiﬁcation

Fourier is used to ﬁnd the ...

- asked by Jack (1 vote)