Skip to main content
1-Visitor
April 9, 2018
Solved

"indexed assignment to a matrix element is not permitted in a solve block mathcad"

  • April 9, 2018
  • 12 replies
  • 5762 views

Hi, I've been trying to use some solve blocks inside a program. The solve blocks return matrixes with the solutions of the equations. I'm trying to get these results inside a program, but the error "indexed assignment to a matrix element is not permitted in a solve block mathcad" keeps showing. I don't really understand what it means. I've attached the file.

 

Edit: I haven't put any solve block inside the program, but instead tried to get outputs from outside solve blocks.

Best answer by Werner_E

The reason for the error message you get is, that you have erratically used a vector index for H1_2 in the Hi-gap solve block when assigning the guess value.

After you change that for a literal index the error is gone away, but you get a new unit mismatch error when calling Hi_iron.

Can it be that you forgot a factor S3 on the left side of the third equation?

12 replies

23-Emerald IV
April 9, 2018

You cannot (in Mathcad or Prime) put a solve block into a program, but you can make the output of a solve block a function which you can use further.

 

Success!

Luc

jgvinholi1-VisitorAuthor
1-Visitor
April 9, 2018

I haven't tried to put a solve block inside a program. What I'm doing is calling functions that give outputs from other solve blocks. What I'm doing is exactly what you suggested. I've expressed Myself badly, sorry.

Thanks for the response.

23-Emerald IV
April 9, 2018

Check your labels. The 'Hf' solve block (2nd iteration) tries to find 'Hf1[1' which is labelled as a constant (green) instead of variable (black).

 

Success!

Luc

 

Werner_E25-Diamond IAnswer
25-Diamond I
April 9, 2018

The reason for the error message you get is, that you have erratically used a vector index for H1_2 in the Hi-gap solve block when assigning the guess value.

After you change that for a literal index the error is gone away, but you get a new unit mismatch error when calling Hi_iron.

Can it be that you forgot a factor S3 on the left side of the third equation?

jgvinholi1-VisitorAuthor
1-Visitor
April 9, 2018

Thank you very much. I'll take a look closely tomorrow and will post here a feedback.

21-Topaz II
April 10, 2018

Hi,

In the last bit of programming for "ans" you have used an iteration of "i" from 0 to 50.

The index "i" is not used within the programming block?  Is this intentional?

Cheers

Terry

25-Diamond I
April 10, 2018

@terryhendicott wrote:

Hi,

In the last bit of programming for "ans" you have used an iteration of "i" from 0 to 50.

The index "i" is not used within the programming block?  Is this intentional?

Cheers

Terry


I guess this is just doing the iteration 50 times hoping for convergence.

 

I think that one single solve block can replace all the others and this loop a well:

Bild.png

jgvinholi1-VisitorAuthor
1-Visitor
April 10, 2018

That's impressive! How does Mathcad gets Hf_1 to calculate Mu_f? I thought the only way I could solve this problem was through repetitions, as I had done. Does Mathcad "know" it is needed to make a iterative process and do it by itself? Thanks for the help.