0
$\begingroup$

I have an logarithmic equation $$\left[ r=a\,e^{b\,\theta} \right] $$

And I plot it to visualise it (see plot below). I can tell by the plot when (t=0), x1=0, y=1 (point AA) but how can I find out numerically what (y2) point BB will be when x2=.5 (the red dot on the plot (point BB)) by using an equation.

image

Eq Solve for a $$\left[ a={{r}\over{e^{b\,\theta}}} \right] $$

Eq to Solve for b $$\left[ b={{\log \left({{r}\over{a}}\right)}\over{\log e\,\theta }} \right] $$

Eq to Solve for theta $$\left[ \theta={{\log \left({{r}\over{a}}\right)}\over{b\,\log e }} \right] $$

I tried solving the equations using maxima but it came back with a large list of logs instead of a one numerical value.

kill(all);
r:.5; a:1; b:-5.7; theta:theta; solve(a*e^(b*theta)=r,theta);
tex(''%);

I'm still at a loss as to how to find (y2) at point BB when (x2=.5) (y2=?)

Ps: I'll be using octave 3.8.1 to calculate these values which is like matlab but I'm just trying to get the equations worked out correctly.

$\endgroup$
  • $\begingroup$ How do $y_2$ and $x_2$ relate to the variables in your first equation? I suggest rewriting this in terms of one set of variables (or at least explaining what they're for). $\endgroup$ – horchler Aug 17 '15 at 14:00
  • $\begingroup$ @RickT You need another (known) data point or something similar to evaluate the coordinates of BB. $\endgroup$ – callculus Aug 17 '15 at 14:19
  • $\begingroup$ @horchler y2 and x2 are just the x and y values for point BB x2 and t are the same thing. I'll fix the plot and update $\endgroup$ – Rick T Aug 17 '15 at 14:25
  • 1
    $\begingroup$ It looks like $x$ is just $\theta$ and $r$ is $y$. Your question would be a lot clearer if you picked one set or the other. $\endgroup$ – horchler Aug 17 '15 at 14:28
  • 1
    $\begingroup$ @RickT Now I understand your problem. You just had to insert the values in your equation $ \theta=\frac{\frac{log(0.5)}{1}}{-5.7\cdot log (e)}=\frac{log(0.5)}{-5.7\cdot 1}\approx 0.121605$ $\endgroup$ – callculus Aug 17 '15 at 15:41
1
$\begingroup$

Say you're trying to solve for $\theta$ (i.e., $x_2$) in $ r = a e^{b \theta}$ and are unable to find an analytical solution. You can use numerical root-finding. In Matlab and Octave fzero (documentation) solves for roots/zeros of simple univariate functions. The first step is to re-write your equation as $ 0 = a e^{b \theta}-r$. Then, with th0 as an initial guess, you can solve for a root via:

a = 1;
b = -5.7;
r = 0.5;
th0 = 1;
f = @(th)a*exp(b*th)-r;
[th_sol,fval,exitflag] = fzero(f,th0)

This returns 0.121604768519289 for th_sol. In this case, this is equivalent to the analytical solution $\theta = \text{log}(r/a)/b$.

Of course if you're solving for $y_2$ (i.e., $r$), you don't need to do anything special. Just evaluate:

a = 1;
b = -5.7;
th = 0.5;
r = a*exp(b*th)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.