Skip to main content
1-Visitor
February 1, 2011
Solved

Solve block and matrices

  • February 1, 2011
  • 3 replies
  • 24314 views

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.

Best answer by RichardJ

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.

3 replies

1-Visitor
February 1, 2011

A few points on your attached worksheet.

  • Why have you inserted all your Math regions into text boxes - I see no advantage in doing that.
  • You have a very large file attached, which immediatly puts people off - well it does for me because I know I'll have to spend an age searching through the file. Why don't you just post an example or the section of the problem?
  • You haven't indicated which section you have a problem with. (Remember time is money )

Mike

http://communities.ptc.com/servlet/JiveServlet/showImage/2-149416-2532/bar_anim.gif

Dumitru1-VisitorAuthor
1-Visitor
February 1, 2011

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.

1-Visitor
February 1, 2011

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

http://communities.ptc.com/servlet/JiveServlet/showImage/2-149416-2532/bar_anim.gif

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.

24-Ruby IV
February 1, 2011

You can create the user function y(x):=Find(...) and call y(M) where M ix a matrix.

Dumitru1-VisitorAuthor
1-Visitor
February 2, 2011

Thank you all for your ideas. I'll be looking into them today and hope to give soon some feedback...

Kind regards, D.

Dumitru1-VisitorAuthor
1-Visitor
February 2, 2011

Assume the following:

1. ratio of a matrice (epsilon_c, sigma_c) and a vector (epsilon_o, sigma_o) given by XY(epsilon_c, epsilon_o) and XY(sigma_c, sigma_o). The vector lists the maximum values for sigma_c and the corresponding epsilon_c.

2. each column in epsilon_c are strain values for the corresponding stresses listed in sigma_c.

3. strains and stresses are connected by a function (user defined; i.e. by the 4 conditions specified).

4. is there a way to calculate the coefficients used to define the function, perhaps with minerr?

Of course, some functions may lead to invalid results, if the type of function (polynomial, power, etc.) used to link strain and stress is not suited for the initial data (as given by epsilon_c and sigma_c).

The problem I last faced is that the program attached by Alan Stevens (thanks) New Picture (13).jpg and copied in my larger file (not attached in the collab due to dimensions) gives another set of values..New Picture (12).jpgA1 stands for A and so on (C gave a definition error so I added the "1" to overpass that)

19-Tanzanite
February 2, 2011

If you cut and pasted the routine from one file to the other, then any difference must be due to differences in data that go to making up the XY, E etc matrices and vectors, or some difference in the way they are defined. Without seeing your larger file it's not possible to be more specific.

Alan

19-Tanzanite
February 2, 2011

No, I see the problem. You don't have xysq pictured, so you must have evaluated it before the definition of f and the xy.f evaluation. xysq must be calculated after xy.f..

Alan