Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let us define

r1 = 1;r2 = 2;


beta2[t_] := {r1*Cos[2*Pi*t], r2*Sin[2*Pi*t]}
beta1[t_] := beta2[t + 4.8*t^2*(t - 1)^2] 
k[v_] := If[Norm[v] > 0, v/Sqrt[Norm[v]], 0]


q2[t_] :=  FunctionExpand[k[beta2'[t]], Assumptions -> t \[Element] Reals]

q1[t_] :=  FunctionExpand[k[beta1'[t]], Assumptions -> t \[Element] Reals]

Now when I call


I get

{4.56985 + 0.157049 (10.2293 Derivative[1][Abs][-5.97566] - 40.9174 Derivative[1][Abs][-3.88322]), -28.1291 + 0.102057 (10.2293 Derivative[1][Abs][-5.97566] - 40.9174 Derivative[1][Abs][-3.88322])}


How to simplify this expression?

share|improve this question
Apply FunctionExpand to the final expression to simplify it. Sorry, I didn't follow the rest of the code ... – Szabolcs Mar 29 '14 at 20:34
You can't take derivative with respect to a number. so not sure what q1'[3] is meant to represent. Also, If[Norm[v] > 0, v/Sqrt[Norm[v]], 0] return the result you show, since it is passed a symbolic expression. You are mixing symbolic with numerical computation in strange way. – Nasser Mar 29 '14 at 23:40

Generally speaking, If is for programming and Piecewise is for function construction. While the distinction is somewhat artificial, the significant difference is that Piecewise, although having the attribute HoldAll, evaluates its arguments. The effective difference can been seen by evaluating q1[t] with the OP's definition of k[v] and this one:

k[v_] := Piecewise[{{v/Sqrt[Norm[v]], Norm[v] > 0}}]

With this definition, FunctionExpand works properly to expand the instances of Abs that show up when Norm is evaluated. The OP's test example works properly with this change:

(*  {-46106.6, 122826.}  *)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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