2
$\begingroup$

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]
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Αλέξανδρος Ζεγγ Sep 8 at 11:25
1
$\begingroup$

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])*)
$\endgroup$
  • $\begingroup$ Thank you! You even edited to fit my edit. $\endgroup$ – Student4Ever Sep 8 at 8:35
  • $\begingroup$ @Student4Ever. You're welcome :) $\endgroup$ – Mariusz Iwaniuk Sep 8 at 8:37
  • $\begingroup$ The clearall function did the trick! Thanks again:) $\endgroup$ – Student4Ever Sep 8 at 9:01

Your Answer

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

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