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
0 answers
42 views

How to find All Solution of a equation? [closed]

How to get ALL solutions of the equation tanh x = 135 x. What is the command?
user avatar
3 votes
1 answer
151 views

How to speed up the calculation of recurrence formula?

I have a recurrence formula. How to quickly solve P[1] to p[49]? ...
user avatar
  • 107
2 votes
3 answers
91 views

Creating a list from the word cloud

So, the WorldCloud function applied to a string generates a word cloud graphic in which each word is sized according to its multiplicity in the string. Is there a ...
user avatar
2 votes
1 answer
158 views

Define a new rule for multiplication

I am trying to implement a new rule for noncommutative multiplication: $$ x * q^n * y \to q^n * x * y, $$ where $\ast$ stands for noncommutative multiplication and x and y are random products in ...
user avatar
  • 45
0 votes
0 answers
62 views

How do we define the function near the end of my post?

Suppose I have two sets $F_{1,n}$ and $F_{2,n}$ written as: ...
user avatar
  • 199
4 votes
3 answers
192 views

Implementing fast linear search for perfect vertical image alignment

After experimenting with image alignment aprroaches presented here and here and some other approaches involving ImageDistance and ...
user avatar
-1 votes
1 answer
80 views

How to tell Wolfram to do this? [closed]

For a positive integer $N$, let $T(N)$ denote the number of arrangements of the integers $1, 2, \cdots N$ into a sequence $a_1, a_2, \cdots a_N$ such that $a_i > a_{2i}$ for all $i$, $1 \le i < ...
user avatar
3 votes
2 answers
164 views

Easier way to find integers for complex^complex

If I have (a+b I)^(c+d I) and the result is e+f I a,b,c,d should be integers e >= 2 or e <= -2 f so close to zero as possible .. this is the object function I want to minimize How to do this in ...
user avatar
  • 33
0 votes
1 answer
99 views

Scale-like ticks in Mathematica [closed]

I need to have axes ticks similar to the ones shown in the figure below but I can't find the command to do it. Thanks in advance.
user avatar
0 votes
1 answer
53 views

Why would the computation time be hugely different for the same computation expressed in different but totally equivalent forms?

I was trying to plot an interpolation function from fourier data. The plot was very fast and straightforward when I used the following code: ...
user avatar
  • 43
6 votes
1 answer
205 views

Why does NMinimize using NelderMead without PostProcessing always stop at the nearest decade of iterations, e.g. 100, 110, 120

Why does NMinimize using NelderMead without PostProcessing always stop at the nearest decade of iterations, e.g. 100, 110, 120... Perhaps Catch Throw can prevent this e.g., see this answer, but that ...
user avatar
  • 621
0 votes
0 answers
50 views

How to draw the Bifurcation Diagram [duplicate]

How to draw the Bifurcation Diagram for the chaotic system below: ...
user avatar
  • 31
1 vote
1 answer
53 views

Filling a portion of area between two functions

How can I fill the portion of the area between the functions $f(x) = 2x + 4$ and $g(x) = -6x-1$ in the interval $[-1, 3]$? I have searched over here but there are mostly examples that do involve the ...
user avatar
  • 713
11 votes
3 answers
179 views

Faster searching for subsets with pairwise conditions

I am looking for a faster way of finding large subsets of lists that obey pairwise conditions. In particular, I'm looking for a large (over 10k) set of quaternary words (i.e. ordered lists) of length ...
user avatar
  • 30.3k
2 votes
2 answers
109 views

Finding IntegerPartitions[252] with no zero and no duplicates

Well, I am trying to execute the following code: ...
user avatar
  • 1,723
1 vote
0 answers
62 views

Can LinearOptimization (ex. LinearProgramming) support other methods (Ellipsoid method)?

Can LinearOptimization (ex. LinearProgramming) support methods other than "InteriorPoint", "Simplex", "RevisedSimplex"? Specifically, I need the Ellipsoid Method. Are ...
user avatar
  • 612
2 votes
0 answers
184 views

How to plot the lines of the magnetic fields of a Tokamak using StreamPlot3D?

I would like to plot the magnetic field lines of a tokamak. Introduction Since the magnetic field is solenoidal: $\nabla \cdot \vec{B} = 0$, it is possible to decompose it as: $\vec{B} = \vec{B}_{T} +...
user avatar
  • 483
