# I Minimizing a non-linear ODE in f, f_t

I'm working on a physics "potential" problem and trying to create an alternate function to describe the potential energy. I'm having trouble figuring out how to solve a nonlinear ODE, or even a limiting boundary for minimizing a drop off shape function.

I was able to reduce my problem to the following first order nonlinear ODE relationship between two real and positive valued functions. The functions $f(\theta,\gamma) , s(\theta,\gamma)$ are purely of a single variable $\theta$ and a single constant $\gamma$ .

$(f(\theta))^2 + ({ d \over {d \theta}} f( \theta ))^2 = (s(\theta))^2$
Where $s:\mathbb{R} \mapsto \mathbb{R}$ is usually a known shape function with physical significance.

I do not know how to solve for an 'f' given an 's'. But, with the help of numerical analysis and graphing, I was able to figure out that if I can solve for a restricted f:$\theta \in [{\pi \over 2}, \pi ]$ that I can extend the solution to all other values of theta.

Boundary conditions for the restricted region:

I've been trying to put bounds on 'f' to narrow down the possible shapes of 'f' as it traverses from a known starting value of $f({\pi \over 2})=\gamma$ to an ending value of $f(\pi)=\gamma^{-2}$. Where gamma is a constant: $\gamma \ge 1$. (eg: Related to Lorentz contraction.)
's' is not equal to 'f' in general, but 's' does start and end with the same value as 'f'.

I know from graphing solved test cases that 'f' and 's' must both be monotonically decreasing with a few point exceptions where the slope goes to zero.
The three 'f' exceptions are at $\theta$ of ${\pi \over 2} , { {3 \pi} \over 4}, {\pi}$
The two 's' exceptions are at $\theta$ of ${\pi \over 2}, \pi$
Both f and s are smooth; I think that both f, s and the first and second derivatives of each are always continuous.

There are two kinds of problems I am trying to solve.
The first kind of problem is about techniques to solve for 'f' in terms of a given 's'

The second kind of problem is about extreme decay rate of the 's' functions that can be produced. The extrematization problem can ignore all zero slope inflection points except the one at $\theta={\pi \over 2}$. I am just trying to find a boundary function 'f' that can produce an arbitrary 's' with a maximum rate of descent.
eg: The functions go from zero slope at $s({\pi \over 2})=f({\pi \over 2})=\gamma$ to whatever negative slope of 'f' produces the maximum shrinking of 's')

If 'f' descends too rapidly, the derivative squared becomes increasingly positive and makes the magnitude of s's slope smaller. eg: It's a form of negative feedback. There's a sweet spot where the curvature & slope of 'f' makes 's' decrease the quickest. I'm unsure how to formulate the problem, exactly; but intuitively it might also be discovered by something like an 'f' wich produces an 's' with minimum 's' integral over region $\theta=( \pi/2 : pi )$

I was able to figure out that there are two crude function family boundaries which if 'f' is either greater in magnitude or more negative in slope, 's' will grow instead of shrink.

A crude border for maximum f magnitude is $f = \gamma$
A crude border for maximum f slope is $f = \gamma cos( \theta )$

Plugging either border into $y=(s(\theta))^2=f^2 + f_\theta^2$ gives a constant.
If the slope of 'f' is made more negative than the cosine boundary, y will be larger than it's initial value which is unacceptable. I think this means that $-\sqrt {\gamma^2-f^2} \le f_\theta \le 0$
However, I wasn't able to figure out what function 'f' produces the most steeply decaying s(). I'm unsure how to go about setting up the problem.

Any help would be appreciated.

Last edited:
Related Differential Equations News on Phys.org

#### eys_physics

I guess that your intention is to solve this problem numerically, since I doubt an analytical solution exist for general $s(\theta)$. As a start you could rewrite your equation as
$$\left(\frac{df}{d\theta}\right)^2=(s(\theta))^2-f(\theta)^2$$, and
if $|s|>|f|$ you can take the square root of each side which leads to either
$$\frac{df}{d\theta}=\sqrt{s(\theta))^2-f(\theta)^2}$$ or
$$\frac{df}{d\theta}=-\sqrt{s(\theta))^2-f(\theta)^2}.$$ I guess that from the actual physical application one can decide which of the equations is relevant.
The equations can be solved with, e.g., the Runge-Kutta method for given initial conditions.

