$u_{tt}=c^2u_{xx}-alpha u \

u(0,t)=u(L,t)=0, t>0 \

u(x,0)=f(x) \

u_t(x,0)=g(x), 0<x<L \

alpha>0.$

# Tag: problem

## 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}}

D-(x_j-x_i)right)+

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

D-(x_k-x_j)right)~.

$$

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

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

max{D-(x_j-x_i),D-(x_k-x_j)}}~,$$

and

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

R(i,j,k)right)+

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

R(i,j,k)right)~.

$$

**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:

- Is there any way of knowing if a grammar is optimal for finding a solution?
- 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?

Thanks

## 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 :

```
(*parameters*)
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);
(*frames=Table(DensityPlot3D(sol(t,Sqrt(x^2+y^2),ArcTan(x,y),z),{x,y,
z}(Element)reg3D,ColorFunction(Rule)"Rainbow",OpacityFunction(Rule)
None,Boxed(Rule)False,Axes(Rule)False,PlotRange(Rule){0,1.5},
PlotPoints(Rule)50,PlotLabel(Rule)Row({"t =
",t}),ColorFunctionScaling(Rule)False),{t,.05,1,.05})
ListAnimate(frames)*)
```

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

$$

where,

$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.

**Objective:**

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 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease (107 kB)
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease (98,3 kB)
Hit:5 http://ppa.launchpad.net/apt-fast/stable/ubuntu focal InRelease
Hit:6 http://ppa.launchpad.net/apt-fast/stable/ubuntu disco InRelease
Hit:7 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease
Hit:8 http://ppa.launchpad.net/git-core/ppa/ubuntu disco InRelease
Hit:9 http://ppa.launchpad.net/kritalime/ppa/ubuntu focal InRelease
Hit:10 https://deb.nodesource.com/node_13.x focal InRelease
Ign:11 http://repo.vivaldi.com/stable/deb stable InRelease
Hit:12 https://dl.yarnpkg.com/debian stable InRelease
Hit:13 http://ppa.launchpad.net/kritalime/ppa/ubuntu disco InRelease
Get:14 http://archive.ubuntu.com/ubuntu focal-security InRelease (107 kB)
Hit:15 http://repo.vivaldi.com/stable/deb stable Release
Hit:17 http://ppa.launchpad.net/linrunner/tlp/ubuntu focal InRelease
Hit:18 http://download.virtualbox.org/virtualbox/debian eoan InRelease
Hit:16 https://cli-assets.heroku.com/branches/stable/apt ./ InRelease
Hit:19 https://cli-assets.heroku.com/apt ./ InRelease
Hit:20 http://ppa.launchpad.net/linrunner/tlp/ubuntu disco InRelease
Hit:21 http://ppa.launchpad.net/swi-prolog/stable/ubuntu disco InRelease
Ign:19 https://cli-assets.heroku.com/apt ./ InRelease
Hit:23 https://download.sublimetext.com apt/stable/ InRelease
Hit:22 https://cli-assets.heroku.com/apt ./ Release
Get:24 https://vagrant-deb.linestarve.com any InRelease (3 938 B)
Err:26 http://packages.microsoft.com/repos/vscode stable InRelease
500 Internal Server Error (IP: 13.80.99.124 80)
Get:25 https://packagecloud.io/AtomEditor/atom/any any InRelease (23,2 kB)
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages (234 kB)
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/main i386 Packages (121 kB)
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata (149 kB)
Get:30 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages (124 kB)
Get:31 http://archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages (66,3 kB)
Get:32 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata (167 kB)
Get:33 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata (532 B)
Get:34 http://archive.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata (21,2 kB)
Get:35 http://archive.ubuntu.com/ubuntu 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 http://packages.microsoft.com/repos/vscode/dists/stable/InRelease 500 Internal Server Error (IP: 13.80.99.124 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 http://packages.microsoft.com/repos/vscode stable InRelease

500 Internal Server Error (IP: 13.80.99.124 80)

and

W: Failed to fetch http://packages.microsoft.com/repos/vscode/dists/stable/InRelease 500 Internal Server Error (IP: 13.80.99.124 80)

W: Some index files failed to download. They have been ignored, or old ones used instead.

Should i just wait or do something?

## np complete – Help funding reduction for the next problem

I think this NPC and I think the way to show this is by reduction from SubsetSum, but I can’t think of a way of showing this. Hints?

$ApSum=$${(S,{a_1,a_2,…,a_t})|exists Usubseteq{1,2,…,t}>such>that>S-10>leq>sum_{iin U} a_i>leq S+10}$

## 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 =
Reverse(Transpose(
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}),
Table({i,
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})})
```

The following code is from the help information of `Nest`

function:

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