Message Boards Message Boards

0
|
5414 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Simplify 1.w? (w is any vector)

Posted 7 years ago

How to simplify 1.w? w is any vector example:

{1, 2, 3}

1 is a scalar, result of 1.w is

1.{1, 2, 3}

I want it to be {1, 2, 3}

POSTED BY: David Nova
2 Replies
w = {1, 2, 3};

1. is an approximate real number. Multiplying an approximate real number times a list or array of exact numbers will produce a list or array of approximate real numbers.

1. w

(*  {1., 2., 3.}  *)

If you want exact numbers, use Rationalize

1. w // Rationalize

(*  {1, 2, 3}  *)
POSTED BY: Robert Hanlon

. refers to the contraction (dot product) of two general tensors (array, list, matrix, vector). For example:

a.b

This will contract the last index of a with the first index of b. Scalar multiplication, what you want, can be written in (at least) 3 ways:

1{1,2,3}
1*{1,2,3}
Times[1,{1,2,3}]
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract