0

How do you approach this conundrum? My background is not in Mathematics but I am willing to learn.

QUESTION:

Given this equation:

$$ y = c * sin\theta - r * \theta*sin\theta - r * cos\theta;\ where \begin{cases} y = variable\\ c = fixed\ length \\ r = radius \\ \theta = angle\ in\ radians \end{cases} $$

How do you find $\theta_1$ given $y_1$?

BACKGROUND:

I am ultimately trying to solve this diagram: Get $x$ when given $y$

enter image description here

Where the following constraints must be satisfied:

  1. The length of red lines ($ARC LENGTH + DIAGONAL$) must equal the $FIXED \ LENGTH$.
  2. As the $HEIGHT$ increases, the $BASE$ decreases.
  3. The maximum ${HEIGHT}$ is given by the equation: $$ HEIGHT_{max} = (FIXED\ LENGTH - r*\fracπ2) + r $$ at which point $${BASE}_{min} = r $$
  4. The minimum ${HEIGHT}$ is given by the equation: $$ HEIGHT_{min} = 0 $$ at which point $${BASE}_{max} = FIXED\ LENGTH$$

  5. The red lines must always start at $x=0$, rotate over a circle of radius $r$, and end at $y=0$ (it must always be attached to the $x-$ and $y-axis$).

  6. As such, $r$ and $FIXED\ LENGTH$ are constants
  7. $\theta$ is dependent on $y$ .

WHAT HAS BEEN DONE:

When $\theta$ is given, it is relatively easy to find $y$. For example for the cases:

$$ \begin{cases} y = variable\\ c = 100 \\ r = 10 \\ \theta = 0\ to\ \fracπ2 \end{cases} $$

enter image description here

This is a plot of all the possible values for $\theta$ and $y$.

enter image description here

WHAT I AM LOOKING FOR (FOLLOW-UP):

I know that the function is an oscillating function, and that for each value of $y$, there are numerous values for $x$. However, I am only looking for the specific range where $\theta = 0\ to\ \frac\pi2$ and $y = -r\ to\ c-r\frac\pi2$.

If finding $\theta_1$ given $y_1$ is not possible, these are my follow-up questions:

  1. How can the problem be viewed differently?
  2. How should the problem be approached?
  3. What concepts are needed to solve these types of problems?
    • any technical terms for what these types of problem are?
    • what branches of mathematics are useful for understanding these types of problems?

DISCLAIMER:

  1. This problem is for a "fun" side project and I am stuck on the mathematics side since I absolutely have no background about the advanced branches of mathematics needed for this.
  2. If you can suggest tags or better ways to phrase this question. Please do not hesitate to point it out. Thanks.
  • Are constants $r$ and $c$ given? If not, what is their range? – Intelligenti pauca Jan 30 '18 at 17:05
  • $r$ and $c$ are known when the system is created. They are constants in the sense that as $y$ varies, they remain the same, but they can be any positive number. The range for $c$ is: $c > 0$ while for $r$ is: $0<r\leq c \frac{2}{\pi}$. – windsinger Jan 31 '18 at 01:44
  • 1
    As to your question itself, Sagemath says that you need to solve $$f(\theta) = \frac{c}{r} - \frac{\cos\theta}{\sin\theta} - \frac{y}{r \sin\theta} - \theta = 0$$which seems to behave nicely (having only one root in the initially monotonically increasing region, and should therefore be easy to solve numerically using a binary search with the help of its derivative $$\frac{d f(\theta)}{d \theta} = \frac{\cos^2\theta}{\sin^2\theta} + \frac{y\cos\theta}{r \sin^2\theta}$$I suspect no algebraic solution exists. Is this an approach you can consider? – Nominal Animal Jan 31 '18 at 03:31
  • @NominalAnimal yes that is an approach that I can consider. By binary search, do you mean to say that I pre-generate a table of values for every $\theta$, then looking for the $y$, much like how calculators compute the $sin$, and $cos$ using lookup tables. By any chance using that question, if no algebraic solution exist for my case, can it be approximated using a Taylor series instead? – windsinger Feb 01 '18 at 02:54

2 Answers2

2

As I mentioned in a comment, you need to solve $$f(\theta) = \frac{c}{r} - \frac{\cos\theta}{\sin\theta} - \frac{y}{r \sin\theta} - \theta = 0 \tag{1}\label{NA1}$$

If you have a specific value of $y$ (and $c$ and $r$) you want to solve $\theta$ for, one way to do it is numerically, using a binary search; also known as the bisection method. The derivative of $f(\theta)$ is $$\frac{d f(\theta)}{d \theta} = \frac{\cos^2\theta}{\sin^2\theta} + \frac{y\cos\theta}{r \sin^2\theta}$$ i.e. $$\frac{d f(\theta)}{d \theta} = \frac{\left ( y + r \cos\theta \right ) \cos\theta }{r \sin^2 \theta} \tag{2}\label{NA2}$$ which is positive for $0 \lt \theta \lt \pi/2$ if $y \ge 0$ and $r \gt 0$. This means that in this interval, the function $f(\theta)$ is monotonically increasing, and that the bisection method will work well without any issues. In particular, $f(\theta)$ has at most one root.

Thorough sheer experimentation, I found that the function $$y(\theta) = (c - r\theta)\sin\theta - r\cos\theta$$could be approximated with$$g(\theta) = C_3 \sin\left(C_2 \theta^2 + C_1 \theta\right) - r$$ where $C_1$ is a shape parameter, slightly over 1, $C_2 = 2(1-C_1)/\pi$, and $C_3 = c + r(1 - \pi/2)$. Solving $y = g(\theta)$ for $\theta$ yields $$\theta = \frac{-C_1 \pm \sqrt{C_1^2 + 4 C_2 \sin^{-1}\left( \frac{r + y}{C3}\right)}}{2 C_2}$$where you should choose the $+$ sign in this case; or more generally, the sign that yields $0 \lt \theta \lt \pi/2$.

I am not sure if this approximation is acceptable, but it is quite straightforward, as $C_1$ (and therefore also $C_2$ and $C_3$) only depends on the ratio $c/r$. For starters, test and examine the properties of $$\begin{array}{cc|ccc} c / r & C_1 \\ \hline 1.5 & 1.64 \\ 2.0 & 1.38 \\ 5.0 & 1.12 \\ 10.0 & 1.05 \\ 20.0 & 1.03 \end{array}$$ The approximation does not work well for $c/r \lt 1.5$, though, because the function $y(\theta)$ diverges from the shape of a sine-like function, with a "hump" before $\pi/2$.

1

The function $$ y(\theta ) = c\sin \theta - r\,\theta \sin \theta - r\cos \theta $$ does not admit a closed formula for its functional inverse, even over the limited range $0 \le \theta \le pi/2$, with $r\pi/2 \le c$,
where it is bijective. The expression of $\theta(y)$ can only be given as an approximation.

Theoretically it is possible to define a Taylor series for the inverse, but it quickly rockets up in complication so that practically only the computation of the very first terms is feasible. And also, it is not assured that the (truncated) Taylor series give the best fit. That means that most of the times, and this is one of them, other approaches shall be looked for.
A situation quite common in applied mathematics, where frequently the approach to follow to attain a satisfactory approximation is indicated by the particularities of the underlying physical process, but however depends very much on the function characteristics, on the margin of error allowed, and upon other considerations or requirements.
So experience and intuition is required to apply different techniques offered by various mathematical disciplines, such as geometry, calculus, numerical methods.

Coming to your specific problem, I would suggest the following.

First, to "homogenize" the expression as
$$ \eqalign{ & \eta (\theta ) = {{y(\theta ) + r} \over {c - \left( {\pi /2 - 1} \right)r}} = {{c\sin \theta - r\,\left( {\theta \sin \theta + \cos \theta - 1} \right)} \over {c - \left( {\pi /2 - 1} \right)r}} = \cr & = {{c/r\sin \theta - \,\left( {\theta \sin \theta + \cos \theta - 1} \right)} \over {c/r - \left( {\pi /2 - 1} \right)}}\quad \left| \matrix{ \;\pi /2 \le c/r \hfill \cr \;0 \le \theta \le \pi /2 \hfill \cr \;0 \le \eta \le 1 \hfill \cr} \right. \cr} $$

At this stage we can calculate some values of the function and compute an interpolation of $\theta$ wrt $\eta$, for some values of $c/r$, or even a 2D interpolation of $\theta(\eta,c/r)$.
But if a polynomial interpolation is used, the result in terms of accuracy might be unsatisfactory, bacause $\sin$ and $arcsin$ "deviate" much from a polynomial.

Then, if we plot $\eta -\sin{\theta}$ wrt $\theta$ and $c/r$, we see that the difference is a smooth function, null for $\theta=0$ and $\theta=\pi/2$, and that for large $c/r$ it decays to zero, in a manner almost indipendent from $\theta$.

This suggests that an interpolation with a function of the type $$ \theta = \arcsin \left( {a\,\eta + b\,\eta ^{\,2} \left( {1 - \eta } \right)} \right) $$ will work better.
And other formulations can be tried.

Finally, if given $r,c, \eta$, you need to calculate $\theta$ with high precision, then you can employ one of the methods for finding the roots of the function $\eta(\theta)-\eta^*$, where $\eta^*$ denotes the value of $\eta$ for which we want to calculate $\theta$.
Since $\eta(\theta)$ is concave, even the simple "secant" method can be applied.

G Cab
  • 35,272