# How to differentiate a function that is a function of other functions?

I am trying to differentiate the function epsilon1 with respect to u, but why this does not give me any output?

L10[a_] := 2*a;

L20[a_] := Sqrt[5]*a;

L1[a_, u_] := Sqrt[(2*a)^2 + u^2];

L2[a_, u_] := Sqrt[(2*a)^2 + (a - u)^2];

epsilon1[a_, u_] := (L1[a_, u_] - L10[a_])/L10[a_]

D[epsilon1, u]

• Because it is the downvalue rather the ownvalue that your epsilon1 has. This means that when you want to use epsilon1, feed it with the arguments: epsilon1[a, u]. Furthermore, the underscore Blank (_) should not appear on the RHS of SetDelayed (:=) when defining functions. – Αλέξανδρος Ζεγγ Sep 8 at 11:25

Fixing the code:

ClearAll["Global*"]; Remove["Global*"];
(*clears all values, definitions, attributes, messages, and defaults associated with symbols*)

L10[a_] := 2*a;

L20[a_] := Sqrt[5]*a;

L1[a_, u_] := Sqrt[(2*a)^2 + u^2];

L2[a_, u_] := Sqrt[(2*a)^2 + (a - u)^2];

epsilon1[a_, u_] := (L1[a, u] - L10[a])/L10[a];

epsilon2[a_, u_] := (L2[a, u] - L20[a])/L20[a];

N1[a_, u_, EA_] := EA*epsilon1[a, u];

N2[a_, u_, EA_] := EA*epsilon2[a, u];

P[a_, u_, EA_] := (u/L1[a, u]) N1[a, u, EA] - ((a u)/L2[a, u])*N2[a, u, EA];

D[P[a, u, EA], u]

(*-((EA (-Sqrt[5] a + Sqrt[4 a^2 + (a - u)^2]))/(
Sqrt[5] Sqrt[4 a^2 + (a - u)^2])) - (
EA (-Sqrt[5] a + Sqrt[4 a^2 + (a - u)^2]) (a - u) u)/(
Sqrt[5] (4 a^2 + (a - u)^2)^(3/2)) + (EA (a - u) u)/(
Sqrt[5] (4 a^2 + (a - u)^2)) + (EA u^2)/(2 a (4 a^2 + u^2)) - (
EA u^2 (-2 a + Sqrt[4 a^2 + u^2]))/(2 a (4 a^2 + u^2)^(3/2)) + (
EA (-2 a + Sqrt[4 a^2 + u^2]))/(2 a Sqrt[4 a^2 + u^2])*)

• Thank you! You even edited to fit my edit. – Student4Ever Sep 8 at 8:35
• @Student4Ever. You're welcome :) – Mariusz Iwaniuk Sep 8 at 8:37
• The clearall function did the trick! Thanks again:) – Student4Ever Sep 8 at 9:01