I agree that often an analytical solution will not exist. My hope is to eventually produce analytical expressions that are decent approximations to the solution near the zero slope inflection points. So, functions that in some sense "minimize" error are desired for local solutions.

Numerical methods to produce graphs that I can curve fit are acceptable.
However, I don't believe there is a solution produced by numerical methods that will be accurate everywhere without some kind of guiding analytical approximation ....

eg: Trying to use the derivative alone to cause numerical convergence for numerical methods causes instability.
In this ODE, there are places where the slope is zero -- but the curvature is non-zero; the curvature determines how quickly the derivative appears in adjacent locations. Different choices of curvature causes different numerical convergence.

By experimentation, for example, I know that the maximum drop off rate for 's' is likely an exponential kind of function. It will be monotonically decreasing away from an initial 's' value; but eventually it will asymptotically approach some constant value (likely zero). However, attempts to use a simple curve fitter to produce a function with least error does not converge to a monotonically decreasing function.

For example, I can use 'gnuplot'; and define the following two functions and numerical derivative.

f(t)=a + b*t**2 + c*t**3 + d*t**4 + e*t**5 + f*t**6
df(t)=0.5*(f(t+del)-f(t-del))/del
del=1e-5
a=1 ; b=c=d=e=f=-1e-9

gnuplot uses a Marquardt-Levenberg algorithm, which is similar in performance to runge-kutta.
I'm not sure of the exact differences.

But I should be able to tell gnuplot to minimize the error between 's' (computed from f) and a constant of say -100. Therefore better curve fits of 'f' should make 's' with minimum height everywhere given the starting height of 'a' with zero initial derivative; eg: I removed the first power of t from the polynomial to insure that the initial slope stays zero; but otherwise, this is a generic function with fixed starting height. However, gnuplot has trouble converging generic polynomials to solutions that are anywhere close to what is expected (not only restricted to this problem; Gnuplot often fails badly when the equation is a Taylor expansion). initial values of variables affect results.

FIT_LIMIT=1e-12
fit (( f(t)**2 + df(t)**2 )**0.5 ) '++' using 1:(-100) via b,c,d,e,f

The results are not a monotonic curve which approaches zero height asymptotically / exponentially; and I don't know how much of the solution's shape is the solvers limitation and how much is my choice of arbitrary polynomial. eg: what would be a better function to curve fit ... that wouldn't diverge above theta=2.8 ?

#### Attachments

• 6.7 KB Views: 302
• 6.7 KB Views: 295
Last edited:

By doing a little experimentation and plotting, I'm able gain more insight into the maximum descent boundary for a monotonically decreasing f() and s(). The maximum slope that f() can have without increasing s() is known to be proportional to the -sin() function centered on a starting theta and then scaled by an initial value (gamma).

So, what I did was allow f() to decrease at the maximum rate for up to 30 or 60 degrees, and then reset the slope to zero and recursively repeated the maximal descent. See the two plots below for 30 and 60 degrees, with a starting gamma of 1.5.

After each reset, the s() function is re-restricted to be monotonically decrease or constant, by not exceeding it's value at the reset. Note: s()=f() when the slope of 'f' is zero AKA at resets. This identity makes discontinuous stair-steps out of s(), but shows an extreme case of decreasing function f(). I hope this helps people understand what the relationship between s and f is like.

What these graphs show is that the average descent rate of s() is affected by how long f() continues at the maximum descent rate. The longer s() doesn't decrease, the larger the total decrease of s() will be. eg: The longer time between f() slope resets, the larger the overall drops in s(). Both f() and s() clearly follow an exponential curve at reset points.

Therefore, there is a conflict between minimizing the area under s() and the slope of f(). Larger negative slopes in f() eventually make the rightmost portion of the f and s graphs lower. But, although a larger slope of f() makes less s()/blue on the right side of the graph, the same increased slope also increases the area of s() on the left side of the graph. So, increasing slope doesn't always cause removal of net area under the s() curve.

When it comes to finding an f() which renders the area under s() minimum, regions spanning pi/2 are all that are physically possible. The graphs, then, can likely be truncated at t=theta=pi... but, I drew them beyond that point to show the consistency of the curve.

#### Attachments

• 6.8 KB Views: 285
• 7.4 KB Views: 306
Last edited:

#### BvU

Homework Helper
Do you realize your lengthy accounts are floating in the air if you don't specify what s is ? A shape function? Something like a Gaussian or a Lorentzian ?

Yes, I know that it's hanging in "air".

There's a reason I have been leaving the relationship abstract. This particular relationship $s(\theta)^2 = f(\theta)^2 + (f_\theta(\theta))^2$ between two functions shows up in mathematically different contexts when trying to solve physics problems. The first time I saw it was when trying to solve the Schrodinger Equation some years ago. The Schrodinger equation is a diffusion equation, and not truly a "wave equation", in the sense of wave propagation. The second context I have seen this relationship arise is when attempting to work with Maxwell's equations. In both cases, the relationship arises when attempting to recast an existing equation by substitution of variables. The only thing the two problems truly have in common is that the magnitude of some value (typically squared) is a real number and represents the physical quantity called 'energy.' s() (depending on the problem) then, could be a modulation or amplitude envelope of 'momentum' or integral of 'force' or .... ?

So, I would prefer to give boundary conditions for s() as a real valued function rather than attempt to over-specify what it is. I'm hoping to get people, like you, to explore what exactly is a defect in my definition of s() when trying to solve various problems where two functions f() and s() arise.

Sometimes it's not necessary to actually solve a particular problem in order to get useful physical answers. Rather, just knowing what the extremes are can often give answers that are desirable to know. Shrodinger's equation, itself, is the result of extremetizing another equation that Schrodinger declined to actually solve....

I think it highly likely that there is no real f() that will solve the relationship between f() and s() everywhere and in every problem. But, there is going to be an f() which is qualitatively correct for small distances of 'theta' around a point where both f() and s() are known. eg: an error minimizing f() in some sense of the word.

Right now I'm concentrating on finding f's that can produce a smallest area of s(),
$\int_a^b s(\theta) d \theta$
, subject to the constraints that the initial value of s() is a constant gamma, and the initial slope of both f() and s() is zero. I can choose any real function f() to create an s() that meets the constraints. I'd prefer f() to be a continuous real function that is "nice" and doesn't do things like infinite oscillations ... but that's all.

I've come to the conclusion that in order to render s() a minimum, the final slope at 'b' will also naturally end up being zero. The conclusion comes from exploring graphs and piece-wise linear experiments on f(). eg: suppose f() has a slope at some point, would the slope increasing or decreasing cause a net increase in total area of s() and why. My discovery/conclusion is that there isn't a single function f() that minimizes the integral of s unless the location of the ending point (b) is known ahead of time. eg: f() depends on the value of b-a as well as the starting height of f(a)=s(a).

Now that I've said that, I'll answer your question in detail for the problem I'm working on; even though I hope you don't fixate on it.

s() is the relative amount of potential energy a non-moving charged particle would feel if a charged particle were moving uniformly relatively to it. s() is a normalized scale (probably a unitless quantity) with respect to angle of a Coulomb potential $\phi(x,y,z,t)$ or $\phi(r,\theta,t)$ plus an associated change in a magnetic field caused by the same potential which also gives rise to another potential. But the second potential modifies the first when solving Maxwells' equation for a changing magnetic field. In general, however, time t, cancels out of the discussion and we are discussing a snapshot of potential energy at a constant t.

The idea for s() comes from factoring a 3d potential problem into a product of two functions having a single variable each; Function s() encodes only angular information whereas the other function (not shown anywhere in my explanations) would encode distance information.

Details of how Maxwell's equation generates a potential from a changing magnetic field can be gleaned from another lengthy thread ... that I'm think you won't want to read. The original post is based on my mistake, but my understanding evolves to a correct understanding by the fourth or so post in the thread.

If you look at the graphs at the bottom of the #9 post in the linked thread ... you can see where s() comes from graphically; Theta is the angle made with respect to origin of the moving charge in the plotted plane underneath the 3d plot. The plotted force field contours are a gradient of a potential function $\phi_{ps}$. (ps stands for pseudo, and not differentiation). s() is the relative/normalized magnitude of the $\phi_{ps}()$ potential when radius is set to '1'. s() describes the relative distribution of potential energy as a function of viewing angle.

Last edited:

"Minimizing a non-linear ODE in f, f_t"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving