Chapter 1Year 2021

1.1 Thursday, May 27, 2021

1.1.1 Top new questions this week

Is Internal‘StringToDouble broken in 12.3?

I believe InternalStringToDouble was the only way to fast convert string into numbers. Now in V12.3 it was removed: InternalStringToDouble["1"]

in V 12.3, expression in notebook shakes when scrolling mouse to edit them. How to stop this eﬀect?

I noticed in V 12.3, when trying to edit an expression in a cell, and moving/scrolling the mouse, the expression itself shakes. It seems to auto-resize or adjust while one is editing it. This does not ...

Programming language prototyping in Mathematica

Are you aware of any projects using the Wolfram language resp. Mathematica as an environment to explore the design of programming languages - in particular languages with a focus on mathematics (...

WriteString to TCP socket appears to be broken in Mathematica 12.3

I have a large codebase in which some functions make calls to Python TCP servers. The code used to work perfectly in Mathematica 12.2, but has not worked since I ...

DirichletCondition doesn’t always work with RegionBoundary

I am trying to solve the heat equation on a circle with a square shaped hole in it. It works:

What are the key reasons for the performance improvements in 12.3?

The built in benchmark test on my stationary workstation shows an improvement from 2.82 to 5.99, all other hardware and operating systems settings the same. This looks very good. My question is: What ...

Default window size too small in version 12.3 (in Windows 10)

After starting Mathematica 12.3, the default window size is like this, it’s too small for me, I don’t want to manually drag the window every time. I have tried this,

1.1.2 Greatest hits from previous weeks

Multivariable Taylor expansion does not work as expected

The basic multivariable Taylor expansion formula around a point is as follows:

$f(\mathbf r + \mathbf a) = f(\mathbf r) + (\mathbf a \cdot \nabla )f(\mathbf r) + \frac {1}{2!}(\mathbf a \cdot \nabla )$

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?

What does ”Tag Integer is Protected” message mean?

(Newbie question)

For every function I deﬁne I get this message: When I close and reopen Mathematica, and re-enter the function deﬁnition, I don’t get the message anymore. What does it mean?

Is there an open source implementation of Mathematica-the-language?

I’ve seen questions before such as ”What is the best open-source equivalent for Mathematica?”, but that speciﬁc question (and that line of inquiry in general) cares more about the computer algebra ...

How to express trigonometric equation in terms of of given trigonometric function?

How can I express a trigonometric equation / identity in terms of a given trigonometric function?

using following trigonometric identities

How can I plot a graph of an integral?

I want to plot the following function:

$\int \left (\frac {\Gamma (x+1)}{2}-\frac {\Gamma (x-1)}{2}\right ) \, dx$

Find eigen energies of time-independent Schrödinger equation

I’m trying to get the eigenvalues of a one dimensional time-independent Schrödinger equation,

$$-\frac {h^2}{2m_0}\frac {d^2\psi }{dx^2}+U(x)~\psi =Ei~\psi$$

where $$U(x)$$ is some potential and Ei is the ...

1.1.3 Can you answer these questions?

What is ”Flatten” doing to my elements?

Here’s some of my code. x1 results in returning the position of a list in a {{{n1}},{{n2}}...}. Im trying to ﬂatten it such that the list reads out as {n1,n2,n3....} some how it’s adding elements.

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

Inconsistent boundary and initial conditions when solving sine Gordon equation

I have been trying to solve the following sine Gordon equation $$\partial _{x,x} u(x,t) - \partial _{t,t} u(x,t) - \sin (u(x,t)) - \alpha \partial _t u(x,t) + \gamma = 0$$, for $$x \in [0,15]$$ and

asked by Đạt Lê Thành https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=68852 1 vote

Step-by-step solution for a Limit

Is it possible in Mathematica to get a step-by-step evaluation of some functions? Such that Mathematica is outputting not only the result but all the stages that have led to it? If so, how does one do ...

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

1.2 Thursday, May 20, 2021

1.2.1 Top new questions this week

Stable ﬂuids code for electromagnetic mixture application

This code has been translated from the original Jos Stam code and improved with some Mathematica functions. It solves problem of viscous incompressible ﬂow with electromagnetic force in a rectangle ...

How can I create an animation showing how a circular sector deformed to a cone?

I want to create the following animation with Mathematica.

What is the simplest way to do so? My ﬁrst eﬀort:

Dataset from association of lists doesn’t work

Mathematica 12 on wolfram cloud isn’t rendering the table for an association of lists. According to the documentation you should be able to make columns in the table by:

However I tried this

Creating the Yin Yang symbol with minimal code

The following code creates the Yin Yang symbol

On the ordering of the vertices of a polygon

Writing:

pts = {{1, 0}, {2, 0}, {2, 3}, {3, 3}, {3, 4}, {0, 4}, {0, 3}, {1, 3}, {1, 0}};
Graphics[{Red, Point[pts], Blue, Line[pts]}]

we get:

and all of this ...

Is it possible to vary the thickness of curves according to their color code

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=246125 I have this data data = Table[{x, Sin[5 x], Tanh[3 x]}, {x, -1, 1, 0.01}];

which I plot as follows

How can I style a Line like ”Glassrectangle”?

I’d like a thick Line to look like ChartElementFunction -> "GlassRectangle" How can that be accomplished?

1.2.2 Greatest hits from previous weeks

What’s the most diﬃcult multidimensional integral that Mathematica has solved?

I am interested in benchmarking numerical integration methods and am trying to develop a wider set of diﬃcult multivariate examples. For my particular methods, I only want to look at non-negative-...

Extract real part of a complex expression better than Re does

I have a complex expression with real positive variables only.

Mathematica Input Style:

Exporting graphics to PDF - huge ﬁle

I want to draw some basic surfaces, export them to PDF and include them in a LaTeX ﬁle. I create a simple 3D graphics object, for instance with

My Girlfriend is going to prison...Save her with Math

Salacious title, but true story.

How to plot an ellipse?

I’m new to Mathematica, and I’m ﬁnding it diﬃcult to plot an ellipse. I tried using

Plot[(x/5)^2 + (y/3)^2 == 1, {x, -5, 5}, {y, -3, 3}]

but I’m getting ...

Is there something like DensityPlot3D to visualize atomic orbitals?

I’m visualizing some hydrogen like atomic orbitals. For looking at plane slices of the probability density, the DensityPlot function works well, and with something ...

Calling Correct Function for Plotting DiracDelta

I am wondering what is the correct function in Mathematica to plot the true impulse function, better known as the DiracDelta[] function. When using this inside of a ...

1.2.3 Can you answer these questions?

Speeding up this function?

https://mathematica.stackexchange.com/landing/r/digest?cta=question&id=246242 Is there a way to speed this function?

Error when integrating with constants?

I’m trying to integrate an ellipse: (x^2)/alpha^2) + ((y^2)/beta^2) = 1. I am not sure if I should have insert constants for alpha and beta or if there’s a way to keep them there.

This is my code

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

Is there an analog of ArrayQ for datasets?

ArrayQ provides a nice way to check for missing data (speciﬁcally, it checks if the array is ragged). But if you import your data as a dataset, and apply ArrayQ, it will return False for both ragged ...

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

1.3 Thursday, May 13, 2021

1.3.1 Top new questions this week

Finding ”chains” of numbers in a matrix

To give some context, this problem is related to music theory. I have a matrix I’m generating with this code:

How to formulate this problem in Mathematica?

Say, I have the following expressions

f = R[p]
g = S[p]

where R,S are rational functions, and I want to ﬁnd a polynomial such that

Problem with optimal control and Pontryagin’s maximum principle

For dynamic system: $$\dot {x}=\frac {df}{dx}+u$$ where $$f=e^{-x^2}$$ It is necessary to develop optimal control, minimizing criterion: $$J= \int _{0}^{t_f} ((\frac {df}{dx})^2+u^2) \,dt$$ Algorithm:

We ...

Sorting Associations by DayName (day of week) using KeySort and/or KeySortBy

I have an association where the keys are the days of the week:

Using the PowerPoint’s laser pointer in symbols of plots

I am interested in exploiting a symbol that is similar to the PowerPoint’s laser pointer in the role of PlotMarkers. Is there any idea to create that!? This symbol ...

How would one add Hyperreals as a new type to Mathematica?

Hyperreals are an extension to the real numbers; they formalise the concepts of inﬁnities and inﬁnitestimals as numbers, rather than the named limit points outside of the system of reals and form ...

Extract held value from Association

Consider an association which contains a key which must not be prematurely evaluated. assoc = <| key :> value |>

For example, a value of ...

1.3.2 Greatest hits from previous weeks

1 Plot, 2 Scale/Axis

I would like to plot those two datasets on top of each other. But they have very diﬀerent range on the $$y$$ axis. How can I have two diﬀerent axis?

I found the following on the help menu but quite ...

How to perform a multi-peak ﬁtting?

I am wondering how to implement the multi-peak detecting and ﬁtting in Mathematica. Following is an example of ﬁtting the data using three peaks (such that the data ~ peak1 + peak2 + peak3). The ...

Standard deck of 52 playing cards in curated data?

I am not sure how to ﬁnd out what all is included as curated data. For example, are the individual images of each of the 52 cards in a standard deck of playing cards included?

If not, is there a way ...

Is it possible to export the equations from Mathematica to MATLAB?

Is it possible to export the output expressions from Mathematica computations (e.g., equations) in valid MATLAB syntax?

LaTeXand Mathematica

I quite often would like to draw graphics in my LaTeXdocuments using Mathematica. I have encountered three problems. I would like to know if there are any workarounds to these problems

I would ...

How can I plot implicit equations?

If you enter the following into Wolfram — Alpha, you get nice graphs:

graph 4 x^4 + y^2 = 2

How do you do this in Mathmatica? I realize that these are not ...

Calling Correct Function for Plotting DiracDelta

I am wondering what is the correct function in Mathematica to plot the true impulse function, better known as the DiracDelta[] function. When using this inside of a ...

1.3.3 Can you answer these questions?

Excess lines in the solution plot of vector ODE

I’ve got an ODE system, which I attempt to solve by two ways: solving the system itself, and using vector ODE. Here is code of ﬁrst way:

Algorithmically imposing a substitution in a diﬃcult integral

Consider the following integral: $I = \frac {1}{\pi c^2} \int \limits _{r=0}^c 2 \pi r\ e^{-\frac { \left (\sqrt {a^2 - r^2} -\sqrt {b^2 - r^2} \right )}{\lambda }}\ dr$ under the conditions $$a>b>c>$$...

How to expand a rational function as a single fraction

This has been annoying me for a long time. I want a rational function to be represented in the form

But this seems to be quite diﬃcult. Mathematica ...

1.4 Thursday, April 29, 2021

1.4.1 Top new questions this week

Replacing duplicates instead of deleting them

My code replaces each repeated element by ”X”.

RecurrenceTable and While

Good day. Let’s take an example from Help on RecurrenceTable

Speed up averaging of numerically solved diﬀerential equations

I deals with a coupled system with non-linear diﬀerential equations of ﬁrst order. I perform numerical solution with NDSolve and then use obtained solutions,

answered by Alex Trounev https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=58388 1 vote

FEM: how to redo a composed boundary mesh for better quality?

Suppose you have region with 2 materials: one embedding material matrix containing some particles

Were these Images made with Wolfram Language / Mathematica?

I am currently writing a paper in which Fibonacci Spirals are discussed. In the text of the paper the mathematics of these objects is discussed and the relevant equations and relationships are shown ...

How to ﬁnd the repeated elements in a vector

Is there a way to write a function where the input is a vector and the output is the elements in the vector that are repeated? I was trying to use something along the lines:

How to separate two regions in DensityPlot

I want to separate two regions in DensityPlot similar to the attached image.

In my code and the obtained result, I want to separate the region with less value of one from others. How can I do this? ...

1.4.2 Greatest hits from previous weeks

How to graph a sphere with cartesian equations?

I’m new to Mathematica and I need to ask how to graph a sphere, cylinder, etc.. using cartesian equations.

For example in sphere’s case $$x^2+y^2+z^2=1$$

I tried to use ...

Parallel and perpendicular symbol from Mathematica to LaTeX

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

How do I make a 3DPlot using cylindrical coordinates?

I’m trying to plot a function of the form $$z(r,\theta )$$ where $$r \in [0, R]$$ for a ﬁnite R, $$\theta \in [0,2\pi [$$, and z is the third coordinate, a function of the ﬁrst two. I couldn’t ﬁnd anything ...

What does Compile[] do to make code run so much faster?

I am looking for an ELI5 explanation of whatCompile[] in the Wolfram Language context does and why it works so much faster than uncompiled code in certain cases. I am trying to get more insight to ...

How do I clear all user deﬁned symbols?

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

Formatting legend text font

I am using this code to plot a graph, and I am trying to make the font of the legend bigger.

How can I plot the direction ﬁeld for a diﬀerential equation?

I’d like to plot the graph of the direction ﬁeld for a diﬀerential equation, to get a feel for it. I’m a novice, right now, when it comes to plotting in Mathematica, so I’m hoping that someone can ...

1.4.3 Can you answer these questions?

Artifacts When Plotting Results of Numerical Integration

I am trying to reproduce the following graph of phase shifts as function of frequency.

Please see my code bellow. I used Mathematica to solve for t1 and ...

How to solve a system with inﬁnitely many equations?

I need to solve the following system of (inﬁnitely many) equations. I am looking for $$V(0,0)$$

$$t \in \{0,1,2.....\}$$ with one caveat that $$s \leq 1+t$$ should hold.

$$s \in \{1,2,3,L-1\}$$

ﬁxed ...

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

Custom multiplication operation between variables

I am constructing polynomial expressions in the variables $$s[0],s[1],...,s[n]$$ and I’m trying to deﬁne a new operation to simplify the expression:

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

1.5 Thursday, April 22, 2021

1.5.1 Top new questions this week

joining three lists to plot data with errors

I have three lists:

x = {x1, x2, ...},
y = {y1, y2, ...},
yErr = {y1Err, y2Err, ...}

that I want to join into the following format:

There are two ways (afaik) to parse traditional math string to an expression:

Is it possible to deﬁne conjugate of a function?

Could you help me, please? I have two complex functions of real variable f[x] and fc[x] such that one is a conjugate of another one. I’d like to take a conjugate of an expression that includes both of ...

Maximal circle packing inside a given square

How to pack n equal disks(radius a/2) with maximal area inside a given rectangle ? I’m trying to solve this problem using Mathematicas Region functions. Here my approach: Maximize the area of the ...

Some doubts about symbolic equations in Wolfram Mathematica

I need to perform the following operations using Wolfram Mathematica. I have these equations:

I need to obtain $$k$$ as a function of: $$a,b,c,e,\dots$$

Count number of balls in each bin, given a two-element sequence of balls and bins

If I have a list:

{ball,ball,BINDIVIDER,ball,ball,ball,BINDIVIDER,BINDIVIDER,ball,BINDIVIDER,ball}

The balls and bins can be in any permutation. Then, the ...

FEM: elastic cylinder under circumferential pressure

Suppose you have an elastic cylinder of radius $$R$$ and height $$H$$ and you want to solve the mechanical 3D equilibrium with Mathematica’s FEM. How do you impose a pressure $$p$$ only on the cylinder ...

1.5.2 Greatest hits from previous weeks

Plot data from txt ﬁle?

I have data in ﬁle.txt which can be expressed by 20000x11 matrix. I do not want to import all of these data. How can I plot graph of the column 1 & column 4?

How to make a Spherical Cow?

Being a theoretical physicist, I always have a great respect for Spherical Cow. So I thought about making one myself. I am not sure how can I create (something considered to be the simplest!) this ...

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...

My Girlfriend is going to prison...Save her with Math

Salacious title, but true story.

Plotting the Star of Bethlehem

Christmas is around the corner! In preparation, consider the polynomial f[x_,y_]:= 1/10 (4 - x^2 - 2 y^2)^2 + 1/2 (x^2 + y^2)

and deﬁne $$r=(f_x,f_y)$$ using the ...

Generate a Unit Circle Trigonometry

Struggling often with Trigonometry I would like to have some code to generate this Unit Circle Trigonometry. Would be of great help when I need to transform some data :

Extract real part of a complex expression better than Re does

I have a complex expression with real positive variables only.

Mathematica Input Style:

1.5.3 Can you answer these questions?

Understanding the behavior of HypergeometricPFQ

this is my very post here, so I apologize for any possible format issue. I am using HypergeometricPFQ functions (more exactly $$_3F_2$$) as approximants for other more complicated functions. Here are ...

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

recursively ﬁnd StringCases

Can I recursively extract StringCases[] that match a speciﬁc pattern? Here is a minimalist example (not my actual problem):

How to specify custom Loss function for Predict

How can I use Predict[Xs->Ys, Method->"NeuralNetwork"] to predict 90%-quantile (instead of mean value)? Utility Function does not work well for this case, because

it assumes ...

1.6 Thursday, April 15, 2021

1.6.1 Top new questions this week

Is there a neat code to swap elements of a list?

I want to swap the list to make a new list as follows. The code works but I’m wondering if there is a neat code, or an elegant way to do this.

Stokes equations in 2D with traction boundary conditions

This is a follow-up to a previous question (see here). We would like to solve the two-dimensional Stokes equations using the FEM package in Mathematica, when we prescribe traction boundary conditions. ...

Transform a number to a factorial

I came across the need to transform a number into a factorial n, with positive integer n. I have searched in the MMA information but I can’t ﬁnd anything like that. I imagine an input, which veriﬁes ...

Stopping condition for FindMinimum / FindMaximum

This seems like it should be a simple question – but I am looking to use a ”home made” stopping condition with FindMaximum, while evaluating a very complex function. Printing out the ...

Eﬃciently compute Minkowski sum of a 2D Region and a Disc of radius r?

Given a 2D Mathematica Region, e.g. A = Region[RegionDifference[Disk[{0, 0}, 2], Disk[{2, 0}, 1]]], how can I grow the region by an arbitrary radius r? For example, ...

Random orthogonal matrix

Is there a way to generate real random orthogonal matrices in mathematica? If Q is an orthogonal matrix, it’s properties are

Detecting patterns in a graph network

If we create a random graph

Chop[LowerTriangularize[RandomReal[{-1, 1}, {10, 10}], -1], 0.6] /.0 -> \[Infinity] // MatrixForm
WeightedAdjacencyGraph[%]

How can ...

1.6.2 Greatest hits from previous weeks

What do the X and Y axis stand for in the Fourier transform domain?

In Wolfram Mathematica the function Fourier has the following declaration

Fourier[list]

And after a list is given to the ...

Plot, extract data to a ﬁle

I need to save data that Mathematica uses inside the Plot command. The format that I would like to have is:

x1 y1
x2 y2

Get a ”step-by-step” evaluation in Mathematica

Is it possible in Mathematica to get a step-by-step evaluation of some functions; that’s to say, outputting not only the result but all the stages that have led to it? If so, how does one do it?

How to add a vertical line to a plot

In the plot below I would like to add two vertical lines at $$x = \frac {\pi }{15} \pm \frac {1}{20}$$. How can I do that?

Selecting every n-th element from a list

data = {4, 5, 7, 8, 9, 5, 3, 2, 1, 2, 13, 12};

I want to take those elements in the list which are located at equal distances, say, every third ...

How to graph a sphere with cartesian equations?

I’m new to Mathematica and I need to ask how to graph a sphere, cylinder, etc.. using cartesian equations.

For example in sphere’s case $$x^2+y^2+z^2=1$$

I tried to use ...

Conversion of Sine to Cosine

I’m solving equations with many Cosines and Sines. And I want to convert all the Sines to Cosines using trigonometric formulas such as cos(x)=sin(x+pi/2). How can I do this?

1.6.3 Can you answer these questions?

RandomInstance of GeometricScene producing unexpected result

Consider the following scene as an example:

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

Solving an ordinary diﬀerential equation with boundary condition at inﬁnity

I want to solve the following diﬀerential equation  f''[z] + (1/z)*f'[z] - f[z] + f[z]^3 == 0

subject to the boundary conditions

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

How to use ScalingFunctions with Graphics ChartElements

How to draw spheres with BubbleChart with a reversed vertical axis? The 3rd example shows the problem (empty plot), likely caused by the transformation, but how to correct it?

1.7 Thursday, April 1, 2021

1.7.1 Top new questions this week

Are the maps available in Mathematica copyright-free? For instance, if I generate the image

Find all English words that can be comprised of Element Abbreviations found in the Periodic Table

This question is majorely inﬂuenced by a meme...

Now, I thought... it would be interesting to see what kind of ”passwords” could one derive using Periodic Table :D Hence, I began to work ...

Eﬃcient uniform sampling of certain Boolean matrices

I want to uniformly sample $$(0,1)$$-matrices with certain constraints. In particular, I want sum of each row to be rowsum and the sums of columns to equal ...

Incorrect integration from article?

Recently I came across an interesting article by Daniel Lichtblau, where the integral

Integrate[Abs[x - y]^n, {x, 0, 1}, {y, 0, 1}]

Running Mathematica in ’SpouseMode’

In this previous question I looked into a deprecated capability of Mathematica from Version 2. Mathematica command that allows it to read my intentions Thanks to all for your answers. I note that ...

answered by MikeY https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=47314 1 vote

Putting together several ListPlot 2D in a 3D graphic

I’m trying to put together several diﬀerent 2D plots in a 3D graphics to create a ﬁgure which would be like the one below (taken from https://aip.scitation.org/doi/10.1063/1.4998724 However my ...

Combine SortBy with ReverseSortBy

Suppose I have a dataset, which I want to sort according to two criteria. However, I want the ﬁrst criteria to be sorted ascending, and the second descending. This would require to somehow combine ...

1.7.2 Greatest hits from previous weeks

How to add a front-end to the free Wolfram Engine?

The Free Wolfram Engine for Developers is available for pre-production ...

How to express trigonometric equation in terms of of given trigonometric function?

How can I express a trigonometric equation / identity in terms of a given trigonometric function?

using following trigonometric identities

What’s the most diﬃcult multidimensional integral that Mathematica has solved?

I am interested in benchmarking numerical integration methods and am trying to develop a wider set of diﬃcult multivariate examples. For my particular methods, I only want to look at non-negative-...

Standard deck of 52 playing cards in curated data?

I am not sure how to ﬁnd out what all is included as curated data. For example, are the individual images of each of the 52 cards in a standard deck of playing cards included?

If not, is there a way ...

Even Fibonacci numbers

Today, I found the Euler Project. Problem #2 is

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the ﬁrst 10 terms will be:

How do I clear all user deﬁned symbols?

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

How to perform a multi-peak ﬁtting?

I am wondering how to implement the multi-peak detecting and ﬁtting in Mathematica. Following is an example of ﬁtting the data using three peaks (such that the data ~ peak1 + peak2 + peak3). The ...

1.7.3 Can you answer these questions?

pure function assignment

I do not understand this statement from the Introduction to Dynamic tutorial:

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

Graphics get cropped when wrapped in Hyperlink and Inset in MMA 12.2 (doesn’t seem to happen on 12.1 RPi) Bug?

I’ve noticed that wrapping a Graphic[] in Hyperlink[] causes weird things to happen when using ...

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

Does Mathematica have build-in function to compute dimension of square polynomial system?

I’m working with square polynomial systems and wish to know if a (small) system has a ﬁnite number of solutions. That is, if it’s zero-dimensional. I’m not aware of any built-in function to do this ...

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

1.8 Thursday, March 25, 2021

1.8.1 Top new questions this week

Can we say Head[x] and x[[0]] are identical ? In mathematica manual I could ﬁnd : ’The head is the part with index 0’

But I am not sure whether Head[x] are x[[0]] are really interchangeable in any ...

How to roll a graph on the y-axis

I want to roll the function f(x)=sqrt(x), x∈[0,1] along the y-axis. I know how to rotate the graph around a point, but I’m not sure how to rotate along an axis in 2D. Rotating around a point e.g. (0,...

Numerically solving Helmholtz equation in 2D for a Guitar

Hi I am new to using Mathematica, so am not too conﬁdent. I am essentially trying to model vibrations of a guitar sound board for a project. It would be great to get some visualisations of the ...

How to draw the tree in a ”pitchfork” form?

How to set the options or other parameters in a TreePlot to draw the branching outside of the vertex? I.e. in a form similar to a dendrogram (but the dendrogram plot itself does not support the ...

Digitizing a geometrical sensor

I want to quantify the ﬂow from photos taken from a sensor such as this one:

For a limited number of readings, I can use a plot digitization method. However, I need to do this many times for ...

How Can I Compute The Automorphism Group of a Matroid?

I want to compute the automorphism group of a matroid. This reduces to the following (more general) problem: Suppose I have a list of sets $$\{\{b_{11},\dots ,b_{1k}\},\dots ,\{b_{k1},\dots ,b_{kk}\}\}$$ ...

How to make a circular heat map or diagram in Mathematica?

Is there any way to make a circular heat map in Mathematica? Thanks for your help! Here is a toy example for regular heat map. Can anyone help me make it to a circular one?

1.8.2 Greatest hits from previous weeks

How can I draw the Olympic rings with Mathematica??

How can I draw the 5 interlocking Olympic rings with Mathematica? (SVG version) Edit

Hard choice, but some pretty cool answers here. I didn’t have 3D answers in mind when I posted the question, but ...

Plot, extract data to a ﬁle

I need to save data that Mathematica uses inside the Plot command. The format that I would like to have is:

What does ”Tag Integer is Protected” message mean?

(Newbie question)

For every function I deﬁne I get this message: When I close and reopen Mathematica, and re-enter the function deﬁnition, I don’t get the message anymore. What does it mean?

Selecting every n-th element from a list

I have a list:

data = {4, 5, 7, 8, 9, 5, 3, 2, 1, 2, 13, 12};

I want to take those elements in the list which are located at equal distances, say, every third ...

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

Help ﬁnd a bright object on Mars!

In today’s news, scientists found a bright object on one of Curiosity’s photos (it’s near the bottom of the picture below). It’s a bit tricky to ﬁnd - I actually spent quite some time staring at the ...

Plotting the frequency spectrum of a data series using Fourier

testData = Table[N@Sin[500 x], {x, 0, 100}];
ListLinePlot[Abs[Fourier[testData]], PlotRange -> Full]

Gives me Which I do not expect because the Fourier ...

1.8.3 Can you answer these questions?

Is the fancy script ’C’ mathscrC available in Mathematica?

In mathjax \mathscr{C} gives me the character $$\mathscr {C}$$ that I want. There is a UTF listing for this character. https://www.compart.com/en/unicode/U+1D49E If I copy form this webpage and paste ...

I want to create a FormFunction that takes in a CSV ﬁle, applies some operations on the data and outputs another CSV ﬁle. I would like for the ouput CSV ﬁle to be automatically downloaded. I have a ...

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

Generating a lattice by $$N^{th}$$ iteration of unit cell

This question is in continuation of the my previous question that was not clearly presented by me at all. I have a unit cell, and I would like to generate a lattice but in iterative order. For ...

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

1.9 Thursday, March 18, 2021

1.9.1 Top new questions this week

Why am I getting that $$0.999999999999988 \geq 1.0$$ is True?

I am getting these results:

Can we make an ”Outerable” Attribute?

We can declare a function to have the Listable Attribute so that it automatically threads over lists in a particular way. For functions of multiple arguments it ...

How to ﬁt a curve in a picture with an equation?

For a curve taken from a picture, is there any method to ﬁt it with an equation if it appears to be some standard curve? For example, in the following picture, the curve looks like an ellipse or a ...

Bug with Json payload with diacritics for HTTPRequest

Working in the creations of APIs with Mathematica 12.2, I got this problem with diacritics when sending JSON data. Here is a toy code using httpbin.

How to plot a ”main eﬀect” plot?

I’m trying to make a ”main eﬀect” type chart but I haven’t found a way to do it in Mathematica. The main eﬀect plots are the graphs plotting the means for each value of a categorical ...

generating tuples of ones and zeroes with a ﬁxed number of ones

I would like to generate all the tuples of ones and zeros of a given length and with a given number of ones without generating all the possible tuples, which is impossible for tuples of large enough ...

How to add an attractive potential (migration term) named component to Mass Transport PDE

Wolfram Mathematica 12.2 now features ”Named Partial Diﬀerential Equation Terms”

For speciﬁc physics ﬁelds, relevant PDE terms have been packaged as components and augmented with ...

1.9.2 Greatest hits from previous weeks

Plotting the frequency spectrum of a data series using Fourier

testData = Table[N@Sin[500 x], {x, 0, 100}];
ListLinePlot[Abs[Fourier[testData]], PlotRange -> Full]

Gives me Which I do not expect because the Fourier ...

Is there something like DensityPlot3D to visualize atomic orbitals?

I’m visualizing some hydrogen like atomic orbitals. For looking at plane slices of the probability density, the DensityPlot function works well, and with something ...

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

Generate a Unit Circle Trigonometry

Struggling often with Trigonometry I would like to have some code to generate this Unit Circle Trigonometry. Would be of great help when I need to transform some data :

Calculate the 2D Fourier transform of an Image

I am new to Mathematica, and using version 8.0.

I would like to calculate the 2D Fourier Transform of an Image with Mathematica and plot the magnitude and phase ...

How can I plot implicit equations?

If you enter the following into Wolfram Alpha, you get nice graphs:

graph 4 x^4 + y^2 = 2

How do you do this in Mathmatica? I realize that these are not ...

Oak Island, extending the ”Alignment”, possible Great Circle?

During these days of COVID, I indulged in the guilty pleasure of watching The Curse of Oak Island - Season 8, Episode 4 Alignment, which viewed last night (1 Dec 2020). During the episode, some ”...

1.9.3 Can you answer these questions?

ColorFunction in ListContourPlot3D raising error when using more than one argument

The documentation of ColorFunction states that in ListContourPlot3D your chosen function gets the arguments ...

asked by Fidel I. Schaposnik https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=45839 1 vote

Autocomplete ﬁle argument for custom function

When typing Importin a notebook Mathematica suggests to autocomplete the ﬁle path you want to enter or choose a ﬁle using the GUI. Is there a way to let a ...

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

Reduce the time to ﬁnd six integer numbers so that the angle of two vectors equal to Pi/6

I am trying to ﬁnd six integer numbers a, b, c, x, y, z so that the angle of two vector {a, b, c ...

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

1.10 Thursday, March 11, 2021

1.10.1 Top new questions this week

Metropolis-Hastings Algorithm - Signiﬁcantly slower than Python

I would like to code a Metropolis Hasting algorithm and thought I would get the general scheme of things going with a toy example.

I think I got it running but my Mathematica code runs signiﬁcantly ...

Manipulate for playing along with ”Deal or No Deal?”

I started building this Manipulate and am certain I can do so on my own, but thought it was fun enough that others might want to try. (If this is some abuse of the ...

BoxWhiskerChart - how to show Quartile and other values

I have a question in respect of the BoxWhiskerChart. The default functionality of BoxWhiskerChart is that you mouse over it and ...

Strictly Increasing Sequences of Length n in a List

I need to determine how many strictly increasing sequences of a certain length (e.g. 5) are contained in a list of integers. I would be very happy if someone could help me. A sequence would be ...

Wafer Chucking Model

I am trying to calculate the pressure required to ﬂatten a bowed wafer. The simple model I am using for the study has a bottom layer (the bowed wafer) pushed against a harder ﬂat surface as shown in ...

Art on Mathematica: How can I export 4K resolution png images?

This question is solely based upon $$[1]$$ and therefore, the reading of $$[1]$$ could be interesting. How can I export the image created, by the code in the following, with high deﬁnition, beautiful, 4K ...

Skewed grid in plot

Is is possible to add a skewed grid in a plot? Consider the following image;

The grey axes are the normal axes ($$\mathbf {e}_1$$ and $$\mathbf {e}_2$$), the black axes are transformations $$\mathbf {e}'_1=2$$

1.10.2 Greatest hits from previous weeks

Mathematica vs. Python - how does Mathematica compare to Python’s scientiﬁc computing suite?

Python’s family of packages for scientiﬁc computing has matured rapidly. I can pretty much replicate all of Mathematica’s functionalities, but with production level and open-source code using the ...

Exporting graphics to PDF - huge ﬁle

I want to draw some basic surfaces, export them to PDF and include them in a LaTeX ﬁle. I create a simple 3D graphics object, for instance with

How do I plot a plane EM wave?

I would like to display an electromagnetic (EM) wave. I have written code that works, but it does not ”shade” the area between the graph and the axes. Both the ...

How to create animated snowfall?

Well, the title is self-explanatory. What sorts of snowfall can we generate using Mathematica? There are two options I suggest to consider:

1) Continuous GIF animations with smallest possible number ...

Image processing: Floor plan - detecting rooms’ borders (area) and room names’ texts

Here is a simple building ﬂoor plan. I would like to derive the rooms as (rectangular) components and the names of the rooms. This is very common representation of building ﬂoor plans.

The problem

Calculate the 2D Fourier transform of an Image

I am new to Mathematica, and using version 8.0.

I would like to calculate the 2D Fourier Transform of an Image¡ with Mathematica and plot the magnitude and phase ...

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...

1.10.3 Can you answer these questions?

Front-end rendering issues on Linux

I’m using Mathematica 12.2 on Ubuntu Mate 20.10 on an AMD FX(tm)-8120 with a GeForce GTX 1070 Ti NVIDA card. The issue is that I get unwanted horizontal lines just below the cell that I’m working on ...

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

time series - minimum diﬀerencing order needed to remove the trend

I was wondering how can I ﬁnd What is the minimum diﬀerencing order needed to remove the trend in a time series? I have a a times series and a TimeSeriesModelFit, which is SARIMA model. I want to ...

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

How does ‘TextureCoordinateFunction[]‘ works within ‘SurfaceAppearance[]‘?

Following up from @kglr's answer here, I’d like to understand how TextureCoordinateFunction[] works within SurfaceAppearance[]. ...

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

1.11 Thursday, February 25, 2021

1.11.1 Top new questions this week

Mathematica 12.1: Don’t use Accumulate or Diﬀerences on Around objects!

SUMMARY: If a List,TimeSeries etc. of Around objects contains any identical elements,

How to enter a repeating decimal in Mathematica

I don’t understand how to manipulate numbers with repeating decimal in Wolfram Mathematica language. For example 0.3... does not work as input and I don’t see how ...

How to judge whether two groups of sequences are equal in cycles?

There’s a set of arrays that I want to remove repeated elements that are equal after rotation:

Simplify 1+Sqrt[2]I-Complex[1,Sqrt[2]]

The expression 1+Sqrt[2]I-Complex[1,Sqrt[2]] should be zero. In fact, N[1+Sqrt[2]I-Complex[1,Sqrt[2]]] yields ...

How to correctly calculate the number of seating plans for the 4-couples problem?

Four couples a are sitting around a round table, in which husband and wife can not be adjacent. How many diﬀerent seating plans are there? I want to get as many simple calculations as possible.

How to approximate $$PV\int _0^\infty \frac {\tan x}{x}\text {d}x?$$

What’s the mathematica command to get the numerical value of :

where $$PV$$ is the principal value.

Mirror image of graph

I need to display a directed acyclic graph (say Hasse diagram of partial order) oriented with minimal elements at the bottom, maximal elements at the top as is conventional for Hasse diagrams. I tried ...

1.11.2 Greatest hits from previous weeks

LaTeX and Mathematica

I quite often would like to draw graphics in my LaTeXdocuments using Mathematica. I have encountered three problems. I would like to know if there are any workarounds to these problems

I would ...

What’s the most diﬃcult multidimensional integral that Mathematica has solved?

I am interested in benchmarking numerical integration methods and am trying to develop a wider set of diﬃcult multivariate examples. For my particular methods, I only want to look at non-negative-...

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

Finding Limits in several variables

Is there a way to ﬁnd a limit of a multivariable function, like

with Mathematica?

When $$f$$ is continuous, we can use

How to use Mathematica functions in Python programs?

I’d like to know how can I call Mathematica functions from Python.

I appreciate a example, for example, using the Mathematica function Prime.

Plot data from txt ﬁle?

I have data in ﬁle.txt which can be expressed by 20000x11 matrix. I do not want to import all of these data. How can I plot graph of the column 1 & column 4?

How to ﬁnd integer solutions?

Following is the equation: Need to solve for integer values of x,y when a,b lies between -1000 and 1000. Problem is to ﬁnd the number of integer values of pair (x,y) that satisfy it.

1.11.3 Can you answer these questions?

Idiomatic pattern for subtracting a function from a list

I would like to know a more idiomatic way to subtract a function from a list of pairs than this: Table[point-{0,fitFunction[point[[1]]]}, {point,data}]

I use this ...

asked by Diﬀycue https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=46327 1 vote

How can I simplify a symbolic tensor expression?

My question is about simplifying tensor expressions. If I have $$(a+b)\otimes (c+d)$$ The function TensorExpand gives $$a\otimes c + a\otimes d + b\otimes c + b\otimes$$ ...

Nothing showing up on my LogLogPlots

I am trying to make 2 log log plots. One with each equation, a and g. I don’t know why, but the plot is not showing up. My notebook is in the link below. https://imgur.com/a/sXQX0YS

What am I doing ...

asked by QuaﬀyWaﬄes https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=77475 1 vote

1.12 Thursday, February 18, 2021

1.12.1 Top new questions this week

How to create a spiral using Golden Triangles

Working with students in a pre-calculus class, an application of the sine law. They are working on a question that has them create a Golden Triangle (A golden triangle is an isosceles triangle in ...

How to modify default options of Dataset

I try to make a dark stylesheet based on the ReverseColor theme. However, dataset headers are barely readable.

This question is related to others such as Question ...

How to use Filling in PolarPlot?

For example: PolarPlot[{1, 1 + 1/10 Sin[10 t]}, {t, 0, 2 Pi}]

how to ﬁll color in the space between 2 functions?

How to reduce timing to ﬁnd the integer numbers a, b, c, d, e, f, g, h, k, m of this equation?

I use by hand to get this result

How to extract a column (or a row) of a matrix as another column vector/ column matrix (or a row vector), not as a list?

Suppose I have a matrix ’mat’ as

mat = Table[Subscript[m, i, j], {i, 5}, {j, 5}];
mat // MatrixForm

I want to extract the ﬁrst column (or any row) as

Intuitive explanation of RemoteBatchSubmit[] in AWS for total novices?

When I read Wolfram’s post about the new features in MMA 12.2 I was intrigued by RemoteBatchSubmit[]. He wrote:

I have only ever used MMA from my laptop, and never used any other cloud computing or ...

Solving a 2D heat equation on a square with Dirichlet boundary conditions

I am trying to solve the following heat equation problem on the square [0,1]x[0,1].
\begin{equation*}  \begin{gathered}  u_t = u_{xx} + u_{yy} + f(x,y,t), \qquad  u(x,y,0) = 0, \qquad  u=0 \text{ on ...

1.12.2 Greatest hits from previous weeks

Deep convolutional neural networks are very good at computer vision related tasks. Optical Character Recognition (OCR) is one important branch of computer vision. In fact, the convolution neural ...

How to make an inkblot?

How to eﬀectively create a polygon that looks like a realistic inkblot? So far, I could come up with this (borrowing from Ed Pegg Jr.’s Rorschach demonstration):

Generate a Unit Circle Trigonometry

Struggling often with Trigonometry I would like to have some code to generate this Unit Circle Trigonometry. Would be of great help when I need to transform some data :

Exporting graphics to PDF - huge ﬁle

I want to draw some basic surfaces, export them to PDF and include them in a LaTeX ﬁle. I create a simple 3D graphics object, for instance with

How to make the digits of π go around in a spiral like this?

Here is a start.

MapIndexed[Text[Reverse[First[RealDigits[Pi,10,252]]][[Tr@#2]],#]&,
Table[{t Cos[t],t Sin[t]},{t,0,16Pi,0.2}]]//Graphics

How to create a new ”person curve”?

Wolfram—Alpha has a whole collection of parametric curves that create images of famous people. To see them, enter WolframAlpha["person curve"] into a Mathematica ...

How do I plot a plane EM wave?

I would like to display an electromagnetic (EM) wave. I have written code that works, but it does not ”shade” the area between the graph and the axes. Both the ...

1.12.3 Can you answer these questions?

Unpacking list of arguments into parameters

I have a list in the following form:  list = {{a,1,3},{b,1,3},{c,1,3}}

Now I want to apply this list as parameters for the Sum function so that I end up with the ...

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

Can one preset credentials for ServiceConnect[”Twitter”, ”New”] to allow wolframscript headless use?

Trying to run some wolframscript code from a server, is it possible to set ServiceConnect credentials in the environmental variables for example?

Warnings while solving a system of coupled diﬀerential equations

I have a system of diﬀerential equations, given by

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

1.13 Thursday, February 11, 2021

1.13.1 Top new questions this week

Mathematica cannot seem to properly handle times in the 1 hour before clocks go back

Using Chicago as an example; According to the current rules for applying daylight saving time, at 02:00:00 on the ﬁrst Sunday of November, clocks in Chicago go back 1 hour (from Central Daylight Time ...

Dataset Association of Association vs Hierarchical data

I have the following dataset:

Plot many curves on the same graph

This plot has 40 curves on the same graph which makes it hard to see. I need to plot them on one graph. So I have an idea to plot to make it easier to see which one is larger or smaller in each range....

Is there any other way to access the n-th element of a BlankSequence?

Consider a named BlankSequence x__. How can I access the n-th element?
Is {x}[[n]] the only ...

Periodic von Neumann neighbours

From Carl Woll’s answer here, I have this code for pulling the von Neumann neighbors:

Equivalent of numpy’s newaxis

Numpy has a newaxis object that allows you to insert a new dimension of length 1 into an array. So after ...

Plot[Im[f[x]],...] incorrectly gives graph of identical zero function

Consider

Plot[Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}]

At least in Mma 11 it gives the following picture: Meanwhile,

1.13.2 Greatest hits from previous weeks

How to create animated snowfall?

Well, the title is self-explanatory. What sorts of snowfall can we generate using Mathematica? There are two options I suggest to consider:

1) Continuous GIF animations with smallest possible number ...

Calling Correct Function for Plotting DiracDelta

I am wondering what is the correct function in Mathematica to plot the true impulse function, better known as the DiracDelta[] function. When using this inside of a ...

How to manipulate 2D plots?

When it comes to visual analysis, large datasets or data with intricate internal details often makes plotting in 2D useless, as the outcome is either just a fraction of the full dataset, or no details ...

Using Export[] sends the ﬁle where?

I am trying to use the Export command to convert a list of plots into a *.gif ﬁle, and the command runs and executes well, but I can’t ﬁnd the ﬁle! Where is it ...

How can I reproduce this mandala with Mathematica?

I found this image on the Internet and it is very beautiful. How can I reproduce it? The ideal would be to be able to control the colors of the outside as well as the center.

Mathematica Minecraft

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

Plotting the frequency spectrum of a data series using Fourier

testData = Table[N@Sin[500 x], {x, 0, 100}];
ListLinePlot[Abs[Fourier[testData]], PlotRange -> Full]

Gives me Which I do not expect because the Fourier ...

1.13.3 Can you answer these questions?

Fourier transform in polar coordinates using built-in hankel transform of the function constant 1

Like in the table of transforms https://en.wikipedia.org/wiki/Fourier_transform#Distributions,_one-dimensional the FT (Fourier transform) of $$\delta$$ is 1 and the FT of 1 is $$\delta$$, but in polar ...

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

Exponent combinations

How can I have Mathematica represent the product of two diﬀerent bases and exponents as a single power (where possible)? For example, see the product below can be expressed below:

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

Plot derivative of a real function consisting of a complex function

I obtained the data for the real and imaginary parts of a complex function $$A(x,t)=A_r(x,t)+i A_i(x,t)$$ from NDSolve, both are functions of time $$t$$ and space $$x$$. ...

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

1.14 Thursday, February 4, 2021

1.14.1 Top new questions this week

Conﬁrm vs Throw

Version 12.2 brought us Conﬁrm and Enclose. What’s the point? Is it just that it’s a slightly more convenient syntax than ...

How to use wolframscript to develop ﬂexible command-line tools?

I am currently changing a notebook into a wolframscript for a ”production” environment, where I plan to pack the script as a standard CLI tool. However I do not know how to implement such an ...

Automatic Method for FindMinimum with constraints

What is the default method used by FindMinimum with constraints? The documentation says:

”Currently, the only method available for constrained optimization is ...

How to reﬁne a boundary mesh with MeshReﬁnementFunction?w

MeshReﬁnementFunction works well to reﬁne elements in a deﬁned spatial domain (here $$x>0$$):

Ugly streaks caused by Arg in a contour plot

I had a more general question about a similar problem more than two years ago, Getting rid of discontinuities in plots caused by square roots, logarithms, ‘Arg‘, etc, which got lots of interesting ...

Trying to Rotate the North Pole View of a Globe

My goal is to generate diagrams like this.

But I would like to be able to rotate the globe about the North Pole, so that I can represent diﬀerent times of the day. When I use ImageRotate, the ...

problem with DelaunayMesh 3D coordinates

I found DelaunayMesh works ﬁne for 2D. For example,

1.14.2 Greatest hits from previous weeks

Conversion of Sine to Cosine

I’m solving equations with many Cosines and Sines. And I want to convert all the Sines to Cosines using trigonometric formulas such as cos(x)=sin(x+pi/2). How can I do this?

Extract real part of a complex expression better than Re does

I have a complex expression with real positive variables only.

Mathematica Input Style:

Assign the results from a Solve to variable(s)

I understand Mathematica can’t assign the results of a Solve to the unknowns because there may be more than 1 solution. How can I assign the 4 values of following result to variables?

Why round to even integers?

According to the Mathematica help: Round rounds numbers of the form x.5 toward the nearest even integer. For example:

Round[{0.5, 1.5, 2.5, 3.5, 4.5}]

gives

Using Export[] sends the ﬁle where?

I am trying to use the Export command to convert a list of plots into a *.gif ﬁle, and the command runs and executes well, but I can’t ﬁnd the ﬁle! Where is it ...

Formatting legend text font

I am using this code to plot a graph, and I am trying to make the font of the legend bigger.

What do the X and Y axis stand for in the Fourier transform domain?

In Wolfram Mathematica the function Fourier has the following declaration

Fourier[list]

And after a list is given to the ...

1.14.3 Can you answer these questions?

RegionPlot of the Maximum of a function

For the function fun[a_, b_, x_, y_] = Sin[a x] Cos[b y] (a x + b y); corresponding to $$x$$ and $$y$$, I need a RegionPlot showing the maximum of function $$fun[a, b, x]$$

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

How to let Mathematica evaluate a large amount of data

I have the following code in mathematica which runs perfectly for a small matrix of 21 x 12 matrix. But I really want to test it for a large system. My data is 35844 x 21000 elements, totaling 1.5 GB. ...

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

Directed Inﬁnity vs Indeterminant in this output

When I evaluate

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

1.15 Thursday, January 28, 2021

1.15.1 Top new questions this week

What’s the diﬀerence between these 2 associations?

I have 2 associations similar to these simpliﬁed ones:

How can I handle graphics or artworks with millions of points?

As a hobby, I am trying to use Mathematica and Wolfram Language as a tool for making generative artworks. Generative art techniques may require drawing millions of points, lines, or curves. For ...

ContourPlot3D, grid of cylinders

I am trying to make a 3D contour plot that looks like a grid of cylinders to represent the Fermi surface of a metal, like below:

I have no problem generating something that kind of looks like it.

Distorting image to ensure consistent vanishing point

Here’s Giorgio de Chirico’s painting, Ariadne:

The Surrealist artist deliberately broke the rules of geometric perspective, giving the work his characteristic sense of mystery and unease. What would ...

Export inﬁnite looping GIFs by default

frames=Table[Plot[Sin[x(1+a x)],{x,0,6}],{a,0,2,0.2}];
Export["test.gif",frames]

The above code runs in version 9.0 to get a inﬁnite looping GIF ...

Replace a color in image with hatchﬁlling

Is it possible to identify a color (say grey in a 3 color Black, Gray and White image) and ...

MeshReﬁnementFunction on 2D surfaces embedded in 3D

DiscretizeRegion doesn’t seem to run the supplied MeshReﬁnementFunction when meshing a 2D surface in 3D. For example:

1.15.2 Greatest hits from previous weeks

How do I identify the source of a ”Tag times protected” error?

I have some code that looks like

Table[
a = 1;
b = {2, 3}
c = i;,
{i, 2}
]

which gives an error:
Set::write: Tag Times in c {2,3} is Protected....

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

How to add a vertical line to a plot

In the plot below I would like to add two vertical lines at $$x = \frac {\pi }{15} \pm \frac {1}{20}$$. How can I do that?

Drawing a square root spiral

Here is a start. I’m looking for a nice way to draw it.

Multivariable Taylor expansion does not work as expected

The basic multivariable Taylor expansion formula around a point is as follows:

Solving $$L=\frac {3}{2} \sqrt {4 \pi ^2 A^2+W^2}-\frac {\sqrt {5 W \sqrt {4 \pi ^2 A^2+W^2}+6 \pi ^2 A^2+3 W^2}}{\sqrt {2}}+\frac {3 W}{2}$$ for $$W$$

When I solve the aforementioned equation for $$W$$ or $$A$$ on Mathematica I get a long and ugly equation in return, namely one of the solutions for $$W$$ is: (attempt to read at your own health)

Mathematica command that allows it to read my intentions

In version 2.0 of Mathematica there was a command, ReadProgrammerIntentions[ ] which allowed it rapidly compose code that could solve problems simple to complex, ...

1.15.3 Can you answer these questions?

How to improve this code?

The aim of my work is to ﬁnd a value for the complex constant $$\omega$$. In order to do that I solve the below system of diﬀerential equations with a manual shooting method: I ﬁrst solve the system ...

Error on DSolve

I’ve been trying to solve this initial value problem using DSolve[]:

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

Remove defect of display in ListDensityPlot3D

I have a 3D volumetric data (for example, $$64\times 64\times 64$$, at each point there is a value) read in from a ﬁle and I want to use ListDensityPlot3D to ...

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

1.16 Thursday, January 21, 2021

1.16.1 Top new questions this week

How can I use Mathematica to solve a complex truth-teller/liar logic problem?

I have a logic puzzle I want to convert to Mathematica to solve: Person A states, ”Exactly two people are truth-tellers,” Person B states, ”I and Person C are truth-tellers.”

list-array construction

I want to create the list ix={1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4} I can do

why do these two Meijer G functions not cancel each other?

I encountered such expressions in Mathematica MeijerG[{{ }, {1, c + 1/2}}, {{0, c, c, c}, { }}, 1] + MeijerG[{{1}, {c + 1/2}},    {{c, c, c},    {0}}, 1]

which in ...

How to partition a square into successive halves

I am teaching the idea of inﬁnite geometric series to high school students, looking for hints to create the diagram below using Mathematica. (I don’t need the labels). I can do it manually, but ...

There is a curious example in Posamentier’s book ”Magniﬁcent Mistakes in Mathematics” (p. 72): $$(7+3/7)*(4-3/13)= 7*4=28$$, where cancelling the fractions leads to correct result. If we ...

Context Manipulation within Scoping Constructs

In the following the full context form of Test is not required as "Aaa" is added to ...

...

1.16.2 Greatest hits from previous weeks

Is it possible to export the equations from Mathematica to MATLAB?

Is it possible to export the output expressions from Mathematica computations (e.g., equations) in valid MATLAB syntax?

How to ask Mathematica to imitate Andy Warhol’s pop-art painting?

I tried to ask Mathematica to imitate Andy Warhol, let it convert a Marilyn Monroe’s portrait so that it looks like Warhol’s world famous pop-art painting. However, the result shown below is far from ...

How to plot an ellipse?

I’m new to Mathematica, and I’m ﬁnding it diﬃcult to plot an ellipse. I tried using

Plot[(x/5)^2 + (y/3)^2 == 1, {x, -5, 5}, {y, -3, 3}]

but I’m getting ...

What’s the most diﬃcult multidimensional integral that Mathematica has solved?

I am interested in benchmarking numerical integration methods and am trying to develop a wider set of diﬃcult multivariate examples. For my particular methods, I only want to look at non-negative-...

Even Fibonacci numbers

Today, I found the Euler Project. Problem #2 is

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the ﬁrst 10 terms will be:

Find eigen energies of time-independent Schrödinger equation

I’m trying to get the eigenvalues of a one dimensional time-independent Schrödinger equation,

$$-\frac {h^2}{2m_0}\frac {d^2\psi }{dx^2}+U(x)~\psi =Ei~\psi$$

where U(x) is some potential and Ei is the ...

Standard deck of 52 playing cards in curated data?

I am not sure how to ﬁnd out what all is included as curated data. For example, are the individual images of each of the 52 cards in a standard deck of playing cards included?

If not, is there a way ...

1.16.3 Can you answer these questions?

ListDensityPlot3D with x-axis in logscale

Starting from a data set like the one used in this post: Importing and visualizing 4D data DATA It can be viewed using ListDensityPlot3D, as follows:

asked by Ivan Y. Forero https://mathematica.stackexchange.com/landing/r/digest?cta=user&id=76882 1 vote

Trying to solve a PDE — getting warnings I don’t understand

Consider the partial diﬀerential equation

How can we improve transonic ﬂow visualization?

With this code we can make 2D FEM simulation of transonic ﬂow around airfoil NACA 0012 at Mach number of 0.925. It takes about 5 minutes on the XENIA-15 laptop of 32 GB memory with processor Intel ...

1.17 Thursday, January 14, 2021

1.17.1 Top new questions this week

Faster ”Closest Pair of Points Problem” implementation?

The closest pair of points problem is a common computational geometry problem: given n points, ﬁnd a pair of points with the smallest distance between them. A naive algorithm of ﬁnding distances ...

Broken ValueQ function in Mma12.2?

f[x] ^= 1;
ValueQ[g[x]]

returns True in Mathematica 12.2. Is it a bug?

Graphics not correctly produced when saving to PDF in Version 12

12.0.0 for Microsoft Windows (64-bit) (April 6, 2019) How do I get my graphic to look the same in PDF as it does in a Notebook? This is what the graphic looks like in the FrontEnd:

This is how the ...

MoleculePlot draws sucrose benzoate with overlapping bonds

Recently I learned that in Mathematica it is possible to create chemical structures here: Chemical formulas with Mathematica I am having a problem with a structure called ”Sucrose benzoate”

How to globally disable and re-enable Echo?

I have Echo’s buried in code all over my notebook, I’d like a ﬂag to turn them all on or oﬀ globally.

Sure Unprotect[Echo];Echo=Identity would disable them, but ...

Compile - Optimization of function calls - does it matter?

I was surprised to see that, in the results of CompilePrint for a function made with Compile, calls to ...

neighbouring pixels : next smaller and bigger perimeter

I have a list of pixels centers, for example :

1.17.2 Greatest hits from previous weeks

How to make Jacobian automatically in Mathematica

If we have two vectors, $$a$$ and $$b$$, how can I make Jacobian matrix automatically in Mathematica?

 a=\left(
\begin{array}{c}
x_1^3+2x_2^2 \\
3x_1^4+7x_2
\end{array}
\right);b=\left(
\begin{array}{...`

Plotting Complex Quantity Functions

Trying to plot with complex quantities seems not to work properly in what I want to accomplish. I would like to know if there is a general rule/way of plotting when you have complex counterparts in ...

QR Code in shopping cart handle

This week, the market people from my work wanted to put QR codes in shopping cart handles, but when they tested it, the QR code did not work. I noted that the cylindrical curvature (even small) ...

How do I plot a plane EM wave?

I would like to display an electromagnetic (EM) wave. I have written code that works, but it does not ”shade” the area between the graph and the axes. Both the ...

Standard deck of 52 playing cards in curated data?

I am not sure how to ﬁnd out what all is included as curated data. For example, are the individual images of each of the 52 cards in a standard deck of playing cards included?

If not, is there a way ...

Why I get the ”Set::write: ”Tag Times in is Protected.” error?

Why I get the error below with this code:

Mathematica vs. Python - how does Mathematica compare to Python’s scientiﬁc computing suite?

Python’s family of packages for scientiﬁc computing has matured rapidly. I can pretty much replicate all of Mathematica’s functionalities, but with production level and open-source code using the ...

1.17.3 Can you answer these questions?

NDSolve - interpolation or machine precision problem

For the following equations;

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

Matrix regularization, how to pick $$\lambda$$

Since v12 FindFit[] now supports regularisation, such as Tikhonov regularization. Do there exist statistics to help guide the choice of the hyper-parameter

Memory consuming Expand

Expand ﬂoods all my 64GB RAM in MMA 12.1 (Windows). Therefore I cannot run the code. Somebody with ¿64GB RAM could give the result. A memory saving alternative ...

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

1.18 Thursday, January 7, 2021

1.18.1 Top new questions this week

Why MMA refuses to simplify the following simple expression?

I have the following simple expression Exp[(Log[1 + x]^2 - Log[x]^2)/Log[1 + 1/x]] - x^2

that can be shown to simplify to $$x$$

Simplifying code that displays a square rolling inside a circle

The vertex A,B of the square ABCD with side length $$\sqrt {2}$$ is on the circle with radius $$\sqrt {2}$$, vertex C,D is inside the circle, roll the square ABCD along the inside of the circle ...

Trying to build a code to translate handwritten formulas using ML

I’m lazy writing equations in Latex so I want a code to translate handwritten equations. This question is related to an old experiment I’m reviewing during vacations, here. I’m trying to use ...

How to deﬁne a function reminding of names of the independent variables?

I am using a function with a lot of variables. There are 9 and sometimes more of them. In this case, it is diﬃcult to memorize, which one stays on the, say, fourth position, and which one - on the ...

Improve running speed for DeleteDuplicates

How to make this faster? I want to remove elements that satisfy the condition below but it’s way too slow.

Why does Mathematica try to take the ﬁrst element of the empty list when plotting?

I’m using Mathematica 12.1.1.0. When I enter

Why do the frame ticks disapear when a plot is exported as PNG?

I am using M12.0.0.0 on Ubuntu and I have these two plots:

1.18.2 Greatest hits from previous weeks:

What do the X and Y axis stand for in the Fourier transform domain?

In Wolfram Mathematica the function Fourierhas the following declaration

Fourier[list]

And after a list is given to the ...

How can I plot the direction ﬁeld for a diﬀerential equation?

I’d like to plot the graph of the direction ﬁeld for a diﬀerential equation, to get a feel for it. I’m a novice, right now, when it comes to plotting in Mathematica, so I’m hoping that someone can ...

Is Mathematica worth it for me?

I’m 13 years old and in 7th grade. I’m currently in Algebra 1, and I have fallen in love with both math and programming.

When I came upon Mathematica, it was awesome. My two favorite things fused ...

How to ask Mathematica to imitate Andy Warhol’s pop-art painting?

I tried to ask Mathematica to imitate Andy Warhol, let it convert a Marilyn Monroe’s portrait so that it looks like Warhol’s world famous pop-art painting. However, the result shown below is far from ...

Figuring when the minute and hour hand coincide on a clock

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

Conversion of Sine to Cosine

I’m solving equations with many Cosines and Sines. And I want to convert all the Sines to Cosines using trigonometric formulas such as cos(x)=sin(x+pi/2). How can I do this?

Finding unit tangent, normal, and binormal vectors for a given r(t)

For my Calc III class, I need to ﬁnd $$T(t), N(t)$$, and $$B(t)$$ for $$t=1, 2$$, and $$-1$$, given $$r(t)=\{t,t^2,t^3\}$$.

I’ve got Mathematica, but I’ve never used it before and I’m not sure how to coerce ...

1.18.3 Can you answer these questions?

Numerically obtaining inverse 2D Laplace transform

I wonder if there is a function in Mathematica (or code) that can help obtaining inverse 2D Laplace transform of a function, f(s1,s2) which is the 2D Laplace transform of a function F(t1,t2) in (s1,s2)...

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

How to determine population from a list of arbitrary jurisdictions (cities, states, counties, et al.)?

I am an aspiring data scientist who’s working on a passion project, namely to assign danger-level scores to police departments in the United States. One speciﬁc metric I’m developing results from ...