I am interested in expanding a vector expression in terms of the scalar parameter, but it doesn't give the expected result
$Assumptions = (ϵ) ∈ Reals;
$Assumptions = (r | k) ∈ Vectors[3, Reals];
A[r_] := Module[{M},
$Assumptions = r ∈ Vectors[3, Reals];
M = r + k*ϵ // Simplify;
Return[M]
];
q[r_] := Module[{M},
$Assumptions = r ∈ Vectors[3, Reals];
M = ϵ*(r\[Cross]A[r]) + ϵ*r // Simplify;
Return[M]
];
q[r]
Coefficient[Expand[TensorReduce[q[r]], ϵ], ϵ, 1]
Coefficient[Expand[TensorReduce[q[r]], ϵ], ϵ, 2]
Edit:
Output of the first Coefficient is
r + r\[Cross](r + k ϵ)
and should be
r+ r\[Cross]r (* same as just r *)
and output of the second Coefficient is
0
and should be
r\[Cross]k
Module
for these functions, you could rewrite them asA[r_] := Assuming[r ∈ Vectors[3, Reals], r + k*ϵ // Simplify ]; q[r_] := Assuming[r ∈ Vectors[3, Reals], ϵ*(r\[Cross]A[r]) + ϵ*r // Simplify ];
$\endgroup$Module
, so the title of the question should be changed. Next, you should edit the question to show what output you do get and what output you expect. $\endgroup$$Assumptions = ϵ∈Reals && (r|k)∈Vectors[3,Reals]
at the top, and remove the redefinitions of$Assumptions
in your code. $\endgroup$