Skip to main content
24-Ruby IV
September 10, 2021
Question

Sum in Mathcad Prime

  • September 10, 2021
  • 1 reply
  • 4849 views

Is it an error in Mathcad Prime?

Summa.png

Summa-1.png

1 reply

23-Emerald V
September 10, 2021

Odd, Valery.  It seemed to work on my Prime 7.0.0.0 Trial.

 

2021 09 10 A.png

 

Stuart

23-Emerald IV
September 10, 2021

Stuart,

 

Not odd. The 'magic' is in the fact that Valery put an evaluation (=) after the range definition of i. That changes the range to a vector. This is a special feature of Prime.

With that evaluation your sheet shows:

LucMeekes_0-1631307705393.png

The summation with a single i at its bottom, requires i to be a range; vector is not allowed.

 

Success!
Luc

23-Emerald V
September 10, 2021

@LucMeekes wrote:

Stuart,

 

Not odd. The 'magic' is in the fact that Valery put an evaluation (=) after the range definition of i. That changes the range to a vector. This is a special feature of Prime.

With that evaluation your sheet shows:

LucMeekes_0-1631307705393.png

The summation with a single i at its bottom, requires i to be a range; vector is not allowed.

 

Success!
Luc


Ah, of course.  Thanks, Luc.  I definitely need those new glasses! 

 

I did know about this "feature", but I tend to avoid putting evaluation operators at the end of definitions, precisely because of such side effects.   I don't think that it's entirely clear from the rhs of the evaluation what the definition will actually assign to the variable.

 

2021 09 10 B.png

 

IMO, for this purpose, they'd have been better off implementing a vec function that converts any argument to a vector. 

 

I believe that I've suggested in the past that Mathcad ought to auto-iterate over vectors (or arrays, in general) in such cases.   I vaguely recall having a discussion about this some time ago and there being some objections - but I can't remember what they were.  I'll have to have a think about it.  I vaguely recall Tom Gutman and jMG commenting ...

 

However, the feature request for an automatic vector product still stands.  ðŸ™‚

 

Cheers,

 

Stuart

 

(I also wonder if min and max ought to return the first and last elements of a range ...I can think of a few uses for this capability?)

 

2021 09 10 C.png