Group Abstract Group Abstract

Message Boards Message Boards

Search for maximum of user defined function

Posted 3 years ago
POSTED BY: Emily O
3 Replies
Posted 3 years ago

Hi Emily,

When I evaluate the code I get

Dot::dotsh: Tensors {{2,2.4,2.88},{2,2.4,2.4},{2,2.4,2.},{2,2.,2.4},{2,2.,2},{2,2.,1.66667},{2,1.66667,2.},{2,1.66667,1.66667},{2,1.66667,1.38889}} and {{a,b1,c1},{a,b1,c2},{a,b1,c3},{a,b2,c4},{a,b2,c5},{a,b2,c6},{a,b3,c7},{a,b3,c8},{a,b3,c9}} have incompatible shapes.

Thread does not Hold its arguments so Dot gets evaluated before Thread in the following

BBig = Thread[Dot[B1t, B2t]];

You do not get the same error, which is odd. Are you sure the code shared is exactly what you evaluated?

POSTED BY: Rohit Namjoshi
Posted 3 years ago

Thank you very much for replying. I forgot that I had turned the message off (Off[Dot::dotsh} since, despite the message, it does calculate the list I want - viz

ln[1374]:= BBig

Out[1374]= {2 a + 2.4 b1 + 2.88 c1, 2 a + 2.4 b1 + 2.4 c2, 
 2 a + 2.4 b1 + 2. c3, 2 a + 2. b2 + 2.4 c4, 2 a + 2. b2 + 2 c5, 
 2 a + 2. b2 + 1.66667 c6, 2 a + 1.66667 b3 + 2. c7, 
 2 a + 1.66667 b3 + 1.66667 c8, 2 a + 1.66667 b3 + 1.38889 c9}

Although, I'd also be interested to know how I should program it correctly. I tried to search how to do "element by element" multiplication (i.e. not the complete dot product) but couldn't find out how to do this.

POSTED BY: Emily O
Posted 3 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard