Message Boards Message Boards

1 Reply
0 Total Likes
View groups...
Share this post:

How can I get Mathematica to completely evaluate my function?

Hello.  I have done a bit of serching on the the internet for a solution which has typically worked but after searching I am turning to the community. 

I am trying to calculate derivatives for a functional form of a physical interation, hydrogen bonding.  I have it programmed in Fortran but I would like to double check my results.    The function depends on the the angles and distances between atoms.  I am calculating these angles from the cartesian coordinates of the atoms using 
Theta = Arccos(Dot[X,Y)] / Norm*Norm)
where X and Y are the coordinate vectors. 
I have a defined function, Fgeom, which depends on 5 variables.  Each of the these variables are caluculated with other functions from the angle formual above.  This works when I solve the equation for the values of the h bonding and I get a number that is verified by my code and another program.  This lets me know I have programmed the correct form for the function.

I read in the values of the coordinates using the form
FGeom[Angle1,Angle2,Angle3,Angle4,Angle5]/. x -> 1.0 /. y -> 2.0 etc... 

The problem occurs when I try to find the derivative.  I use the expression
D[FGeom[Angle1,Angle2,Angle3,Angle4,Angle5], x ]./x->1.0, ./ y -> 1.0 etc.   

Mathematica evaluates the expression but rather than give me a single number for the value of the derivaitve it gives me something like this

0.000013795*(0.545679 + 0.0548247*Abs[-0.724238])

I have tried useing N[  ] to force numerical evaluation.  Has anyone encountered this before??/

Cheers and thanks in advance
POSTED BY: Kyle Throssell
Posted 11 years ago
Please start Mathematica fresh, evaluate the contents of the whole notebook once, save the notebook, edit your previous post and attach the notebook along with some indication of exactly which line to look at. That should be enouogh to let someone find the problem. Thanks.
POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract