0
$\begingroup$

I have a fairly complicated function

VIcase1L[b_,\[Epsilon]_, d_] := .......

All I wanted to to was to derive it this function with respect to b and define it. So I did

DVIcase1L = D[VIcase1L[b,\[Epsilon], d], {b, 1}];

Which worked and yielded me an even loger function. But I actually want to define this derivative as a function dependent on the parameters b,f and d. I.e. I want

DVIcase1L[b_,\[Epsilon]_,d_] = D[VIcase1L[b,\[Epsilon], d], {b, 1}];

But I get the error 'SetDelayed: Tag Plus in' Any ideas why?`

Bonus for anyone who wants to see the whole code:

 VIcase1L[b_, \[Epsilon]_, d_] := 
  1/If[1/b == 0, 1, (
     E^(1/(1/b)) (1 - E^(-(d/(1/b)))))/(-1 + E^(1/(1/b)))] ((
      E^(-2 b k) (-E^(2 b) - E^(4 b) + E^(2 b + 2 b k) + E^(
         4 b + 2 b k) + 2 E^(2 b + 2 b k) k - 2 E^(4 b + 2 b k) k + 
         E^(2 b + 2 b k) k^2 - 2 E^(4 b + 2 b k) k^2 + 
         E^(6 b + 2 b k) k^2 + 2 E^(2 b) \[Epsilon] - 
         2 E^(4 b) \[Epsilon] - 2 E^(2 b + 2 b k) \[Epsilon] + 
         2 E^(4 b + 2 b k) \[Epsilon] - 
         2 E^(2 b + 2 b k) k \[Epsilon] + 
         4 E^(4 b + 2 b k) k \[Epsilon] - 
         2 E^(6 b + 2 b k) k \[Epsilon] - \[Epsilon]^2 + 
         2 E^(2 b) \[Epsilon]^2 - E^(4 b) \[Epsilon]^2 + 
         E^(2 b + 2 b k) \[Epsilon]^2 - 
         2 E^(4 b + 2 b k) \[Epsilon]^2 + 
         E^(6 b + 2 b k) \[Epsilon]^2))/(-1 + E^(2 b))^3 - 
      1/(-1 + E^b)^3 E^(
       b - b d - 
        b (1 + 2 k)) (-E^(b + b d) - E^(2 b + b d) + E^(
         b (1 + 2 k)) - 2 d E^(b (1 + 2 k)) + d^2 E^(b (1 + 2 k)) + 
         E^(b + b (1 + 2 k)) + 2 d E^(b + b (1 + 2 k)) - 
         2 d^2 E^(b + b (1 + 2 k)) + d^2 E^(2 b + b (1 + 2 k)) + 
         4 E^(b + b d) k - 4 E^(2 b + b d) k - 4 E^(b d) k^2 + 
         8 E^(b + b d) k^2 - 4 E^(2 b + b d) k^2 - 
         2 E^(b + b d) \[Epsilon] + 2 E^(2 b + b d) \[Epsilon] + 
         2 E^(b (1 + 2 k)) \[Epsilon] - 
         2 d E^(b (1 + 2 k)) \[Epsilon] - 
         2 E^(b + b (1 + 2 k)) \[Epsilon] + 
         4 d E^(b + b (1 + 2 k)) \[Epsilon] - 
         2 d E^(2 b + b (1 + 2 k)) \[Epsilon] + 
         4 E^(b d) k \[Epsilon] - 8 E^(b + b d) k \[Epsilon] + 
         4 E^(2 b + b d) k \[Epsilon] - E^(b d) \[Epsilon]^2 + 
         2 E^(b + b d) \[Epsilon]^2 - E^(2 b + b d) \[Epsilon]^2 + 
         E^(b (1 + 2 k)) \[Epsilon]^2 - 
         2 E^(b + b (1 + 2 k)) \[Epsilon]^2 + 
         E^(2 b + b (1 + 2 k)) \[Epsilon]^2) + 
      1/(-1 + E^(
         2 b))^3 E^(-2 b (1 - k + Min[-1 + d, 2 k])) (-E^(5 b) - E^(
         7 b) + E^(3 b + 2 b (1 - k + Min[-1 + d, 2 k])) + E^(
         5 b + 2 b (1 - k + Min[-1 + d, 2 k])) - 
         2 E^(3 b + 2 b (1 - k + Min[-1 + d, 2 k])) k + 
         2 E^(5 b + 2 b (1 - k + Min[-1 + d, 2 k])) k + 
         E^(b + 2 b (1 - k + Min[-1 + d, 2 k])) k^2 - 
         2 E^(3 b + 2 b (1 - k + Min[-1 + d, 2 k])) k^2 + 
         E^(5 b + 2 b (1 - k + Min[-1 + d, 2 k])) k^2 - 
         2 E^(5 b) \[Epsilon] + 2 E^(7 b) \[Epsilon] + 
         2 E^(3 b + 2 b (1 - k + Min[-1 + d, 2 k])) \[Epsilon] - 
         2 E^(5 b + 2 b (1 - k + Min[-1 + d, 2 k])) \[Epsilon] - 
         2 E^(b + 2 b (1 - k + Min[-1 + d, 2 k])) k \[Epsilon] + 
         4 E^(3 b + 2 b (1 - k + Min[-1 + d, 2 k])) k \[Epsilon] - 
         2 E^(5 b + 2 b (1 - k + Min[-1 + d, 2 k])) k \[Epsilon] - 
         E^(3 b) \[Epsilon]^2 + 2 E^(5 b) \[Epsilon]^2 - 
         E^(7 b) \[Epsilon]^2 + 
         E^(b + 2 b (1 - k + Min[-1 + d, 2 k])) \[Epsilon]^2 - 
         2 E^(3 b + 2 b (1 - k + Min[-1 + d, 2 k])) \[Epsilon]^2 + 
         E^(5 b + 2 b (1 - k + Min[-1 + d, 2 k])) \[Epsilon]^2 + 
         2 E^(5 b) Min[-1 + d, 2 k] - 2 E^(7 b) Min[-1 + d, 2 k] + 
         2 E^(3 b) \[Epsilon] Min[-1 + d, 2 k] - 
         4 E^(5 b) \[Epsilon] Min[-1 + d, 2 k] + 
         2 E^(7 b) \[Epsilon] Min[-1 + d, 2 k] - 
         E^(3 b) Min[-1 + d, 2 k]^2 + 2 E^(5 b) Min[-1 + d, 2 k]^2 - 
         E^(7 b) Min[-1 + d, 2 k]^2)) /. {k -> Floor[\[Epsilon]]};
$\endgroup$
  • $\begingroup$ You can restart kernel or Clear[DVIcase1L] before DVIcase1L[b_,\[Epsilon]_,d_] = D[VIcase1L[b,\[Epsilon], d], {b, 1}]; $\endgroup$ – egwene sedai Jan 22 at 21:54
  • $\begingroup$ Long story: when you define DVIcase1L = D[VIcase1L[b,\[Epsilon], d], {b, 1}];, DVIcase1L is a complicated expression whose head is Plus (check Head[DVIcase1L]), due to the result being a sum of some expressions. Just eep in mind you cannot overwrite this expression to a new function. $\endgroup$ – egwene sedai Jan 22 at 22:01
  • $\begingroup$ great it worked! thank you so much! $\endgroup$ – CatoMaths Jan 22 at 22:01
  • $\begingroup$ For more details, mathematica.stackexchange.com/questions/6738/… $\endgroup$ – egwene sedai Jan 22 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.