Ndsolve of random (periodic) initial conditions via BSplineFunction

Suppose we want to solve the heat equation for a random initial temperature field T(t,x,y). Therefore I define the initial conditions with the BSplineFunction which nicely incorporates periodic boundary conditions and try to solve it with NDSolve:

Clear["Global`*"] Lx = 1; Ly = 1; eq = D[T[t, x, y], t] == Laplacian[T[t, x, y], {x, y}]; pbc1 = T[t, x, 0] == T[t, x, Ly]; pbc2 = T[t, 0, y] == T[t, Lx, y]; T0[x_, y_] =   BSplineFunction[RandomReal[1, {30, 30, 1}], SplineClosed -> True][x,    y] Plot3D[T0[x, y], {x, 0, Lx}, {y, 0, Ly}, PlotRange -> All,   AxesLabel -> {"x", "y", "T"}, ColorFunction -> "DarkRainbow",   Mesh -> All, MeshStyle -> Opacity[.2]] T0[0, 0] ic = T[0, x, y] == T0[x, y] ic2 = T[0, x, y] == 0.5*Exp[-4 ((x - Lx/2)^2 + (y - Ly/2)^2)]; Monitor[AbsoluteTiming[   sol = NDSolve[{eq, pbc1, pbc2, ic},      T, {t, 0, 1}, {x, 0, Lx}, {y, 0, Ly},      Method -> {"MethodOfLines",        "SpatialDiscretization" -> {"TensorProductGrid",          "MaxPoints" -> 25}},      EvaluationMonitor :> (currentTime =         Row[{"t = ", CForm[t]}])]], currentTime] 

The code unfortunately throws an error "Data … is not a rectangular tensor with dimensions …". I assume this results from the fact that T0 evaluated e.g. at grid point [0,0] returns a list {} and NDSolve probably needs just the float value.

I tried T0[0,0][[1]] which yields the expected value. But this does not work for the definition of the initial condition: ic = T[0, x, y] == T0[x, y][[1]], where x,y are not set yet. This returns just x, in reality it should first put in the values of x,y and only after that take list element 1 (if I am not mistaken).

Apart from that the code works fine which can be verified if you simply use ic2 instead of ic as initial condition in NDSolve.

Can someone help to get this running?

What is the best way to detect constant or periodic amplitude of the spectrogram?

Suppose I get interpolating function in the solution of the complicated differential system. I plot a solution for various input values that control the outcome of the solution. Some give exponential results and some give sinusoidal results with constant amplitude (periodic) and sinusoidal with increasing amplitude. I am trying to find the solution with constant periodic amplitude. I do that with spectrogram. How do I detect that in spectrogram? In the code, you can see that spectrogram shows constant peaks. I used peak detect for solution of the ode, extrapolated a linear function and calculated the slope of those peaks. But that is time consuming and not a very thorough method. I am looking for another method using spectrogram or other. t1 and t3 shows true and t2 shows false for amplitude detection.

ClearAll; xrange=40; ode={y''[x]+a*y'[x]+b*y[x]==0,y'[0]==1,y[0]==0}; solution1=NDSolve[ode/.{a->0.0,b->2},y[x],{x,0,xrange}]  Plot[Evaluate[y[x]/.solution1],{x,0,xrange},PlotRange->All]  solution2=NDSolve[ode/.{a->0.2,b->2},y[x],{x,0,xrange}]  Plot[Evaluate[y[x]/.solution2],{x,0,xrange},PlotRange->All]   Plot[Evaluate[Sin[0.5*x]*Cos[6*x]],{x,0,xrange},PlotRange->All]  t1=Table[Evaluate[y[x]/.solution1][[1]],{x,0,xrange,1/20}]; Spectrogram[t1]  t2=Table[Evaluate[y[x]/.solution2][[1]],{x,0,xrange,1/20}]; Spectrogram[t2]  t3=Table[Evaluate[Sin[0.5*x]*Cos[6*x]],{x,0,xrange,1/20}]; Spectrogram[t3] 

Is it less secure to force periodic user logouts vs keep them logged in?

I’ve been unable to find any research or information on this.

Google periodically signs me out and forces me to sign back in. I have multiple devices and multiple google accounts so it’s a bit frustrating but that’s just how it is. However I was thinking about whether this practice is actually secure.

  1. It seems to encourage easy-to-remember / easy-to-type passwords over longer stronger passwords
  2. There’s more chance for a keylogger to intercept a password
  3. There’s more chance for a physical observer to watch you enter a password
  4. It may desensitise users and lead to them automatically entering their password without checking a url

How does this balance this against the inherent insecurity of indefinitely extending a login’s lifetime?

It’s worth noting that Google doesn’t ever log me out of my mobile device – I wonder why it treats this environment differently? Security vs UX concerns?

BLE periodic message

I’me new to BLE protocol. I understood pairing is based on scanning and advertising, based on connection interval. My question is related to what happens after a connection has been established.
Are there any periodic message exchange to keep the connection alive? Or the only communication is based on read/write or notification/indications requests?

Thanks, Andrea

Weak convergence for generic periodic points that obtains from specification

Let $ X$ be a compact metric space and let $ f:X\rightarrow X$ be a Anosov and transitive map.

Let $ x$ be a generic point so that $ $ \mu_{n_{i}}:=\frac{1}{n_{i}}\sum_{j=0}^{n_{i}-1} \delta_{T^{j}(x)} \rightarrow \mu $ $ for some invariant measure $ \mu$ .

It is well known that $ T$ satisfies the specification property. Let $ p\in X$ be a periodic point associated to $ \delta, S$ and $ \{ x, f(x), . . . , f^{n_{i}}(x)\}$ by the specification property. In particular, $ f^{n_{i}+S}(p) = p$ and orbit of $ p$ cover orbit of $ f^{n_{i}}(x)$ .

My first question is as follows:

$ \mu_{n_{i},p}:=\frac{1}{n_{i}+S}\sum_{j=0}^{n_{i}+S-1} \delta_{T^{i}(p)} \rightarrow \mu $ ?

If yes. For $ \mu\in\mathcal M(X)$ we write $ \text{supp} \mu$ for the support of $ \mu$ . It is easy to see that if a sequence of measures $ (\mu_n)_{n=1}^\infty$ weak$ ^*$ converges to some $ \mu\in\mathcal M(X)$ , then $ $ \text{supp}\, \mu\subset \liminf_{n\to\infty}(\text{supp}\,\mu_n). $ $ (By $ \liminf$ above I mean the Kuratowski limit inferior, for a definition see wikipedia entry.)

According to above, Can we say $ supp \mu$ is periodic point? Because $ \mu_{n_{i},p}$ has periodic support.

Does the Hopf vector field have a periodic orbit?(a la Siefert conjecture)

The standard frame for $ S^3$ consists of $ X_i,X_j,X_k$ with $ X_i(a)=ia, X_j(a)=ja, X_k(a)=ka$ where $ i,j,k$ are standard quaternion numbers, $ a\in S^3$ , and the multiplication is the quaternion multiplication. This global frame on $ S^3$ gives us a trivialization of $ TS^3\simeq S^3\times \mathbb{R}^3$ . So the Hopf map $ P:S^3\to S^2\subset \mathbb{R}^3$ is counted as a unit vector field on $ S^3$ . This vector field is called “Hopf vector field”.

Does the Hopf vector field have a periodic orbit? Is this vector field discussed in various attempts to find an analytic counter example to Siefert conjecture?

Does the Hopf vector field have a periodic orbit?(a la Siefert conjecture)

The standard frame for $ S^3$ consists of $ X_i,X_j,X_k$ with $ X_i(a)=ia, X_j(a)=ja, X_k(a)=ka$ where $ i,j,k$ are standard quaternion numbers, $ a\in S^3$ , and the multiplication is the quaternion multiplication. This global frame on $ S^3$ gives us a trivialization of $ TS^3\simeq S^3\times \mathbb{R}^3$ . So the Hopf map $ P:S^3\to S^2\subset \mathbb{R}^3$ is counted as a unit vector field on $ S^3$ . This vector field is called “Hopf vector field”.

Does the Hopf vector field have a periodic orbit? Is this vector field discussed in various attempts to find an analytic counter example to Siefert conjecture?

Does $\int_0^{2\pi} e^{i\theta(t)} (\phi(t))^n dt=0$ $\forall \; n\in\mathbb{N}_0$ imply $\phi$ periodic?

PROBLEM. Let $ \theta(t)$ and $ \phi(t)$ be two real analytic non-constant functions $ [0,2\pi]\rightarrow \mathbb{R}$ . I am trying to prove the following claim

If the integral $ $ \int_0^{2\pi} e^{i\theta(t)} (\phi(t))^n dt=0 $ $ for all $ n\in\mathbb{N}_0$ than the first derivative $ \theta’$ and $ \phi$ are periodic of common period $ 2\pi/l$ with $ 1\neq l\in\mathbb{N}$ .

Note that this is equivalent to $ F(\lambda):=\int_0^{2\pi} e^{i(\theta(t)+\lambda\phi(t))} dt=0$ for all $ \lambda \in \mathbb{R}$ . In fact, $ F(\lambda)$ is analytic in $ \lambda$ and its being constantly equal to 0 is equivalent to the vanishing of all its derivatives $ F^{(n)}(0)=\int_0^{2\pi} e^{i\theta(t)} (\phi(t))^n dt$ . Geometrically this means that the curve obtained by integrating the (tangent) vector function $ (\cos(\theta+\lambda\phi),\sin(\theta+\lambda\phi))$ over $ [0,2\pi]$ is closed $ \forall \lambda$ .

Just in case, a back-up less general claim for which I would like to see a clean solution is

If, in the hypotesis above, $ \phi$ is a polynomial, then $ \phi$ is constantly $ 0$ .


OBSERVATION. If $ \theta’$ and $ \phi$ are periodic of common period $ \frac{2\pi}{l}$ with $ 1\neq l \in \mathbb{N}$ and $ \int_0^{\frac{2\pi}{l}} e^{i\theta}\neq 0$ then the converse implication is true. In fact, in this setting $ \theta=c\cdot t+\theta_p(t)$ with $ c=\frac{2\pi}{l}(\theta(\frac{2\pi}{l})-\theta(0))$ and $ \theta_p$ periodic of period $ \frac{2\pi}{l}$ . Then $ $ \begin{align} \int_0^{2\pi} e^{i(\theta(t)+\lambda\phi(t))} dt &=& \sum_{j=0}^{l-1} \int_{j \frac{2\pi}{l}}^{(j+1) \frac{2\pi}{l}} e^{i(c\cdot t+\theta_p(t)+\lambda\phi(t))} dt \ &=& \sum_{j=0}^{l-1} e^{i\cdot j \cdot \frac{2\pi}{l}} \int_{0}^{\frac{2\pi}{l}} e^{i(c\cdot t+\theta_p(t)+\lambda\phi(t))} dt, \end{align} $ $ where the last equality is obtained by repetedly applying the substitution $ t’=t-\frac{2\pi}{l}$ . Since we know $ \sum_{j=0}^{l-1} e^{i\cdot j \cdot \frac{2\pi}{l}} \int_{0}^{\frac{2\pi}{l}} e^{i\theta(t)}dt=\int_0^{2\pi} e^{i\theta(t)} dt=0$ then also the integral above must be $ 0$ . In the following picture the curve associated to $ \theta(t)=t + \cos( 12 t)$ deformated in the direction $ \cos(3 t)$ . In this case $ l=3$ and the curve is closed $ \forall \lambda$ .

Curve associated to <span class=$ \theta(t)=t + \cos( 12 t)$ deformated in the direction $ \cos( 3 t)$ . In this case $ l=3$ and the curve is closed $ \forall \lambda$ .”>

IDEA. If $ \theta$ monotone one can substitute $ s=\theta(t)$ in the integral and get $ $ \int_{\theta(0)}^{\theta(2\pi)} e^{i s} \frac{(\phi(\theta^{-1}(s)))^n}{\theta'(\theta^{-1}(s))} ds=0. $ $ In this case the idea behind the hypotesis becomes apperent: $ \phi(\theta^{-1}(s))$ is periodic of non-trivial period iff $ \phi$ and $ \theta’$ have the common period property. It seems here that looking at the Fourier expansion of our functions on $ [\theta(0),\theta(2\pi)]$ could be a good idea: the condition we have means indeed that, $ \forall n$ , the first harmonic of the function $ \frac{(\phi(\theta^{-1}(s)))^n}{\theta'(\theta^{-1}(s))}$ is $ 0$ . Fourier coefficients of a product are obtained by convolutions and therefore the condition above becomes, $ \forall n$ : $ $ \sum_{k_n=-\infty}^{+\infty} \sum_{k_{n-1}} … \sum_{k_{2}}\sum_{k_{1}} \widehat{\frac{1}{\theta’}}(1-\sum_{i=1}^{n} k_i) \prod_{i=1}^{n} \widehat{\phi}(k_i)=0. $ $ Is this approach viable? Can one from here exploit the fact that a function is periodic of non-trivial period iff there exists $ k$ such that only harmonics multiple of $ k$ are different from 0? Other way round, do non-zero harmonics of coprime orders imply a contradiction with our constraints? As for a toy example, if $ \theta(t)=t$ ,$ \theta'(s)=1$ and $ \phi(s)=\cos(2s)+\cos(3s)$ already $ \widehat{f^2}(1)= 2 \widehat{f}(3)\widehat{f}(-2) \neq 0$ ; in the general setting interaction of coefficients is not straightforward.

NOTE: This question originated from Orthogonality relation in $ L^2$ implying periodicity. As suggested in the comments to the previous post, since the target of the question changed over time and edits were major, here I hope I gave a clearer and more consistent presentation of my problem.

Thank you for your time.

Schedule periodic task in Java, with separate delays for success and failure

I want a Java program that runs a certain job every 5 minutes.

  • If the job runs longer than 5 minutes, a new iteration should not start until immediately after the current one ends. Otherwise, it should start 5 minutes after the last one started.
  • If the job fails for any reason, it should try again 1 minute after the failure occurred (even if it ran for over 5 minutes).
  • It should be robust in case the system clock is turned back and not wait too long in that case.

How can this be cleanly accomplished (using e.g ScheduledThreadPoolExecutor or TimerTask)?