cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

"This value must be a vector" while programming

avbor
1-Newbie

"This value must be a vector" while programming

Hello. I tried to write implement a Gauss-Seidel Method, but got an error. I initialised all variables and wrote all the programming, which seems to be alright, but when I am trying to assign an element of previously initialised vector to a variable, it throws a "This value must be a vector" error. I have no idea why this is like that, I googled the manual about matrices and vectors and it says that Mathcad must recognise 3x1 matrices as column vectors.

Moreover, the same code works in Mathcad 15 flawlessly (I have no possibility of using a code convertor included in Mathcad Prime).

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:avbor)

This seems to be a bug in Prime which is not present in Mathcad.

You can get your routine to work if you rediefine some variables in the routione itself. I consider it better programming style anyway to do the inializations in the program and not outside.

1.png

In fact it is not necessary to use x <-- x. All thats necessary is to USE x, so you may as well type dummy <-- x.

Its seems that worksheet variables are not respected sometimes and are considered to be 0 (the reason you got an error with x[i as x=0 is not a vector). It happens in combination with the while-loop:

2.png

2.png

I would consider this a bug.

In Mathcad 15 all is OK:

3.png

View solution in original post

6 REPLIES 6
RichardJ
19-Tanzanite
(To:avbor)

It's just not seeing some of the definitions, but I don't know why. You can force it to see them by putting x<--x, etc, at the top of the program. You need to do this for x, flag, and SS, but not the other variables. I have no idea what makes these three variables different.

I would call this a bug.

Maybe I forgot SS in the solution I posted below and didn't noticed it as its initialized to zero anyway.

Its a strange effect that worksheet variables are not seen inside a while and simple usage (it has not to be x x<--x) before entering the while loop makes them visible. Its sure a bug.

Vector b is seen by the while loop by vector x not. So it may have to do with the fact the x[i is assigned a value at the end of the loop.

RichardJ
19-Tanzanite
(To:Werner_E)

Agreed, it's a bug. I have little confidence that anyone from PTC will pick it up from this thread, and I don't have maintenance so I am forbidden by PTC from helping them by reporting it. I have stashed it away though, so if it isn't fixed in the next beta test I'm involved in, I'll report it then.

In the meantime my interest in Prime and its development is rather mediocre, so I won't bother to report. Furthermore I have not much confidence that a bug report, which has to be disguised as a support call, will ever find its way to R&D and lead to a fix.

Werner_E
24-Ruby V
(To:avbor)

This seems to be a bug in Prime which is not present in Mathcad.

You can get your routine to work if you rediefine some variables in the routione itself. I consider it better programming style anyway to do the inializations in the program and not outside.

1.png

In fact it is not necessary to use x <-- x. All thats necessary is to USE x, so you may as well type dummy <-- x.

Its seems that worksheet variables are not respected sometimes and are considered to be 0 (the reason you got an error with x[i as x=0 is not a vector). It happens in combination with the while-loop:

2.png

2.png

I would consider this a bug.

In Mathcad 15 all is OK:

3.png

avbor
1-Newbie
(To:Werner_E)

Yeah, great, thank you. I didn't think that I'll find a bug in product such as Mathcad. Hope they'll fix this someday.

I didn't think of initializing variables inside routine as well, because I don't use them often. I'll consider that, thanks.

Top Tags