Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
If one needs to calculate multiple solutions (i.e., 4) many times over (using data from matrices)...is it possible? Furthermore, I don't know why..it doesn't work (see atached).
Kind regards, D.
Solved! Go to Solution.
No, a solve block is not allowed inside a program. At least, not the way you are trying to do it, by putting the given and find inside the program. That is not allowed. You have to turn the solve block into a function, and call the function from the program, which is what is done in the worksheet I posted. I didn't realize you were working with MC13, so here's the MC13 version of the file. The regions highlighted in green are the modifications I made from the first file.
Note that Alan's worksheet finds one set of constants that best satisfies all the elements in your matrices at once. Mine finds one set of constants for each element of the matrix, which is what I thought you were after.
A few points on your attached worksheet.
Mike
You're right. I've been trying a solution for some time now and it feels like being easy to spot... The idea is I need to calculate 4 unknowns (A, B, C and D) for the given conditions for each value XY(epsilon c, ...), XY(sigma c,...), E0. The very last part of the sheet shows two ways (given, find): system of equations and solve block. Neither works...
Kind regards, D.
A couple of points now I know which sections to look at.
The first solve block Mathcad requires guess values for the unknowns. You must also have the same number of equations as unknowns.
The second won't work, I don't think Solve blocks work with a program.
Mike
Message was edited by: Mike Armstrong - Few more noted - you should be using the Boolean equals sign within a solve block and epsilon[co.5 doesn't seem to have been define in the worksheet.
MIke,
he could try to make a procedure with the find and call that procedure in the program.
I did that this way, for my Minerr solve block in the program. That works fine.
Walter
he could try to make a procedure with the find and call that procedure in the program. I did that this way, for my Minerr solve block in the program. That works fine.
Walter
That's a lovely example, but not exactly what he has shown. He has called the solve block within a program. I think he needs to read up on using slove blocks first, learn the basic principles
Mike
Could you please attach a lower version? I'm using M13.
Kind regards, D.
You are right (again). Some definitions were incorrect (because I extracted the data from a much larger file). About given & find in solve block...I've seen an exemple in the collab (can't remember where exactly) so it should have worked. The classic way still doen't (after correcting...)
Dimitru,
It seems you have problems throughout your worksheet. You are calling epsilon.0 within the solve block and not passing it with any arguments, when it is defined above as a function with two arguments.
I would suggest breaking the problem right down to basic and working through that way.
Mike
Attached is a possible approach. You'll need to check my equations carefully as I could easily have made an error in the manipulations to go from your equations to mine! I couldn't comment on the validity of the results.
Alan
NB Calculations done in M15 but saved as M11 file.
As written, one of the expressions in your solve block will not even evaluate, Solve block are also not allowed in programs.
You need to make the solve block work for a scalar, turn it into a function, and call the function in a program. See the atteched.
Here's an improvement. I should have thought of this immediately.
Valery Ochkov gave in one collab an exemple (the one I mentioned) of a solve block introduced inside a program (give, find)...so I guess it is possible to do that..
Kind regards, D.
Dumitru Moldovan wrote:
Valery Ochkov gave in one collab an exemple (the one I mentioned) of a solve block introduced inside a program (give, find)...so I guess it is possible to do that..
Kind regards, D.
See Mathcad and Mathcad Prime files with the y(x):=Find construction here - http://communities.ptc.com/message/158454
Could you please attach a lower version ? I'm using M13..
Kind regards, D.
Dumitru Moldovan wrote:
Could you please attach a lower version ? I'm using M13..
Kind regards, D.
No problem - see the attach!
No, a solve block is not allowed inside a program. At least, not the way you are trying to do it, by putting the given and find inside the program. That is not allowed. You have to turn the solve block into a function, and call the function from the program, which is what is done in the worksheet I posted. I didn't realize you were working with MC13, so here's the MC13 version of the file. The regions highlighted in green are the modifications I made from the first file.
Note that Alan's worksheet finds one set of constants that best satisfies all the elements in your matrices at once. Mine finds one set of constants for each element of the matrix, which is what I thought you were after.
Thank you Richard, that was my intention first. Then, based on the discussion in this collab, the way Alan did it is also interesting. The way in-between your's and Alan's would be to calculate a set of values that is a best fit for each column...for now I thing my question was answered.
Thank you all for helping.
Kind regards, D.
Dumitru Moldovan wrote:
Thank you Richard, that was my intention first. Then, based on the discussion in this collab, the way Alan did it is also interesting. The way in-between your's and Alan's would be to calculate a set of values that is a best fit for each column...for now I thing my question was answered.
Thank you all for helping.
Kind regards, D.
Modifying my approach to get best fit values for each column is quite straightforward - see attached.
Alan
Great work Alan. Thank you!
Dumitru Moldovan wrote:
Great work Alan. Thank you!
Hmmm! On reflection, not so great! Your condition that the XY values should be less than or equal to unity was presumably meant to exclude points that don't satisfy this criterion. My approach simply set them to zero, which is not the same thing at all. I'll try to find some time to relook at this. Meantime - don't trust the results!!
Alan
Alan Stevens wrote:
Hmmm! On reflection, not so great! Your condition that the XY values should be less than or equal to unity was presumably meant to exclude points that don't satisfy this criterion. My approach simply set them to zero, which is not the same thing at all. I'll try to find some time to relook at this. Meantime - don't trust the results!!
Alan
Attached are the results of my further thoughts.
Alan
Attached file modified to correct an error.
The last term in brackets should have been Do*square (xy). I'm not new to Mathcad, but without help, on my one, I wouldn't have done it. Thank you Alan (and every other collab) for your further thoughts.
Kind regards, D.
First, sorry to re-open the subject but I couldn't solve it on my own. I changed a little bit the conditions
for the same function
The problem I face is an "array dimensions do not match"...I'm clueless to the cause. Help!!
Kind regards, D.
Here's where the problem is. Are you missing a transpose on one of the terms?
Apparently I am... (see attached). Frankly, I was expecting the solution provided by Alan to work in this case also (with other conditions). In conclusion, I lost..
P.S. by using vectorize for the last term in the expression after "given" (see q3_3a) all expressions are matrices of 50 x 30 (see q3_3). Still, it doesn't give any result (frustrating)
Try the attached.
Incidentally, I recommend that you don't insert Maths regions in text boxes so much - it makes debugging much harder.
Alan
Message was edited by: AlanStevens Version saved in M11 format added
Message was edited by: AlanStevens New file with minor error corrected attached.
Incidentally, I recommend that you don't insert Maths regions in text boxes so much - it makes debugging much harder.
I'll second that.
It is also a little dangerous and can lead to confusion, because all the calculations in a text box are effectively in one region, and the anchor point of that region (i.e. the text box) determines calculation order. That means if you place another expression to the right of the text box the apparent calculation order may not be the same as the actual calculation order.
To Alan : thank you Alan, you saved me again. ir61 and ir61_2 should have been different. Since at row 23 and 24 the values in the initial epsilon.c (remember x is a ratio of epsilon.c and epsilon.o) are very close, mathcad seems to round them up (both values) to 1 (one could say it's correct for both to happen for row 24 and column 15 - it the sheet you provided I'll turn the "min" condition in a "max" one).
To both Alan and Richard : I use to insert math in text regions to (personal opinion) better prepare the sheet for printing (alignment, fitting on page, etc.). I knew about the calculation order as indicated by both (sorry for making the debugging more difficult, i.e. I use right side/page to "see" intermediary results). As a final question : which is best ? (inserting math into text region or not - in view of the need to prepare sheet for printing aka alignment, fitting on page, etc.)
King regards to all and thank you again! D.
Sorry to bother again...would it be possible to use the template you generated to calculate a function just as in the next photo ?
King regards, D.
The attached is the result of a previous collab discussion (can't remember the author - pardon for that). Is it possible to calculate A, B, C and n with minerr based on the conditions specified in the picture?