Skip to content

Conversation

RmStorm
Copy link
Contributor

@RmStorm RmStorm commented Oct 20, 2017

This way ans can be reused as in g*(1-ans**2) which should be a little quicker since it omits the cosh call. But mainly I get overflow warnings because of the use of cosh. This new quicker derivative solves that.

…s way ans can be reused as in g*(1-ans**2). But mainly I get overflow warnings because of the use of cosh. This new quicker derivative solves that.
@j-towns
Copy link
Collaborator

j-towns commented Oct 21, 2017

👍 I found this quite a lot quicker and hav included it in #312, but that probably won't be merged into master very soon so this pr is good in the mean time. You can do something similar for the derivative of tan and of sinh.

@j-towns
Copy link
Collaborator

j-towns commented Oct 21, 2017

It's tantalising for derivatives of sin and cos too because calculating sqrt(1 - x**2) is way quicker than calculating sin/cos (around 8x faster on my laptop), but you need to also calculate the correct sign, which slows things back down, at least in my implementation attempts.

@dougalm dougalm merged commit b3eb51d into HIPS:master Oct 21, 2017
@mattjj
Copy link
Contributor

mattjj commented Oct 21, 2017

This is great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants