Skip to main content
1-Visitor
Sep 3, 2014 9:42 AM UTC
Question

Optimisation of a variable

I have a Mathcad document along the lines of:

r:=10mm

---------

Many equations using r and other variables.

---------

stress = 50 MPa

Is there a way to find the value of r that gives the minimum stress without totally re-writing the document?

I know this can be done relatively easily for discrete values of r by using a vector but I'd ideally like to do the equivalent of an Excel goal seek.

9 replies

Werner_E
25-Diamond I
Sep 3, 2014 10:07 AM UTC

Turn your calculations into functions dependent on r, so that at the end you have a function stress(r):=.....

Then use "minimize".

Translate
23-Emerald I
Sep 3, 2014 10:08 AM UTC

If you have stress as a function of r, then Minimize will do what you want.

Translate
17-Peridot
Sep 3, 2014 11:14 AM UTC

Hi Dan

try this one. Some simple equations that spit out a minimized value.

Hope it helps

Raiko

Translate
Dan8881-VisitorAuthor
1-Visitor
Sep 10, 2014 8:09 AM UTC

Trouble is my worksheet is long and complex and is not written using functions but straight definitions e.g. B:=2r rather than B(r):=2r

It doesn't look like it is possible to do what I want without rewriting every equation as a function of r because Minimize only works with functions.

Might be easier to set up the same equations in Excel and use solver as there are a few input variables apart from r that I'd like to change.

Translate
Dan8881-VisitorAuthor
1-Visitor
Sep 10, 2014 8:20 AM UTC

Is there a way to do it along these lines:

Given

r:=10

stress:=r^2

5<r<20

stress<1

Minerr(stress,r)=(1 over 10)

The stress<1 line is an attempt to force it to find the minimum value of stress even though it has to be higher than 1 to satisfy the constraints.

Why does the above not give (5 over 25)?

Translate
Dan8881-VisitorAuthor
1-Visitor
Sep 10, 2014 8:34 AM UTC

Here's another attempt:

Given

r:=10

stress:=1000

stress=r^2 (boolean equals this time)

5<r<20

stress<1

Minerr(stress,r)=(1.962 over 1.71)

If I right click Minerr and change to one of the other non-linear methods it gives (8.16 over 3.5) which is a bit closer to the correct answer of (25 over 5)

Why does it give these answers?

Translate
23-Emerald I
Sep 10, 2014 12:36 PM UTC

If you have a range for r (that it must stay inside), replace the single value r:=10 with a vector of values that covers the range. It may be necessary to "vectorize" a few of you equations, but the sheet should compute and result in a vector of stresses--one for each value of the radius vector. Plot stress vector against r vector, or develop a curve fit between the vectors, to find the minimum.

Translate