Community Tip - You can change your system assigned username to something more personal in your community settings. X
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.
Solved! Go to Solution.
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?
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
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.
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
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?
Thank you very much. I'll take a look closely tomorrow and will post here a feedback.
These really were the problems! In my ingenuity, I'd perhaps never get to this conclusion. Thank you.
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
@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:
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.
@jgvinholi wrote:
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.
Yes, Mathcad "knows" that. Every numerical solve block uses a numeric iteration algorithm (something like Levenberg-Marquardt, Quasi-Newton, etc. - not sure what the algorithm in KNITRO used by prime is) to get its solutions. Also the solve blocks you implemented work that way.
I simply combined your two last solve blocks to let Mathcad play around with all seven variable and get a solution in one run.
Hope the factor S3 I added (as written in my first reply) to balance the units was the correct choice.
Often, knowing how the tool you're using works makes a big difference. The S3 you added is absolutely correct. I had forgotten to add it.
Again I'd like to thank you for the help. Couldn't be more grateful of your response than I do.