Question: Limiting number of evaluations

Hi

After runing following code, for some amounts of lengths the warning "limiting number of evaluations reached" is appeared (e.g. PD(10,10,10,200)). Also, for some cases like the PD(1,1,5,200), a gap is seen, which is unreasonable.

How the limiting number of evaluations can be increased?

Also, is the gap caused by the bugs or something like that?

# Bending Moment Envelope Curve for Isostatic Two-Span Beam

restart:

with(plots):

with(Optimization):
PD:= proc (L1, L2, L3, N)

local l, R, Y, M, M1, M2, V:

R[1]:= piecewise(x <= L1, (L1-x)/L1, 0):

l[1]:=L1:

l[2]:=L2:

l[3]:=L3:

solve([add(R[i], i = 1 .. 3) = 1, add(R[j]*add(l[i], i = 1 .. j), j = 2 .. 3) = x], [R[2], R[3]]):

R[2]:=rhs(%[1][1]):

R[3]:= rhs(`%%`[1][2]):

M1:=piecewise(y <= add(l[i], i = 1 .. 2), R[1]*y, `and`(add(l[i], i = 1 .. 2) < y, y <= add(l[i], i = 1 .. 3)), R[1]*y+R[2]*(y-add(l[i], i = 1 .. 2))):

M2:=piecewise(y <= x, 0, x-y):

for Y to N do eval(M1+M2, y = Y*add(l[j], j = 1 .. 3)/N):

M[Y]:=Maximize(abs(%),x=0..add(l[j],j=1..3))[1]

end do:

pointplot(`<,>`(seq(i*add(l[j], j = 1 .. 3)/N, i = 1 .. N)), `<,>`(seq(M[i], i = 1 .. N)), color = red, symbol = asterisk):

display(%, axis = [gridlines = [10, color = black]], size = [700, "golden"], axesfont = [Times, 16])

end proc:

Please Wait...