Questions tagged [code-request]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
38 views

Obtaining the results of tagged cells in a notebook from another notebook

My objective is to read the results of several tagged cells in a notebook NB1 from another notebook NB2. Following the ...
0
votes
1answer
46 views

Retrieving the evaluation result of an Initialization Cell in a notebook `nb1` from another notebook `nb2`

I have a very long code in a notebook nb1 in which all the initialization cells are tagged. I have another notebook nb2 where I ...
0
votes
1answer
48 views

Possible way to plot the solution density of diophantine equations

Well, I'm trying to investigate the density of solutions to Diophantine equations. What is a general method to describe that density? I've two functions: $$\varphi\left(\text{a},\text{b},\text{c}\...
3
votes
1answer
193 views

How can I generate a tailor-made directed graph from a given matrix

Given a matrix mat: mat = {{1, 5, 2, 6}, {4, 3, 4, 1}, {0, 1, 4, 0}, {2, 1, 3, 4}}; I want to apply the following conditions ...
2
votes
2answers
103 views

Finding a program that can find integer solutions for large values of a variable

I've the following code: ...
0
votes
1answer
73 views

How this equation is solved in reals

I have tried to solve this equation $2^{-2 ^{2^{-x}}}=2$ using FindInstance[2^(-2^(2^(-x))) == 2, x, Reals] The result is ...
5
votes
2answers
194 views

Plot problems: vertical lines and letters [closed]

In few words, I would make this graph: My many problems are the following: How do I plot a vertical line? What's the equation? How do I add the letters on the lines? How to make the Ticks like $...
6
votes
1answer
52 views

Determinant of Gauss (Area of a polygon of n vertices) how to implement

A very useful procedure to find the area of ​​any irregular polygon is through the Gauss determinant. It involves drawing the figure on a Cartesian plane, setting the coordinates of each of the ...
4
votes
3answers
222 views

Writing a program that will filter the integer solutions

I've the following equation: b==(-12 + Sqrt[3] Sqrt[ 3 (-4 + r)^2 + 12 a^2 (-2 + r) - 4 a (-5 + r) (-2 + r) + 4 a^3 (-2 + r)^2] + 3 r)/(6 (-2 + r)) ...
0
votes
1answer
33 views

Encountering error in For-loop, If statement and Print Function [closed]

I am encountering some error while trying to find roots of equation using Bisection method. In this method, you take an interval (a1,b1), here I have taken (0,1). If f(a1)f(b1)<0, then you take p1 =...
2
votes
1answer
36 views

Finding the 3D-model of a function that is rotated around the x-axis

How can I find the 3D model that is created by revolving the function: ...
8
votes
4answers
375 views

How can I automate this tensor computation?

I am doing this work by hand, but it takes a lot of time and I make several calculation errors, so I was thinking to make Mathematica to calculate this for me, but I am stuck at the very beginning. I ...
2
votes
3answers
67 views

Find the number of true's in a TrueQ expression

How can I find how many times the code: Table[TrueQ[FractionalPart[Sqrt[n]] == 0], {n, 1, m, 1}] Gives the value True back for a variable $m$? So, we know that ...
3
votes
3answers
149 views

Mathematica code for Van Wijngaarden transformation?

The Van Wijngaarden adaptation of the Euler transform is used to accelerate convergence of an alternating series. An efficient algorithm for this appears in Numerical Recipes. Unfortunately, that ...
3
votes
0answers
83 views

Mathematica implementations of classical genetic algorithm optimization

Are there any Mathematica implementations of genetic algorithm optimization routines, including third-party and commercial? (DifferentialEvolution isn't quite what ...
5
votes
2answers
212 views

Finding the symbolic expression for the loss function of a basic feed forward network

Is there any basic code available to get the symbolic expression of the cross entropy (and/or mean squared error) loss function for feed-forward neural network with one or more hidden layers in ...
2
votes
1answer
146 views

Monte Carlo Simulation of a Double Well Potential (Edited)

I am looking for a possible way to simulate the temperature effect on a collection of atoms sitting within a double well potential, say something like ...
0
votes
0answers
51 views
1
vote
2answers
147 views

Eigen value solution of coupled ODEs

I want an eigen value solution of following coupled ODEs: But the code showing errors. ...
1
vote
1answer
58 views

Replace second derivative with product rule

Suppose that after some calculations, I find a[x]*D[g[x],x,x]+b[x]*D[h[x],x,x]+c[x]*D[j[x],x] What sort of operations do I need to do in Mathematica such that ...
8
votes
2answers
398 views

Catmull-Clark and Doo-Sabin Subdivision Implementations

I want to work on subdivision surfaces. Unfortunately, I don’t have any source code to start with. I need some Mathematica codes for applying Catmull-Clark and Doo-Sabin methods. I would like to ...
1
vote
1answer
63 views

Looping a function that requires previous calculations in order to continue

I am trying to solve a system of overdetermined linear equations for 2 unknowns with 3 variables. For a given equation of a line, we can write it as: ax + by = c, which expressed in vector form is ...
1
vote
2answers
47 views

Using FittedModel without clashing symbols

For some FittedModel, the "BestFitParameters" are given in terms of the symbols used to define the model. ...
0
votes
0answers
49 views

Changing the origin of the coordinate system aligned on an image when using the ImageFowardTransformation function

When using the image transformation command ImageFowardTransformation[image, function] the pixels of the image you input are in cartesian coordinates that by ...
0
votes
1answer
133 views

Creating a numerical table of values and using an interpolation of them to transform pixels in an image by the ImageTransformation command

I am trying to carry out point "Implementing Map" on this paper Interstellar wormholes however I am using my own equations not those given (only the same method). I have generated a list of values ...
0
votes
0answers
147 views

How to differentiate with respect to a function

I have some complicated expression, let's call it $X_n$, for which I don't have a closed form, but I do have a recurrence relation. It is given in terms of some functions $u(x,y),$ $v(x,y),$ and ...
2
votes
0answers
86 views

Using Image Transformation to create image sky view of what its like to be near black hole (Not a wormhole) [duplicate]

Question : I am trying to carry out point 3. "Implementing map" on page 13 in the paper Interstellar wormholes using my own equations not those in the paper. however am not 100% sure on how to go ...
0
votes
0answers
33 views

Inverting a matrix when its elements are given by difficult expressions?

I have a matrix which is composed by these elements: $$\mathcal{K}_{11} = \frac{3\alpha^{4/3}(4\mathcal{V} - \xi +6\alpha \sum_{k = 2}^n\lambda_k \tau_k^{3/2})}{4(2\mathcal{V}+\xi)^2(\mathcal{V}+\...
0
votes
1answer
135 views

Integrating Hamiltonian equations using NDSolve

Would someone be able to integrate numerically the equations at the bottom of page 12 in the paper Interstellar Wormholes given some initial conditions of your choice. Reading the first paragraph of ...
5
votes
1answer
302 views

Integrating Hamilton's equations for the Schwarzschild metric

Part 1 I am trying to integrate Hamiltons equations for the Schwarzschild geometry using NDSolve, these equations must all be integrated simultaneously and are nice ODE's. A similar task is done in ...
0
votes
0answers
6 views

Using manipulate in the plot of a function that depens on a FindRoot function [duplicate]

I've the following two codes: FindRoot[Abs[Uin*Sin[2*Pi*fin*T - (Pi/2)]] - 2*Ud == (Uin - 2*Ud)* Exp[-T/(c*Rb)], {T, 1/(4*fin), 1/(2*fin)}] And: ...
0
votes
0answers
91 views

Solving a differo-integral equation [duplicate]

I've the following equation for x(t): $$x'(t)\cdot\text{a}+\text{b}\cdot\frac{x'(t)}{x(t)+\text{c}}+\frac{\partial}{\partial t}\left\{\int_0^tx(\tau)\cdot\mathcal{...
0
votes
0answers
58 views

Derive a tangent using the AceGen package

I want to derive the algorithmic tangent of a material model, but all I have given is the potential and the flow function. Are there any exmaple codes or tutorials for the implementation with AceGen? ...
0
votes
1answer
86 views

Solving a difficult differential equation

I've the following DE, describing a physical phenomenon. And the prupose is to solve that DE using Mathematica $$x(t)\cdot r+x'(t)\cdot l+a\cdot\ln\left(1+\frac{x(t)}{b}\right)=0\space\...
4
votes
3answers
384 views

Generate numbers relatively prime with a given number

I am interested in a function such that f[m, i] = n where m, n are positive integers and n ...
12
votes
1answer
2k views

How to make a spiroglyphic?

Some (older) members of this group might remember playing vinyl LP records. Recently, at the Abbey Road studio there was a spiroglyphics coloring book for sale. It looks like a nice programming ...
3
votes
1answer
125 views

Using ImageTransformation to implement relativistic aberration effect

****The desired effect should be images that look like something out of Star Wars like when you are boosting to high speeds in the Millennium Falcon.**** This problem was tackled by Daniel Weiskopf ...
2
votes
0answers
122 views

Exterior products of differential forms

In $ \mathbb{R}^4 $ I have the forms $ \omega_1=z\;\mathrm dx+t\;\mathrm dy+x\;\mathrm dz+y\;\mathrm dt $ and $ \omega_2=t\;\mathrm dx+z\;\mathrm dy+y\;\mathrm dz+x\;\mathrm dt$. I want to compute ...
16
votes
1answer
364 views

Programmatically annotate code?

Is there a known way to programmatically annotate code like workflows (without using boxforms or drawing tools): Minimal example that doesn't work: ...
0
votes
1answer
56 views

How to remove the 2 same plot from arrays of plot

...
2
votes
1answer
231 views

Computing the Lyuponov exponent for the Duffing system

Does anyone know (simple) Mathematica code for computing the Lyuponov exponent for the Duffing system? ...
8
votes
2answers
113 views

Robust DuplicateFreeQ for numerical data

I am looking for a fast and robust DuplicateFreeQ equivalent for numerical data. Floating point numbers should normally be compared with some tolerance, as ...
1
vote
1answer
165 views

NDEigensystem to find eigenvalues and eigenfunctions of coupled differential equations:

I would like to numerically solve the following system of coupled differential equations: ...
0
votes
1answer
154 views

Font Size in Plot Legends

How can I change the font size of the Legend? I have to plot 5 functions, and I already wrote the code, with the colors and so on. But when I write the final code for the PlotLegends, that is ...
5
votes
2answers
146 views

Simulating a hybrid dynamical system

I am trying to simulate the following hybrid ode $$ \begin{eqnarray} \dot{x}=-\left(x-a+u\right) \end{eqnarray} $$ where $u$ is given by $$ \begin{eqnarray} u(t)=\left\{\begin{matrix} 1 & \text{...
3
votes
1answer
56 views

What is a good way to implement a versatile folder structure checking system?

I'm writing an 'application' (set of *.wl and *.wls files) that requires a given folder structure to function; I am not sure how this structure will eventually look like, because it changes as I ...
2
votes
1answer
50 views

How to manipulate an equation so that it is in terms of a certain variable

For example, I have an equation $$z = \frac{(1+a)}{(1+b)} + 3x + 4y^2$$ I have a new variable where $$R = \frac{(1+a)}{(1+b)}$$ Is there a function or code where I can tell Mathematica to ...
4
votes
3answers
590 views

Drawing the Pursuit curves

I was reading this post on Filling Space with Pursuit Polygons. I didn't really see where the filling was, but found it quite interesting. Then I saw these pursuit ...
17
votes
5answers
1k views

How to visualize the Cremona method for cardioid generation

I saw this on Twitter and found the cardioid drawing quite satisfying. I don't know much mathematical background, and was wondering if I can draw this using Mathematica. And this one apparently take $...
14
votes
3answers
866 views

Convert QR code to a Nonogram puzzle

I remember there was a GCHQ puzzle where Nonogram was created to generate a QR code in 2015. It was a quite popular puzzle. I am wondering if MMA can be used to create a Nonogram from an existing QR ...