Connect with users of Wolfram technologies to learn, solve problems and share ideas
Mark as an Answer
0 Total Likes
Follow this post
Share this post:
How can I get Mathematica to completely evaluate my function?
Kyle Throssell, Wesleyan University
10 years ago
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
10 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.
Reply to this discussion
in reply to
Community posts can be styled and formatted using the
Tag limit exceeded
Note: Only the first five people you tag will receive an email notification; the other tagged names will appear as links to their profiles.
Add a file to this post
Follow this discussion
Be respectful. Review our
to understand your role and responsibilities.
Wolfram|Alpha Notebook Edition
Volume & Site Licensing
Enterprise Private Cloud
Service Plans Benefits
Wolfram Language Documentation
Wolfram Language Introductory Book
Get Started with Wolfram
Fast Introduction for Programmers
Fast Introduction for Math Students
Webinars & Training
Connected Devices Project
Wolfram Data Drop
Wolfram + Raspberry Pi
. All rights reserved.
Learn how »