co.combinatorics – Optimization problem on sums of differences between real numbers with combinatorial constraints

We are given a sequence $S_n$ of $n$ points on a straight line $L$, whose coordinates are denoted by $x_1, x_2, ldots, x_n$ in non-decreasing order (i.e., the corresponding non-decreasing ordered sequence of Euclidean distances between each point of $S_n$ and an arbitrarily chosen point of $L$). Let $D$ be equal to $max_{i,jin (n)} |x_i-x_j|$.

We denote by $tau$ a threshold point on $L$ maximizing the following sum $R(tau)$:

$$R(tau):=left(sum_{substack{1le i<j<kle n: \ x_i,x_j<tau,~~x_k>tau}}
left(sum_{substack{1le i<j<kle n: \ x_i<tau,~~x_j,x_k>tau}}

Given three distinct points with indices $i, j$ and $k$, we define

$$R(i,j,k):={sum_{1le i<j<kle n}


$$R'(tau):=left(sum_{substack{1le i<j<kle n: \ x_i,x_j<tau,~~x_kgetau}}
left(sum_{substack{1le i<j<kle n: \ x_i<tau,~~x_j,x_kgetau}}

Question: What is the minimum value for the ratio $frac{R(tau)}{R'(tau)}$ over all possible sequences $S_n$, asymptotically for $ntoinfty$?

optimization – Is there any good method to find if a grammar is optimal for a problem?

I’ve been thinking about grammatical evolution problems and how the grammar influences the algorithm performance. It came to my mind the huge impact that the grammar that you’re using has in the time that takes an algorithm to reach an optimum solution.

The simplest example would be if your problem doesn’t involve trigonometric operations. If you’re trying to find f(x) = 3x - 1/2, including sins, tangents or square roots in your grammar will, almost certainly, slowen your algorithm as the population complexity will grow. Other not-so-evident simplifications for a grammar would be trigonometric identities:

tan(x) = sen(x) / cos(x)

Talking about this last example, I don’t know how to determine the importance of the impact of including tan(x) between the grammar rules to produce valid solutions. Or in other words, knowing if adding tan(x) will be better in terms of performance than don’t doing it and thus, forcing the evolution to combine two or more operators and terminals to being able to use that operation and making the grammar ambiguous.

So this two are the questions:

  1. Is there any way of knowing if a grammar is optimal for finding a solution?
  2. Which evolutionary algorithm or machine learning method (considering that I’m almost profane in this discipline, some explanation is wellcome) would you use for finding optimal or sub-optimal grammars?


finite element method – Problem with NDSolveValue : “The function value {$Failed} is not a list of numbers with dimensions…”

I was having fun modifying a code given to me as an answer to a previous problem here, courtesy of user Alex Trounev (Thank you again), when I encountered a certain error which I had never seen before.

Here is the aforesaid code :

r0 = 0.5;
h = 1;
(Alpha) = 0.8;

(*region definition*)
reg = Cuboid({.5, 0., 0.}, {1., 2 Pi, 1.});

reg3D = ImplicitRegion(
   r0^2 <= x^2 + y^2 <= 1 && 0 <= z <= 1, {x, y, z});

(*equation + conditions*)
eq1 = D(u(t, r, (Theta), z), 
    t) - (D(u(t, r, (Theta), z), r, r) + 
     1/r*D(u(t, r, (Theta), z), r) - 
     1/((Alpha)^2 r^2) D(u(t, r, (Theta), z), (Theta), (Theta)) + 
     D(u(t, r, (Theta), z), z, z));

ic = u(0, r, (Theta), z) == 1;

bc = DirichletCondition(u(t, r, (Theta), z) == Exp(-5 t), r == r0);
nV = NeumannValue(1, r == 1);
pbc = PeriodicBoundaryCondition(u(t, r, (Theta), z), (Theta) == 0, 
   TranslationTransform({0, 2 (Pi)*(Alpha), 0}));

(*solution computation*)
sol = NDSolveValue({eq1 == nV, ic, bc, pbc}, 
   u, {t, 0, 2}, {r, (Theta), z} (Element) reg);

PlotPoints(Rule)50,PlotLabel(Rule)Row({"t = 

When I run the code, after some time, I get greeted with the following error :

NDSolveValue::nlnum: The function value {$Failed} is not a list of numbers with dimensions {39639} at {t,u(t,r,(Theta),z),(u^(1,0,0,0))(t,r,(Theta),z)} = {0.0138161,{<<1>>},{-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,<<15>>,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,-4.66626,<<39589>>}}.

When I click on the three dots next to the error, I don’t find any information on the error like it’s usually the case. I then decide to google some answers.
I found some answers here while also trying to comprehend the error by looking at this and finally that answer here.

So if I did understand it correctly, such error arises when you use NDSolve (or NDSolveValue) to get a symbolical solution to your equation, but problems come up when you try to numerically evaluate it for plotting purpose, or when trying to get a symbolical result with a function that requires numerical values ?

In any case, I do not really understand why I get such error as my plot part is currently between (* … *) so it shouldn’t matter. As for the rest of the code, I do not really see an error but I am just a beginner so…

Anyway, can a kind fellow enlighten me please ?

functions – Solving the Shifted Neutral Axis Problem

Problem Description:

In solving the “Shifted Neutral Axis” method for the stress distribution of a vertical steel vessel supported on a concrete foundation, we can derive the following expression:

frac{left(gamma+alpharight)-tan (alpha)}{left(gamma+alpharight) sec (alpha )-sin (alpha )}=-beta


$alpha$ is the angle of the “shifted” axis of rotation ranging from $0$ to $pi$

$beta$ is a ratio of dead to lateral load from $0$ to $1$. Real life values usually range from $0.10$ to $0.50$

$gamma$ is a positive geometric and material constant. Real life values can range from $0.05$ to $0.20$

Essentially, this expression suggests that as the lateral load grows, the neutral axis shifts from a maximum value of $alpha=pi$ towards an asymptotic, smaller non-zero value.


Usually, Engineers are given geometric and load constraints ($beta$ and $gamma$) and are told to find the system’s response, $alpha$.

The above expression, being implicit, leads itself to a simple solution via FindRoot(), but it would be ideal to solve for $alpha$ as an explicit function of $beta$ and $gamma$, or at the very least come up with an approximated expression to calculate $alpha$ directly.

I am not sure where to start solving this problem with Mathematica, but pointers would be appreciated.

VSCode PPA problem! – Ask Ubuntu

Hit:1 stable InRelease
Hit:2 focal InRelease                         
Get:3 focal-updates InRelease (107 kB)        
Get:4 focal-backports InRelease (98,3 kB)     
Hit:5 focal InRelease          
Hit:6 disco InRelease          
Hit:7 focal InRelease             
Hit:8 disco InRelease             
Hit:9 focal InRelease            
Hit:10 focal InRelease                    
Ign:11 stable InRelease                     
Hit:12 stable InRelease                          
Hit:13 disco InRelease           
Get:14 focal-security InRelease (107 kB)      
Hit:15 stable Release                       
Hit:17 focal InRelease           
Hit:18 eoan InRelease         
Hit:16 ./ InRelease          
Hit:19 ./ InRelease                          
Hit:20 disco InRelease           
Hit:21 disco InRelease       
Ign:19 ./ InRelease                          
Hit:23 apt/stable/ InRelease                  
Hit:22 ./ Release                            
Get:24 any InRelease (3 938 B)              
Err:26 stable InRelease  
  500  Internal Server Error (IP: 80)
Get:25 any InRelease (23,2 kB)
Get:27 focal-updates/main amd64 Packages (234 kB)
Get:28 focal-updates/main i386 Packages (121 kB)
Get:29 focal-updates/main amd64 DEP-11 Metadata (149 kB)
Get:30 focal-updates/universe amd64 Packages (124 kB)
Get:31 focal-updates/universe i386 Packages (66,3 kB)
Get:32 focal-updates/universe amd64 DEP-11 Metadata (167 kB)
Get:33 focal-backports/universe amd64 DEP-11 Metadata (532 B)
Get:34 focal-security/main amd64 DEP-11 Metadata (21,2 kB)
Get:35 focal-security/universe amd64 DEP-11 Metadata (35,6 kB)
Fetched 1 257 kB in 19s (65,1 kB/s)                                            
Reading package lists... Done
W: Failed to fetch  500  Internal Server Error (IP: 80)
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I get these errors below?
Err:26 stable InRelease
500 Internal Server Error (IP: 80)


W: Failed to fetch 500 Internal Server Error (IP: 80)
W: Some index files failed to download. They have been ignored, or old ones used instead.

Should i just wait or do something?

applications – GALAXY TAB 2 ANDROID 4.0.3. problem reinstalling BorrowBox Library app

I bought the above in April 2017 mainly to use it as an ebook reader for public library services.

I installed Overdrive and BorrowBox, and both have worked fine till now.

However on a recent attempt to use BorrowBox, it ‘jammed’ on an opening screen. Closing down and restarting failed to shift this, and I uninstalled the app, thinking to reinstall it, and get it
working again.

Needless to say, there was no reistall option; and an attempt to reload it from playbox failed with the ‘incompatible’ message.

Bolinda of course does not support or provide earlier versions. The only source I can find on the web has
versions back to 2.9.14, but that requires android 4.1.

I found a reference and download link to V2.7.0, compatible with android 4.0, but the link no longer works.

How can I get back to a usable Borrowbox application, without having to replace an otherwise working tablet?

Have I deleted the code when I uninstalled ? I can find nothing searching the file directory which suggests it might still be there.

Can anyone provide a copy of BorrowBox v2.7.0 or earlier, or point me at a source ?

Hoping someone can point me in the right direction.

algorithms – Smallest subarray problem

Say you have an array of integers like (1, 2, 3, 4, 5, 6), the problem is to find the smallest way to break up the array into sub-arrays where each sub-array satisfies the following requirement:

  • sub-array.first_integer and sub-array.last_integer must have a common divisor that is not 1.

So for (1, 2, 3, 4, 5, 6) the answer would be 2, because you can break it up like (1) and (2, 3, 4, 5, 6), where 2 and 6 have a common divisor of 2 (which is > 1 so it meets the requirement).

You can assume the array can be huge but the numbers are not too big. Is there a way to do this in n or n*log(n) time? I think with dp and caching n^2 is possible but not sure how to do it faster.

data – Problem plotting a bifurcation diagram of logistic map

I see related information from here.

interval = 0.001;
results = 
    Table(logisticValues = 
      Table(Nest(a # (1 - #) &, RandomReal(), 2000), {1000});
     intervals = Table(i, {i, 0, 1 - interval, interval});
     result = BinCounts(logisticValues, {0, 1, interval})/1000;
     Log(result + 0.001), {a, 2.9, 4, 0.001})));
gradraft = 
 ArrayPlot(70 + 10 results, FrameLabel -> {"x(T)", "μ"}, 
  FrameTicks -> {Table({i, N((i - 1)/(Length(results) - 1))}, {i, 
      0.1*(Length(results) - 1) + 1, 
      0.9 (Length(results) - 1) + 1, (Length(results) - 1)/4}), 
      N(2.9 + (i - 1)*(4 - 2.9)/(Length(results((1))) - 1), 
       1)}, {i, (3 - 2.9) (Length(results((1))) - 1)/(4 - 2.9) + 1, 
      Length(results((1))), (Length(results((1))) - 1)/5})})

enter image description here

The following code is from the help information of Nest function:

   Thread({r, Nest(r # (1 - #) &, Range(0, 1, 0.01), 1000)}), {r, 0, 
    4, 0.01}) // Transpose)