1
$\begingroup$

If I were to define a vector

r = {2, 0} + t*({5, 4} - {2, 0})
>>{2 + 3 t, 4 t}
Sqrt[(D[r[1]])^2 + (D[r[2]])^2]

How do I properly reference a single component of the vector so that I can use it for something else like derive. This is for program to solve line integrals.

$\endgroup$
0
0
$\begingroup$

Sqrt[(D[r[1]])^2 + (D[r[2]])^2]

You can't just write D[somthing] you need to write D[something, variable].

You can try

r = {2, 0} + t*({5, 4} - {2, 0});

Mathematica graphics

Sqrt[ D[ r[[1]], t]^2 + D[ r[[2]], t]^2]
(*5*)

If it makes it easier, you could give the components names, and just use the names

x = r[[1]];
y = r[[2]];

Sqrt[ D[x,t]^2 + D[y,t]^2 ]
(*5*)

Or You could also write

Norm@Grad[r, {t}] 
(*5*)

which gives same result if I am following what you are trying to do right.

$\endgroup$

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.