Questions tagged [algorithm]

Questions about algorithms used or which might be used to implement a procedure known by name or loosely but not in detail. The subject of the question may be a procedure mentioned in the literature or a Mathematica built-in function

Filter by
Sorted by
Tagged with
2 votes
1 answer
71 views

Taylor approximation of integrals

I have BVP as in the picture and I want to solve it numerically by method given as follow. In the original paper, it is motioned that first iteration is computed and other are computed with Taylor ...
Junaid Ahmad's user avatar
5 votes
2 answers
124 views

Minimum/optimal number of tiles to cover all boxes

I have been struggling with the following problem. Given: the coordinates of a bunch of boxes/rectangles (in the form {xmin,ymin,xmax,ymax}) the overall image size ...
Fraccalo's user avatar
  • 5,997
1 vote
3 answers
189 views

How to implement tridiagonal matrix algorithm?

I have created the tridiagonal matrix below: ...
Mule's user avatar
  • 43
0 votes
0 answers
78 views

Which algorithms are implemented in community detection based on AdjacencyGraph[.] and WeightedAdjacencyGraph[.]?

The following code generates two distinct community structures: one uses a simple adjacency matrix (with 1 and 0), another uses a weighted adjacency graph (with positive real numbers). I like to know ...
Tugrul Temel's user avatar
  • 5,470
5 votes
4 answers
390 views

An accumulated moving average

1. Problem statement In accordance with the standard definitions the inbuilt MovingAverage ...
eldo's user avatar
  • 47.8k
4 votes
2 answers
595 views

How to calculate equivalent resistance for a network of same-value resistors?

Let's assume I have n identical resistors. I can connect them either in series or in parallel (let's disregard bridge connections for now). Now, I want to list all ...
emnha's user avatar
  • 2,411
5 votes
2 answers
178 views

Fill a sequence containing missing values

Example data list = {Missing[], Missing[], 100., 200., Missing[], Missing[], 250., 210., Missing[]}; With downloaded data I often have the situation that there are ...
eldo's user avatar
  • 47.8k
6 votes
2 answers
233 views

Split a sequence with conditions

I need a function which splits a sequence of arbitrary length at x random points and which guarantees that each partition (bin) contains a minimum of ...
eldo's user avatar
  • 47.8k
5 votes
5 answers
588 views

Analyzing football games (pairing matrix)

I want to cross-tabulate football games over several years. Setting up example pairings: Please note that there can be up to 20 clubs and a couple of thousand matches! ...
eldo's user avatar
  • 47.8k
8 votes
6 answers
437 views

Accumulate up and down

