cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Maximize Function

ptc-3308175
1-Newbie

Maximize Function

I am preparing a calculation template for moving load analysis. The template is to calculate the shear, bending moment and deflection as a function of both location of the first load and position along the beam. I am trying to use the maximize function in MathCAD to find the values of these two variables for when the maximum effects are produced in the beam. However, I find that in the case of multiple loads, I get an answer that are slightly off from the true value. In the case of just one load, the function simply returns a value of zero. My suspicion is that the function probably does not go through the list of lal possible values for the two variables properly.

I have attached the MathCAD file in question. The problem arises in the "Summary of Results" section. Any help or suggestion in this regard would be greatly appreciated,

Ali

1 REPLY 1
RichardJ
19-Tanzanite
(To:ptc-3308175)

Ali Peiravian wrote:

My suspicion is that the function probably does not go through the list of lal possible values for the two variables properly.

Maximize does not go through any list of values. It starts at the guess values you give it and iterativey heads towards the maximum of the function. As long as it can find higher values, it keeps going. If it can't find higher values, it stops. It will not search the whole of an infinite space looking for the maximum (which would take an infinte amount if time!). If it runs into a discontinuity that looks like a big cliff it makes no attempt to go to the bottom of the cliff and see if the function gets bigger again. It just stops. If it runs into a big flat plain where the function value does not change it makes no attempt to try and find the other side of the plain to see if the function gets larger. It takes a few steps, says "nothing is changing", and stops.So it does not like discontinuous functions such as yours, and may not converge to a global optimum. If you want to find the real maximum you either need to give it much better guess values than simply (0,0) every time, or write your own maximize function to handle the discontinuities. That's not as hard as it sounds, because your points of discontinuity are known. Find the maximum in each segment, then pick the maximum of those.

Top Tags