Chapter 3
Year 2018

 3.1 Tuesday, January 16, 2018
 3.2 Tuesday, January 9, 2018
 3.3 Tuesday, January 2, 2018

3.1 Tuesday, January 16, 2018

  3.1.1 Top new questions this week
  3.1.2 Greatest hits from previous weeks
  3.1.3 Can you answer these?

3.1.1 Top new questions this week

   How can I access NASA images and APIs?
   Access last variable in a pure function?
   Ordered RandomSample
   Possible bug in Refresh[x, None] on the very first x = val
   How to launch a separate Java VM on each sub-Kernel?
   Three differential equations
   How can I create an enumeration variable by groups?

How can I access NASA images and APIs?

https://mathematica.stackexchange.com/questions/163638/how-can-i-access-nasa-images-and-apis

I ♥ NASA. You ♥ NASA. We all ♥ NASA.

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

- asked by b3m2a1 (23 votes), answered by b3m2a1 (29 votes)

Access last variable in a pure function?

https://mathematica.stackexchange.com/questions/163469/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 ...

- asked by riddleculous (13 votes), answered by Henrik Schumacher (14 votes)

Ordered RandomSample

https://mathematica.stackexchange.com/questions/163498/ordered-randomsample

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

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

asked by Kuba (11 votes), answered by Coolwater (13 votes)

Possible bug in Refresh[x, None] on the very first x = val

https://mathematica.stackexchange.com/questions/163559/possible-bug-in-refreshx-none-on-the-very-first-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] 
 ...

asked by Kuba (8 votes)

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

https://mathematica.stackexchange.com/questions/163387/how-to-launch-a-separate-java-vm-on-each-sub-kernel

I have some code that process very large flat files in to separate HSQL(Standalone) databases using ParallelSubmit and JDBC for each file using the strategy in this post (19542). Lately I keep ...

asked by Edmund (8 votes), answered by Edmund (5 votes)

Three differential equations

https://mathematica.stackexchange.com/questions/163566/three-differential-equations

I have the next figure with inflow and outflow 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 ...

asked by Darius Ionut (8 votes), answered by Henrik Schumacher (8 votes)

How can I create an enumeration variable by groups?

https://mathematica.stackexchange.com/questions/163764/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},  ...

asked by ramesh (7 votes), answered by kglr (8 votes)

3.1.2 Greatest hits from previous weeks

   Labeling individual curves in Mathematica
   Where can I find examples of good Mathematica programming practice?

Labeling individual curves in Mathematica

https://mathematica.stackexchange.com/questions/4444/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 ...

asked by Tianxiang Xiong (53 votes), answered by Artes (41 votes)

Where can I find examples of good Mathematica programming practice?

https://mathematica.stackexchange.com/questions/18/where-can-i-find-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 ...

asked by J. M. (483 votes), answered by faysou (430 votes)

3.1.3 Can you answer these?

   Why BoundingRegion does not work well?
   Are integrals with coalescing saddles available in the core Mathematica or in standard packages?
   Can FindFit be used with units?

Why BoundingRegion does not work well?

https://mathematica.stackexchange.com/questions/163756/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 fits them.

As a first attempt, I use ...

asked by José Antonio Díaz Navas (5 votes)

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

https://mathematica.stackexchange.com/questions/163581/are-integrals-with-coalescing-saddles-available-in-the-core-mathematica-or-in-st

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,

asked by Emilio Pisanty (2 votes)

Can FindFit be used with units?

https://mathematica.stackexchange.com/questions/163391/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 finding 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[#]& different 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[#]& /@ Unevaluated@{a, b, c} 
(* {Unevaluated[1], Unevaluated[2],  ...

- asked by Roman (18 votes), answered by Szabolcs (19 votes)

—————————-

[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 effort?

- asked by b3m2a1 (14 votes), answered by b3m2a1 (18 votes)

—————————-

[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 reflexion about the ...

- asked by Mika Ike (10 votes), answered by kglr (14 votes)

—————————-

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

- asked by Sascha (9 votes), answered by Henrik Schumacher (5 votes)

—————————-

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

- asked by Markus Sonderegger (9 votes), answered by John Doty (9 votes)

—————————-

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

- asked by tyler_house (7 votes), answered by Michael E2 (7 votes)

—————————-

[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} -> 1, {b, c} -> 1, d ->  ...

- asked by user170231 (7 votes), answered by Kuba (10 votes)

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

[How to calculate scalar curvature Ricci tensor and Christoffel 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 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 (29 votes), answered by Yi-Zen Chu (12 votes)

—————————-

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

- asked by Amatya (554 votes), answered by Simon Woods (409 votes)

================================== 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 file) within a (non-cloud) notebook:

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

- asked by user5601 (3 votes)

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

For example, the colors used on this page: http://reference.wolfram.com/language/ref/ContourStyle.html

or here: https://www.wolfram.com/mathematica/new-in-10/plot-themes/default.html

or here: ...

- asked by Alex (8 votes), answered by kglr (7 votes)

—————————-

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

Is there a trick to make Mathematica solve

 2      2
∂-u-+ ∂--u = 0
∂x2    ∂y2

with one boundary condition at \(\infty \)?

Boundary ...

- asked by Nasser (8 votes), answered by ZufolgeWeierstrass (13 votes)

—————————-

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

- asked by Michael McCain (8 votes), answered by halirutan (12 votes)

—————————-

[Approximation with radial basis functions] https://mathematica.stackexchange.com/questions/162768/approximation-with-radial-basis-functions

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

- asked by pcalc (7 votes), answered by Anton Antonov (7 votes)

—————————-

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

- asked by Arbuja (7 votes), answered by Carl Woll (5 votes)

—————————-

[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 find a ...

- asked by Bryan Clair (5 votes), answered by kglr (6 votes)

—————————-

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

- asked by java4ever (5 votes), answered by rcollyer (7 votes)

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

[How do I clear all user defined 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 -> Quit kernel and firing a new one up?

- asked by niklasfi (66 votes), answered by Artes (63 votes)

—————————-

[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?

- asked by user64494 (31 votes), answered by Artes (54 votes)

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

[Apply a classifier 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 Classifier 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 ...

- asked by M0RPH0RX (2 votes)

—————————-

[Solving a cumulative distribution from a first 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 first order condition, ...

- asked by J.R. (1 vote)

—————————-

[Fourier — Examples — Applications — Frequency Identification: 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 Identification

Fourier is used to find the ...

- asked by Jack (1 vote)