> Normally I can differentiate analytically to get the slope and
> inflection points. While trying to have a quick look into these points
> with numerical differentiation I noticed that mpmath is giving me
> values quite distant from the ones obtained with analytical formulas.

I think there's a missing term in your analytical derivatives.  Your
three functions are

# fundamental mode
def phi(x):
   return mpmath.cos(k*x) - mpmath.cosh(k*x) + alpha* (
mpmath.sin(k*x) - mpmath.sinh(k*x) )

# slope of fundamental
def phi_dx(x):
   return -mpmath.sin(k*x) - mpmath.sinh(k*x) + alpha* (
mpmath.cos(k*x) - mpmath.cosh(k*x) )

# curvature of fundamental
def phi_dx2(x):
   return -mpmath.cos(k*x) - mpmath.cosh(k*x) - alpha* (
mpmath.sin(k*x) + mpmath.sinh(k*x) )

and it looks to me like you're missing a factor of k in phi_dx and k^2
in phi_dx2.  Inserting them seems to get rid of the discrepancy.


Doug

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to