<div dir="ltr"><div><div>Hi Dave,<br><br></div>Cool, thanks for the advice. I'll try and code up what you suggest.<br><br>I'd originally used atan instead of asin, but when I invoked the derivative checker they were all wrong. I assume this is because of the instability you mention. They were good with asin, though, which is why I changed.<br>

<br></div>Thanks,<br><div><br>Ben<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 20 October 2013 02:51, Ben Stevenson <span dir="ltr"><<a href="mailto:bcs5@st-andrews.ac.uk" target="_blank">bcs5@st-andrews.ac.uk</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Dave,<div><br></div><div>You're right, there is nothing wrong with asin(). It performs exactly as one would expect, I was not suggesting otherwise. The problem still remains of calculating a bearing in the range (0, 2*pi) between two locations that are defined by df1b2variables. The way I describe above appears to work but just seems really messy. Good point about an animal moving exactly north, though, I hadn't thought of that. Presumably so long as I keep the start values away from a north bearing I should be OK; I'd imagine it'd be very bad luck for a bearing to be allocated as exactly north during the optimisation.</div>


<div><br></div><div>Cheers,</div><div><br></div><div>Ben</div><div><br></div></div>
</blockquote></div><br></div></div>