Questions tagged [code-request]
Questions on finding existing Mathematica implementations or expertise to address a clearly stated problem.
546
questions
1
vote
0
answers
62
views
How can I speed up symbolic integration of this highly oscillatory function?
I am trying to figure out how to speed up this symbolic integration. I have tried parallelization and numerical integration (both I am failing to implement).
Here is the function:
...
0
votes
0
answers
37
views
Please correct this code to show plotting lines
The given code does not show plotting lines, but I need given plot in the image.
...
2
votes
0
answers
66
views
Regional Rank Choice Voting on Maps
So, I made an algorithm to do rank choice voting on regions. Based on where you are, votes for candidates are stored in specific position in each list that labels the region. If there is a tie, then ...
0
votes
0
answers
86
views
Proving Exact Answers to Logistics Map for 3-Cycles
Seems that I may have found a pair of exact solutions to the logistics map with cycles of period three. However, I’ve run into a bit of a snag in proving it because of some “ambiguities” in the ...
1
vote
1
answer
57
views
Using a pre-rendered image of a plot within a Mathematica Figure
I want to plot new data over data that I only have in the form of a figure in order to be able to make a comparison.
Say for example I have only the image (not the original data) produced by (or ...
4
votes
1
answer
51
views
DeleteDuplicates By Proportionality
I have a list of expressions and I would like to delete "duplicates" that are proportional to each other where the (simplified) proportionality constant satisfies NumericQ. What would be the ...
0
votes
0
answers
44
views
Using NetMeasurements for basic neural network
I have a neural network that works fine, but I would like to obtain some results on the Validation Set which provides some metrics on the performance of the training. I am obtaining some strange ...
0
votes
1
answer
126
views
How to execute this code? [closed]
I want to plot the following equation:
...
0
votes
0
answers
34
views
ReplaceIndexed function
I would like a replaceAllIndexed in the spirit of MapIndexed where there is an easy way to access the counter in the rule. I ...
0
votes
0
answers
90
views
SoftmaxLayer with one-hot vectors
The quantum physics problem I am looking at is a rotated qubit. The setup involves a y-rotated qubit measured in the z-basis (hence spin-up and spin-down). This scenario typically includes modeling ...
0
votes
0
answers
62
views
Using CrossEntropyLoss function for basic neural network
Hi I am interested in understanding how to use the neural network functions in Mathematica. I have just started learning hence this is a basic query. The simple example I am looking at is as follows: ...
0
votes
0
answers
48
views
Solve in solving equation system
I have the following problem:
I have a system of equations specifically consisting of 56 equations, with 34 coefficients to be determined, in simplified form:
...
0
votes
2
answers
81
views
Generating lists where new elements depend on the previous element
I am interested in using some type of list or table in-built Mathematica function to generate a list, where the elements of the new list not only depends on the input values of a previously defined ...
3
votes
2
answers
152
views
How to draw a curve projection?
I want to draw the following projection picture for the cuspidal cubic curve in Mathematica. Does anybody know how to do this?
5
votes
4
answers
354
views
Still on Filling
I am really sorry to bother you for the same problems, but I cannot get in the view about this command, the filling option.
What I want: to fill the semicircle part, under the $y = x$ curve.
Here is ...
0
votes
1
answer
66
views
Generate all commutators and anti-commutators up to a certain order of a list of matrices
I am given a list of matrices. At first order I want to evaluate the commutators and anti-commutators of all pairs in the list and return a new list that contains two lists: one containing all ...
4
votes
3
answers
231
views
Vertical line: plotting and filling
I need some help to complete this code in order to make the wanted plot. In the following, the function that I define as $m(x) = 1$ should be replaced (if possible) to a function that plots a vertical ...
1
vote
1
answer
72
views
Adding list of error-bars to plot
I have a basic question about adding error-bars to a plot. It seems that the built-in errorbar function is no longer available, could someone advise on what would be an efficient way to include the ...
2
votes
1
answer
71
views
Solving multivariable equation after setting partial derivative to zero
I have a real-valued function of four variables, namely $L[\phi, m0, m1, m2]$. I am interested in taking the partial derivative $\partial_{\phi}L$ thereof and setting the partial derivative to zero, ...
3
votes
1
answer
126
views
Problem with calculation of Lyapunov exponent
The code given by Chris K for Lyapunov Exponent does not work and gives lot of errors for the dynamical system given in equation(2) of this paper
The dynamical equations:
...
7
votes
1
answer
511
views
Borromean rings [closed]
how can I plot the Borromean rings in Mathematica?
I am interested in the configuration showcased in figure.
1
vote
1
answer
87
views
How to plot a community structure with specific properties
This code generates a community structure where each community is shown with a different color. The same color is used for bars within a community and outgoing edges from that community. I would like ...
2
votes
1
answer
90
views
Alternative Representation for Energy Levels and Energy Level Density
I need to show the energy level density around the local maximum of this double-well potential. I can do it using the following:
...
5
votes
5
answers
210
views
How to color a selected set of variables in a ListPlot
This code:
...
4
votes
1
answer
288
views
Recognizing a Higher Percentage of Multiple Barcodes from an Image
I would like a path or way to find barcodes in an image and read more of them and ideally quicker (It is very slow for an image).
So, BarcodeRecognize[] already ...
3
votes
1
answer
95
views
Quickly processing long lists using SequencePosition
Overview
SequencePosition does exactly what I need; however, it seems to be very slow for long lists. Is there an input option that would allow it to process faster? Or, perhaps an alternative ...
5
votes
2
answers
173
views
How to combine two different datasets to create a unified dataset
I have two different datasets : dsDat1 and dsDat2:
...
7
votes
6
answers
556
views
How to identify intervals for each integer number
I have two lists:
...
9
votes
2
answers
1k
views
Can Mathematica perform logical reasoning?
The question goes like this:
Ms. Li has just moved into a new home and plans to buy several potted plants at once. Her thoughts are as follows:
Buy either Green Radish or Podocarpus.
Buy at least ...
1
vote
1
answer
66
views
Compressing a file's name string
I was working with files where each name records a lot of information about what is in its respective file and wanted to compress it a little bit. So I wanted to change it's 'base'.
And I noticed that ...
2
votes
2
answers
183
views
Why do image sizes shrink when printing multiple plots as a single object?
I searched the repository a lot and found no answer to the following question. My code below produces 4 plots as a group. Each plot has ImageSize->300. However, ...
6
votes
3
answers
436
views
Placing a single X and a single Y axis to a group of plots
I have the following 4 plots sharing a common X and Y axes. I place 4 plots in a grid of 2 by 2. I do not want to use separate X and Y-axis labels for each of them. Instead, I want to put a single X-...
1
vote
2
answers
82
views
Numerical search of two simultaneous equations for three unknowns
Given the following two equations with three unknowns $\eta_1, \eta_2$ and $\tau$:
$\frac{i e^{-i \phi/2}}{\sqrt{2}} = \cos(2 \tau - \eta_1 -\eta_2)\cos(\eta_1-\eta_2) - i\sin(2 \tau - \eta_1-\eta_2)\...
3
votes
2
answers
293
views
Reading what is inside DataStructure[]
In my code I end up with such data structures and I cannot see what is inside. Is there a command to open this type of data structure? I tried \\Normal but it does ...
7
votes
1
answer
296
views
How to condition all cells of a notebook to a specific SeedRandom?
Is there a way to fix SeedRandom[.] for an entire notebook? If I carry out many calculations using random numbers, I need to give a separate code ...
4
votes
1
answer
142
views
How to maximize over a set containing an isolated point?
How can I maximize a function F over a set composed by a compact set like [a, b], plus a single isolated point, like $[a, b] \cup \{p\}$?
I cannot code the isolated point part.
2
votes
2
answers
147
views
Shape of a boomerang
I want to create a physical pendulum in 2D with the shape of a boomerang. And first problem I met with was how to define a boomerang, so I could have a shape of it and use it to make my pendulum. Can ...
1
vote
1
answer
149
views
How can a directed network model be linked to Dataset[ ] for further computation?
REVISED Question:
My only request is to know how to monitor the evolution of {agentStates, steps} in simulateSlow[...] function. ...
2
votes
1
answer
76
views
Defining multivariable function from previous cell output
In the following, I would like to define a function $h(\theta, \beta, \alpha_1, \alpha_2)$. The function $h$ should be defined by the output of a previous function (which includes the partial ...
1
vote
0
answers
157
views
0
votes
1
answer
53
views
Making some powers of variables inside the function : $X * \alpha^{m} *\beta^{n} f[A[x,y]] \Rightarrow X f[\alpha^{m}\beta^{n} A[x,y]]$
Suppose I have a function of the form $ a_1 a_2 \cdots a_n b_1 \cdots b_m \cdots f[L[x,y]]$. I want to make some particular letters and their power inside the bracket.
i.e.,
I want the letter $\alpha,...
1
vote
2
answers
151
views
Normalized Coincident Detection Probability of Laguerre - Gaussian Modes
I am working on a paper in which a pump mode is passing through SPDC(Spontaneous Parametric Down conversion) is converted into two photons called as signal and idler. In which laguerre-Gaussian mode ...
2
votes
0
answers
80
views
Extracting tables from .pdf
Can we construct some automated method for extracting tables from pdfs?
I can get decently far by just copy and pasting its content and splitting at newlines but it would be great if it was possible ...
2
votes
1
answer
94
views
How to transform the regions in which a piecewise function are defined?
I have a function f[x,y,z] that has a piecewise definition, i.e., its values depends on the ranges of the arguments. Now suppose I have a coordinate transformation <...
1
vote
2
answers
182
views
Sorting a list of functions by exploiting the recursive structure
Given a list of functions list and a vector of arguments {t, a}:
...
3
votes
1
answer
580
views
How to simulate a directed acyclic graph?
My goal is to have a code to identify and estimate the regression models associated with a directed acyclic graph (DAG), which is obtained through the reduction of a given weighted, directed graph <...
9
votes
1
answer
376
views
How to replace graph communities with the associated bar charts?
The following code generates a community graph and a set of bar charts, each one of which corresponds to a community.
...
0
votes
0
answers
78
views
Finding the Complete Silhouette Area Formula given a Convex Polyhedron
Like always, I am probably over complicating this and there is a much simpler way to derive a general formula using built-in Mathematica functions, think about it differently, or a faster way to solve ...
0
votes
0
answers
64
views
How to create a customized layered community structure from a directed graph
This answer provides a code for scaling the sizes of communities. I like to make the presentation of the community structure given in this answer (by @kglr) a bit more informative and friendly by ...
4
votes
2
answers
184
views