Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to differentiate the function s, and be able to evaluate it for different w afterwards. I tried the following:

 s[w_, V1_, V2_, V3_] = -Exp[-(V1 + V2)/2 - V3] + 
  Exp[-(V2 + V1)/2]/(Exp[(V2 - V1)/2] + 
      Exp[-(V2 - V1)/2]) (11 w^2 - (  
       Exp[-V1] +  Exp[-V2]  Exp[-V3] +  Exp[-V2] +  
        Exp[-V1]  Exp[-V3])^2)

D[s[w_, V1, V2, V3], w]

This is what I got

(22 E^(1/2 (-V1 - V2)) w_ 
Pattern^(0,1)[w, _]
)/(E^((V1 - V2)/2) + E^(
 1/2 (-V1 + V2)))

I don't understand why "pattern" shows up in the expression, and what it might mean. I think I might have done something wrong with the patterns, but why don't I just get some kind of error?

share|improve this question

closed as too localized by Szabolcs, halirutan, image_doctor, Artes, rm -rf Dec 19 '12 at 2:29

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 2 down vote accepted

This happens because you used a pattern, w_, where it should not be used. Note that the full form of w_ is Pattern[w, Blank[]]. So just change w_ to w in D[s[w_, V1, V2, V3], w].

share|improve this answer
    
Thanks a lot! Originally I had a much more complicated expression, and when leaving out the _ I got something really ugly, while with w_ it did not look so very bad. Is there any meaning to this pattern thing in my final expression, or does it just mean that I did some crap before? –  Apatura Dec 18 '12 at 16:58
    
@Apatura I'm sorry, but I'm not sure I understand. Why did you put the underscore character there in the first place? If you're not familiar with patterns, you can learn about them here. –  Szabolcs Dec 18 '12 at 17:16
    
First I did it because I then thought it was right - which it is not, as I know now. But then I wondered why it seemed to make a difference on the output, why it showed up in the middle of the expression and what the (0,1) might mean. –  Apatura Dec 18 '12 at 17:27
    
@Apatura You'll find the answer if you look at the FullForm of w_. Try writing pattern and blank there to see more clearly what's happening. ^(1,0) means derivative with respect to the first argument. Also, I recommend you look at this tutorial. –  Szabolcs Dec 18 '12 at 20:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.