Questions tagged [code-request]

Questions on finding existing Mathematica implementations or expertise to address a clearly stated problem.

Filter by
Sorted by
Tagged with
2 votes
1 answer
48 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, ...
John Doe's user avatar
  • 349
3 votes
1 answer
97 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: ...
Arssat's user avatar
  • 31
8 votes
1 answer
478 views

Borromean rings [closed]

how can I plot the Borromean rings in Mathematica? I am interested in the configuration showcased in figure.
Yasha Gindikin's user avatar
1 vote
1 answer
82 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 ...
Tugrul Temel's user avatar
  • 6,183
2 votes
1 answer
80 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: ...
user444's user avatar
  • 2,414
5 votes
5 answers
209 views

How to color a selected set of variables in a ListPlot

This code: ...
Tugrul Temel's user avatar
  • 6,183
4 votes
1 answer
147 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 ...
Teg Louis's user avatar
  • 616
3 votes
1 answer
89 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 ...
user6546's user avatar
  • 1,069
5 votes
2 answers
154 views

How to combine two different datasets to create a unified dataset

I have two different datasets : dsDat1 and dsDat2: ...
Tugrul Temel's user avatar
  • 6,183
7 votes
6 answers
544 views

How to identify intervals for each integer number

I have two lists: ...
Tugrul Temel's user avatar
  • 6,183
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 ...
csn899's user avatar
  • 3,707
1 vote
1 answer
56 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 ...
Teg Louis's user avatar
  • 616
2 votes
2 answers
180 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, ...
Tugrul Temel's user avatar
  • 6,183
6 votes
3 answers
414 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-...
Tugrul Temel's user avatar
  • 6,183
1 vote
2 answers
65 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)\...
John Doe's user avatar
  • 349
3 votes
2 answers
277 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 ...
Tugrul Temel's user avatar
  • 6,183
7 votes
1 answer
281 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 ...
Tugrul Temel's user avatar
  • 6,183
4 votes
1 answer
139 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.
Martin and Friends's user avatar
1 vote
2 answers
130 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 ...
pewna osoba's user avatar
1 vote
1 answer
147 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. ...
Tugrul Temel's user avatar
  • 6,183
2 votes
1 answer
72 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 ...
John Doe's user avatar
  • 349
1 vote
0 answers
150 views

How to construct a layered 3D graph of three community structures?

Consider: ...
Tugrul Temel's user avatar
  • 6,183
0 votes
1 answer
51 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,...
phy_math's user avatar
  • 813
1 vote
2 answers
125 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 ...
Qubit's user avatar
  • 45
2 votes
0 answers
60 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 ...
Kvothe's user avatar
  • 4,387
2 votes
1 answer
80 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 <...
user1620696's user avatar
0 votes
2 answers
176 views

Sorting a list of functions by exploiting the recursive structure

Given a list of functions list and a vector of arguments {t, a}: ...
Tugrul Temel's user avatar
  • 6,183
3 votes
1 answer
554 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 <...
Tugrul Temel's user avatar
  • 6,183
9 votes
1 answer
374 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. ...
Tugrul Temel's user avatar
  • 6,183
0 votes
0 answers
71 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 ...
Teg Louis's user avatar
  • 616
0 votes
0 answers
63 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 ...
Tugrul Temel's user avatar
  • 6,183
4 votes
2 answers
182 views

How to create a size-adjusted community graph with eigenvector centrality bubles

Given this: ...
Tugrul Temel's user avatar
  • 6,183
1 vote
4 answers
309 views

How to observe transition pathway of a stochastic matrix?

Given a stochastic matrix, m, I like to observe the transition path converging to the limiting distribution. ...
Tugrul Temel's user avatar
  • 6,183
2 votes
1 answer
193 views

Python Code to Mathematica for Classical Map of Kicked Top

I am trying to convert this Python code for Classical map of kicked top to Mathematica. For a single trajectory, I am able to ...
user444's user avatar
  • 2,414
3 votes
2 answers
206 views

How to Draw Rectangle Chart Using Three Layers of Data?

I have some data given at three levels: ...
Tugrul Temel's user avatar
  • 6,183
3 votes
4 answers
353 views

How to use Callout in a directed graph with circular embedding?

Given the following code: ...
Tugrul Temel's user avatar
  • 6,183
5 votes
7 answers
439 views

Selecting string elements from list by using strings from another list

Given two lists of string elements list1 and list2: ...
Tugrul Temel's user avatar
  • 6,183
2 votes
1 answer
141 views

How to map community structure with circular embedding and normalized edge weights?

Given: ...
Tugrul Temel's user avatar
  • 6,183
2 votes
1 answer
64 views

How to locate chart labels correctly?

Given ...
Tugrul Temel's user avatar
  • 6,183
1 vote
1 answer
62 views

How to inverse matrix equations? [closed]

I've never used matematica before so still learning. I'm trying to show that two equations below are equal to one another. To do that, doing an inverse transformation from 3.5-3 to 3.5-4 would ...
kp2014's user avatar
  • 19
2 votes
1 answer
137 views

Convert R code to Mathematica code of Poisson log-likelihood for the epidemic curve

I want to define a function that simulates the model for a given combination of parameters and calculates the Poisson log-likelihood for the epidemic curve of reported cases: ...
Athanasios Paraskevopoulos's user avatar
3 votes
1 answer
207 views

Improve performance of Linear Optimization

EDIT I am reframing the question here by pulling out the relevant part about linear optimization, you can find the original question and the entire code down below. I am trying to increase the ...
Dotman's user avatar
  • 424
4 votes
4 answers
422 views

A simpler or more concise way to divide the boundary of a polygon into equal arc lengths?

I am really looking just for the least amount of code needed to do this but it is still readable. Here is the same polygon but the border is respectively split up into 10, 20, and 30 points along the ...
Teg Louis's user avatar
  • 616
2 votes
1 answer
98 views

Covering a rectangle with shapes/closed curves of equal area?

Motivation: We want to cover a rectangle using smaller, non-overlapping shapes with the same area: the difference between the total area of the shapes and the area of the rectangle should be zero or ...
Arbuja's user avatar
  • 59
1 vote
0 answers
78 views

How can I write the code for an inverse integral transform?

How can I code any type of integral transform with its inverse integral transform in Mathematica which gives the correct results and properties? Below is the example for Elzaki transform: ...
Kishor Kshirsagar's user avatar
0 votes
0 answers
51 views

Way to download all attachments from yahoo.com

For a long time now I want to download the attachments from my yahoo.con mail, only the files, no text, but in batches, so MMA gets into my mail and downloads every attached file it finds in a folder. ...
zeros's user avatar
  • 2,263
1 vote
1 answer
70 views

How to represent a digraph in a 2D circle structure using NeighborhoodGraph[.]

This code works and delivers NeighborhooGraph[.] of a chosen vertex. The resulting graph is bit difficult to understand and therefore I like represent the same ...
Tugrul Temel's user avatar
  • 6,183
4 votes
1 answer
120 views

Questioning Mathematica's Condition Representation: Strange Solution for Integer Variable

I have the following sequence: $$f_n(x)=\left\{\begin{array}{cl} 1 & \text { if } 0 \leq x<\frac{1}{2} \\ 1-(n+1)\left(x-\frac{1}{2}\right) & \text { if } \frac{1}{2} \leq x<\frac{1}{2}+\...
Mark's user avatar
  • 327
6 votes
2 answers
189 views

Listing all user-defined definitions used in a function call

Is it possible to obtain all user defined definitions (and attributes) that are used in the evaluation of certain command (or alternatively just their symbols which I could imagine being easier when ...
Kvothe's user avatar
  • 4,387
1 vote
0 answers
164 views

How to show the limit of two functions in a code approach zero?

I don't know how to shorten the program, the entire code is required to understand everything: ...
Arbuja's user avatar
  • 59

1
2 3 4 5
11