0 votes
1 answer
36 views

Simplify or Solve in term of some expressions (again) [duplicate]

Suppose x=a, y=ad-bc, z=ade-bce-fga Obviously, z = (ad-bc)e-(fg)a = e(y)-fg(x) I want to get the output to be z = e(y)-fg(x) I have tried Solve[{x==a, y==ad-bc, z==ade-bce-fga},z,{a,b,c,d}] as some ...
user avatar
  • 95
1 vote
1 answer
60 views

How to create a flexible BarChart[ ] with Manipulate[ ]

This question is nothing more than making a few changes to an already working code. I put that code into Manipulate[...] to be able to choose a subset of countries ...
user avatar
  • 4,391
0 votes
1 answer
95 views

An example code for doing a loop [closed]

I would like a code that works for doing loops as in the toy example below. This would help me to understand how to work with loops in more general contexts as I am still a beginner in Mathematica. ...
user avatar
  • 207
0 votes
0 answers
40 views

Finding the limit of the average of a sequence?

...
user avatar
  • 199
1 vote
1 answer
71 views

How to dynamically link a bar chart to a table and present them in a single synchronized figure

This answer has addressed the question of presenting a bar chart and its data table together in a single figure. Not to repeat the same question, I should point out that the answer given is not ...
user avatar
  • 4,391
5 votes
1 answer
326 views

Sum a number's digits until only one digit remain

I want to iteratively calculate the sum of a number's digits, until the result contains only one digit. For example, when $n=67946$ we get: $$6+7+9+4+6=32\space\to\space3+2=5\tag1$$ So, when $n=67946$ ...
user avatar
  • 1,723
5 votes
8 answers
1k views

Making the number 12345...n

Well, I am trying to write a code that makes the number: $$123456\dots n\tag1$$ So, when $n=10$ we get: $$12345678910$$ And when $n=15$ we get: $$123456789101112131415$$ And when $n=4$ we get: $$1234$$...
user avatar
  • 1,723
1 vote
2 answers
53 views

combine those $n$ lists without specifying whole $n$ sets explicitly?

Suppose I have $n$ lists, How to combine those $n$ lists without specifying whole $n$ sets? I mean; For a given lists list1={{3, 1, 1}, {1, 3, 1}, {1, 1, 3}} list2={{2, 2, 1}, {2, 1, 2}, {1, 2, 2}} ...
user avatar
  • 335
2 votes
2 answers
117 views

For a given set, how to get rid of the some particular set?

Consider the following decomposition list of $\{a1,a2,a3,a4\}$ into three parts as $t$, t={{{a1, a2}, {a3}, {a4}}, {{a1}, {a2, a3}, {a4}}, {{a1}, {a2}, {a3, a4}}, {{a1, a2}, {a4}, {a3}}, {{a1}, {a2, ...
user avatar
  • 335
4 votes
1 answer
157 views

How to reformat a Dataset[]

I have a dataset jdataSDG1 and like to reformat it as jdataSDG2. ...
user avatar
  • 4,391
0 votes
1 answer
70 views

Export list of elements to .txt file

Well, I have the following Mathematica output (as an example): {3,6,7,12,45,67,89,101,349,692} And I am looking for a code that can export this to a .txt file that ...
user avatar
  • 1,723
0 votes
0 answers
32 views

Making a binary number $n$ that must contain $k$ times a $1$ such that `k==GCD[n,IntegerReverse[n]]`

Well, I am trying to code the following thing in Mathematica: I have a binary number $n$ that must contain $k$ times a $1$. So for example: when $k=5$ the following binary numbers does fit the rule: $$...
user avatar
  • 1,723
1 vote
1 answer
80 views

Mathematica Table

I would like to do a table as shown in Mathematica but I am not sure the code that I need to use for that. Any help will be highly appreciated. Thank you
user avatar
1 vote
1 answer
73 views

Solving a system of equations using a list of possible solutions

Well, I have for example the following input and output of a code: ...
user avatar
  • 1,723
3 votes
1 answer
83 views

Removing a element from list when obeying a certain condition

Well, I have the following code: Select[PowersRepresentations[n, a, b], DuplicateFreeQ[#] && ! MemberQ[#, 0] &] This code finds ...
user avatar
  • 1,723
1 vote
1 answer
72 views

What does Sin[2. x] mean? [closed]

I am working with a particularly long function that, when I want to evaluate it at a certain $x$, shows: As you can see there are expressions herein of the form Sin[2. x] or Cos[2. x]. What do these ...
user avatar
1 vote
1 answer
54 views

How to plot the 1st element value of a 2D point against time? [closed]

...
user avatar
  • 43
2 votes
2 answers
147 views

Find centroid point which depends on time and plot it in animation along with curve?

Given a partial differential equation, we can NDSolve for its solution. In my case I got a function of three variables $u(t,x,z)$. I wish to study the case when we restrict $z=0$. Most importantly, I ...
user avatar
  • 43
1 vote
1 answer
76 views

how to draw a line at mean value of cross-section and time-series data using Bar Chart

I have Dataset; ...
user avatar
  • 4,391
1 vote
1 answer
83 views

how to perform operations on a subset of a dataset

I have this data set: ...
user avatar
  • 4,391
1 vote
1 answer
56 views

Data parallelism for independent probabilistic trials

I'm considering the best way to implement the data parallelism features of Mathematica for a specific task. To that end I have a minimal code example below which contains the basic features of my ...
user avatar
  • 271
2 votes
1 answer
141 views

How to convert a dataset into an alternative format

I have the following dataset: ...
user avatar
  • 4,391
-1 votes
1 answer
251 views

how to make BarCharts or Line Plot based on specific identifiers in a Dataset over two years

Given the following datasets: ...
user avatar
  • 4,391
2 votes
1 answer
75 views

How to plot different dependent varaibles against the same independent variable

Let's say I have a dispersion relation $\omega=\exp{k}$, how should I write a mathematica code to ask for plots of $\omega$ against $k$ as well as the phase speed $\omega/k$ against $k$ for a range of ...
user avatar
  • 43
1 vote
1 answer
98 views

how to use an unformatted database imported from Excel into Mathematica and draw various charts

In my earlier question (in this link) the given database is nicely formatted with columns denoting data for variables across countries and years. But, data sets are not always nicely formatted. Here ...
user avatar
  • 4,391
0 votes
1 answer
53 views

What does tag plus protected mean in this case? [closed]

I am trying to define a function for future NDSolve use oweqn = (1/(c)^2) D[y[t, x], {t, 2}] - D[y[t, x], {x, 2}] + k1 y[t, x] = 0 Where I predefined $c$ to be a ...
user avatar
  • 43
4 votes
2 answers
126 views

how to efficiently use a time series database to plot Barcharts or LinePlots

I have the following input: ...
user avatar
  • 4,391
0 votes
2 answers
49 views

How to specify range in an implicit relationship with variable?

Here is the plot I want to do: ContourPlot[3 Abs[x] y (y^2/x^2 - 1/3) - 2/(Abs[x] y) == 3 Sqrt[1 - y^2/x^2], {x, -20, 20}, {y/x, 1/Sqrt[3], 1}] However when I ...
user avatar
  • 43
2 votes
1 answer
149 views

How to draw a barchart with a vertical line

The following code works just fine with a few caveats. ...
user avatar
  • 4,391
2 votes
0 answers
72 views

Mathematica package for computing Macdonald polynomials

I want to implement computation of Macdonald polynomials in mathematica. A similar question was raised in another question 5 years ago (Macdonald-Koornwinder polynomials?), but received no clear ...
user avatar
  • 133
0 votes
1 answer
38 views

FoldList type evaluation for multivariable function

In the example code which follows I define a two variable conditional function h[_i, _v], one variable denotes the integer index i, and the other is an N-dimensional vector v (I denote dimension 'N' ...
user avatar
  • 271
-1 votes
1 answer
85 views

how to plot multiple plots sharing a common X-axis and Y-axis

With the following Code, I generate various ListLinePlots but I like to create the example ...
user avatar
  • 4,391
1 vote
1 answer
141 views

How to use VectorAngle[] in AnglePath3D[]?

Suppose I have a specific angle that I calculate from two vectors, in 3D: ...
user avatar
  • 1,303

1
2 3 4 5
9