Skip to main content
1-Visitor
September 3, 2014
Question

Optimisation of a variable

  • September 3, 2014
  • 5 replies
  • 3510 views

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.

5 replies

25-Diamond I
September 3, 2014

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

Then use "minimize".

23-Emerald I
September 3, 2014

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

17-Peridot
September 3, 2014

Hi Dan

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

Hope it helps

Raiko

Dan8881-VisitorAuthor
1-Visitor
September 10, 2014

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.

Dan8881-VisitorAuthor
1-Visitor
September 10, 2014

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)?

Dan8881-VisitorAuthor
1-Visitor
September 10, 2014

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?

23-Emerald I
September 10, 2014

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.