I want to accumulate positive and negative values separately. dt = RandomSample[Range[-10, 10]] {3, -5, 2, -9, 1, -1, 0, 8, 10, 4, -7, 7, -8, -3, 6, -4, -2, 5, -10,...
eldo's user avatar
  • 47.8k
9 votes
9 answers
660 views

Partition a random sequence composed of three numbers

I want to partition an array composed of 1s, 2s and 3s in such a way that, going from left ...
eldo's user avatar
  • 47.8k
9 votes
4 answers
645 views

Smooth a list of integer values

I want to smooth a list of Integers so that outlying values become less spiky. The result vector must again contain Integer ...
eldo's user avatar
  • 47.8k
7 votes
6 answers
357 views

Replace duplicate list values with unique elements

My request is a follow-up on this question: Replacing duplicates instead of deleting them What if we want to replace duplicated values not with a single value but with newly created values distinct ...
eldo's user avatar
  • 47.8k
3 votes
0 answers
61 views

How to ask Mathematica to give me possible closed forms from a given numerical approximation

Imagine I am solving a some Infinite Series and I cannot directly compute the value using Mathematica. The value of this series approximates $ 0.785398....$ (Actually is $\frac{\pi}{4}$). I want to be ...
No-one Important's user avatar
4 votes
2 answers
151 views

Extract terms containing symbols

I would like to be able to extract terms that contain a symbol expression and leave the special function alone. I have a list: ...
Mariusz Iwaniuk's user avatar
5 votes
3 answers
295 views

Solving the Covering Salesman Problem in Mathematica

Say I have a weighted graph ...
Tomi's user avatar
  • 4,262
1 vote
0 answers
84 views

Solving system of linear equations in specific order

I know how to solve set of linear equations using Solve, or by hand of course. However, my current problem requires me to solve the equations in a specific order, ...
Lelouch's user avatar
  • 513
2 votes
1 answer
198 views

Finding induced subgraphs that are also trees

Given a graph $G$ with $n$ vertices, I need to find a subgraph consisting of $m$ vertices $\{v_1,\ldots,v_m\}$, and the induced subgraph of this subgraph should also be a tree. For example, suppose $G$...
Dotman's user avatar
  • 414
1 vote
1 answer
34 views

Unable to apply Reduce to a variable number of inequalities (obtained by InputFields)

I'm new to Mathematica and I'm stuck on this piece of code. The code is supposed to let the user choose how many inequalities (in a number between 1 and 5) they want to be evaluated. ...
Gbekss's user avatar
  • 11
4 votes
4 answers
272 views

Efficient generation of n-bit base-m Gray code with adjacent bit changes

How can I generate n-bit base-m Gray code in Mathematica, where only 1 bit changes at a time and all possibilities are covered? I have been hitting my head against a metaphorical wall for a few hours ...
More Senne's user avatar
3 votes
1 answer
174 views

On the solution of systems equations with exact coefficients

It all starts with the following system of equations that I can't solve by hand: ...
πρόσεχε's user avatar
0 votes
0 answers
52 views

How to use quasi-Newton methods to solve a non-linear system?

Consider the following function, for $\mathbf{x}=\{x_1,...,x_n\}$ $$ F(\mathbf{x})=\sum_{k=0}^n \frac{e^{A_k\mathbf{x}}-e^{B_k\mathbf{x}}}{C_k\mathbf{x}}-\mathbf{b} $$ where $\{A_k\}$, $\{B_k\}$ and $\...
sam wolfe's user avatar
  • 4,167
5 votes
1 answer
85 views

How to Find a Weighing Matrix of Size n?

Weighting matrices appear in the statistical design of experiments (Weighting Matrices and Statistical Design of Experiments. A weighting matrix is a generalization of Hadamard matrices, e.g., ...
Craig Carter's user avatar
  • 3,968
1 vote
0 answers
92 views

Solving the Unbalanced Assignment Problem with FindMinimumCostFlow?

I want to adapt this code from this answer to work with unbalanced bipartite graphs: ...
WaterFox's user avatar
  • 185
2 votes
2 answers
119 views

How can I calculate complicated infinite sums with FindIntegerNullVector (or related methods)?

I've recently been very interested in the wonderfully complex world of Euler sums, i.e. (convergent) infinite sums that, roughly speaking, consist of some rational polynomial combination of ...
TheOutZ's user avatar
  • 215
0 votes
0 answers
103 views

Implement of Euler Method of Parabolic PDE

I'm experimenting with different schemes for numerically solving PDEs in Mathematica. I use NestList to implement the Euler Method for 1-D PDE, the code is concise: ...
Charmbracelet's user avatar
0 votes
0 answers
61 views

What strategy would you adopt for this deep search on a function?

Ok, so I have a problem where I have a function that depends on 9 parameters and a bound condition $$f(x,y,z,w,t,u,v,r,s)<K$$ Now all these variables take discrete values such as: $$x \in \{x_1, ...
Granger Obliviate's user avatar
2 votes
3 answers
112 views

Iterative method for fixed point of a mapping with domain and range contained in $\mathbb{R}^{2}$

Let $X$ be a metric space and $T:X\rightarrow X$ be a function. A point $x\in X$ is called a fixed point of $T$ if $x=Tx$. For example, if $X=[0,1]$ and $Tx=\frac{x}{2}$ then $T$ has a unique fixed ...
Junaid Ahmad's user avatar
20 votes
4 answers
1k views

What's wrong with this FFT-based Von Kármán vortex street simulation?

About 9 years ago, I came across this interesting website, and found the following paragraph with a broken Mathematica code sample: When fluid passes an object, it can leave a trail of vortices ...
xzczd's user avatar
  • 63.5k
4 votes
3 answers
313 views

Find all sets whose index is divisible by the elements

Suppose I have such a set $S=\{3,4,5,...n+2\}, n\in \mathbb{Z}_{>\, 0} $, $a_n$ is any permutation of $S$ such that $n|a_n$, I want to know how many such $a_n$. The easy but inefficient way to do ...
expression's user avatar
  • 5,562
2 votes
1 answer
108 views

Do loop not running the If clause [closed]

My full code is a bit more complicated but I hope that this works as a minimal example. ...
user34047's user avatar
  • 335
2 votes
0 answers
50 views

Memorization for Rule + ReplaceRepeated?

Question When build packages of noncummutative algebras I met the choice: Rule + ReplaceRepeated ...
Lacia's user avatar
  • 2,208
0 votes
0 answers
62 views

Algorithm: Permutations & Signature

Theoretical side Simple example: If I have two sets $A_1=\{1,3\} ,A_2=\{2,3\}$ and Permutations[{1, 2, 3}]= $\left( \begin{array}{ccc} 1 & 2 & 3 \\ 1 &...
Emad kareem's user avatar
0 votes
0 answers
56 views

Algorithm consisting of modules returning multiple errors

I'm trying to write a genetic algorithm that will take a list of lists of reals in interval [0,1], my "starting population", "score" them according to a fitness function, append ...
J0ta's user avatar
  • 65
0 votes
1 answer
103 views

Visualization of an iteration scheme in Mathematica

I have a mapping T as attached (here. Now for $x_{0}\in C$ the Mann iteration process read as $x_{n+1}=(1-\alpha_{n})x_{n}+\alpha_{n}Tx_{n}$ n=0,1,2,3,... Now I want to obtain a visualization of the ...
Junaid's user avatar
  • 161
2 votes
0 answers
127 views

Implement of faster(maybe paralleled) K-Means clustering

I am writing an algorithm that needs to add noise to the centroid of each iteration on top of KMeans. Therefore, I need to implement a custom KMeans function. I checked out the methods in Mathematica ...
Charmbracelet's user avatar
0 votes
1 answer
500 views

Algorithm to convert real numbers decimal to binary

Currently trying to write code that converts decimal floats to binary base form (I know BaseForm exists). Currently I'm working with an example that takes 3.3 and converts it: ...
EconomicsandMathematica's user avatar
1 vote
1 answer
119 views

Recursive relationship too slow

Writing: ...
πρόσεχε's user avatar
0 votes
0 answers
225 views

Particle Swarm Optimization implementation in mathematica

Hi I am new to mathematica, I want to use it to implement PSO instead of using matlab. Could anyone suggest me how to find some implementation examples with code or its general implementation for ...
Syed Iftekharuddin's user avatar
1 vote
1 answer
143 views

A method for endpoints in mathemtica [closed]

If $(\mathbb{R},|.|)$ is a real line, $C$ a subset of $\mathbb{R}$ and $K(C)$ denote set of a compact subset of $C$. Define a multivalued mapping $T:C\rightarrow K(C)$. We know that a point $p\in C$ ...
Junaid's user avatar
  • 161
0 votes
3 answers
301 views

How to compute higher iterations in mathemtica

I have the equation $u^{\prime\prime}(t)+u^{2}(t)-t^{4}-2=0$ such that $0\leq t\leq 1$and also I have $u(0)=0$ as well as $u(1)=1$. Noe the exact solution of the equation is $u(t)=t^{2}$. Now I ...
Junaid's user avatar
  • 161
0 votes
1 answer
291 views

How to obtain the convolution of these functions?

I am starting to use Mathematica. I wanted to compute $$\nabla F*\phi(x),\;x\in\mathbb{R^2}$$ where $F(x)=\ln\|x\|$ and $\phi(x)=\chi_{B(0,2)}(x)$. I am a new user of this software, so I don't know ...
prosep's user avatar
  • 101
2 votes
2 answers
751 views

Solution of differential equation by by an iterative method

Let $y^{\prime\prime}(t)+y^{2}(t)-t^{4}-2=0$, where $0\leq t\leq 1$. The boundary conditions are $y(0)=0$ and $y(1)=1$ and so its exact solution is $y(t)=t^{2}$. Now I want to compute the solution by ...
Junaid's user avatar
  • 161
0 votes
0 answers
135 views

On the numerical computation of polynomial roots

In the guide on the NRoots[] function I read: ...
Monster's user avatar
  • 291
2 votes
1 answer
55 views

How many nearest neighbours in a classifier by default?

I've been running a classifier on my data with the 'NearestNeighbors' method. I've learned that I can specify the number of neighbours used with the following command: ...
LNah's user avatar
  • 189
1 vote
0 answers
89 views

Shortest paths Knights Tour

I am trying to print the minimum steps needed to traverse a chessboard as a knight from one diagonal position to the other. I have the following code: Building the chessboard I started with creating ...
Brandon Evans's user avatar
2 votes
3 answers
160 views

Path finding in Complete Graph [closed]

I have the following Complete Graph with random labels on its edges ...
mclord's user avatar
  • 167
1 vote
0 answers
76 views

“Largest” symbolic common factor of an integer sequence (not simply GCD)

Suppose, I have a finite fragment of a quickly increasing sequence of integers $\{a_n\}$ that is too complex, unusual, or irregular for FindSequenceFunction to find ...
Vladimir Reshetnikov's user avatar
1 vote
0 answers
94 views

How to optimize Code for Wolfram Challenges? [closed]

I am wondering if anyone who has knowledge of optimizing programs in the Wolfram language has any advice on how to optimize the following quantities of programs written to solve Wolfram Challenges. I ...
Peter Burbery's user avatar
0 votes
0 answers
50 views

Numerical minimization of function

So I have the following equation: 3 Sqrt[9.15753*10^-6 + 25.1556 TolC^2 + 25.1556 TolL^2]==1; Now TolC and TolL can take respectively the values of these lists: <...
Granger Obliviate's user avatar

1
2 3 4 5
8