Alfred_F

Mr. Alfred Flaßhaar

525 Reputation

11 Badges

1 years, 243 days
Brandenburg, Germany
As a retired individual with degrees from German universities in mathematics/analysis and structural engineering, I spent my professional life in responsible positions in research, teaching, and practical application, working on the mathematical modeling of states and processes in real-world systems. Now I have the time to explore interesting mathematical problems using Maple. It is my professional curiosity that drives me.

MaplePrimes Activity


These are questions asked by Alfred_F

In the attached file, I would like to practice calculating distances between the exact and approximate functions using the "Minimize" function. However, the approach using the integral metric according to (4) produces an error message. I am unable to correct this and would appreciate some advice.test.mw

restart

with(Optimization)

assume(0 <= r and r <= 100*Pi)

"term(a,b,c,d,r):=(exp(sin(r))-(a&lowast;sin(b&lowast;r+c)+d));"

proc (a, b, c, d, r) options operator, arrow, function_assign; exp(sin(r))-a*sin(b*r+c)-d end proc

(1)

Minimize(term(s, t, u, v, r)^2, {-100 <= s, -100 <= t, -100 <= u, -100 <= v})

[0.443734259186819141e-30, [r = HFloat(0.8573907336951694), s = HFloat(1.0651237756780674), t = HFloat(0.9373750940497176), u = HFloat(0.9414213728272717), v = HFloat(1.0810520913486565)]]

(2)

Minimize(abs(term(s, t, u, v, r)), {-100 <= s, -100 <= t, -100 <= u, -100 <= v})

[0.206279437975354085e-12, [r = HFloat(0.8598182185084339), s = HFloat(1.0763500233776817), t = HFloat(0.9650602699090793), u = HFloat(0.9650599306574976), v = HFloat(1.0839652198942415)]]

(3)

"term1(a,b,c,d):=(&int;)[0]^(2&lowast;Pi)(term(a,b,c,d,r))^(2)&DifferentialD;r;"

proc (a, b, c, d) options operator, arrow, function_assign; int(term(a, b, c, d, r)^2, r = 0 .. 2*Pi) end proc

(4)

Minimize(term1(s, t, u, v), {-100 <= s, -100 <= t, -100 <= u, -100 <= v})

Error, (in Optimization:-NLPSolve) integration variable previously assigned, 2nd argument evaluates to 1. = 0 .. 2*Pi

 

NULL

Download test.mw

...and starting values. I want to reproduce the maximum in Maple using the solution structure in the attached file, similar to the old Mathcad method. Instead of using the Euler-Lagrange equation, I want to separately enter the objective function, then the boundary conditions, and finally the starting values ​​for an iteration (as was done in the old Mathcad solution block). I entered the latter into the "maximize" command using the Maple help text. But nothing is being calculated. What am I doing wrong? As I said, I only want a numerically generated approximate solution.test.mw

restart

kernelopts(version)

`Maple 2026.0, X86 64 WINDOWS, Mar 05 2026, Build ID 2001916`

(1)

interface(version)

`Standard Worksheet Interface, Maple 2026.0, Windows 11, March 05 2026 Build ID 2001916`

(2)

with(VariationalCalculus)

[ConjugateEquation, Convex, EulerLagrange, Jacobi, Weierstrass]

(3)

with(plots, implicitplot)

[implicitplot]

(4)

with(Optimization)

 

assume(x >= 0, y(x) >= 0)

"p(a,b,c,x):=a&lowast;x^(2)+b&lowast;x+c;"

proc (a, b, c, x) options operator, arrow, function_assign; a*x^2+b*x+c end proc

(5)

" q(d,f,x):=d&lowast;x^(2)+f&lowast;x;"

proc (d, f, x) options operator, arrow, function_assign; d*x^2+f*x end proc

(6)

"yn(a,b,c,d,f,g,x):=p(a,b,c,x)&lowast;exp(q(d,f,x))+g;"

proc (a, b, c, d, f, g, x) options operator, arrow, function_assign; p(a, b, c, x)*exp(q(d, f, x))+g end proc

(7)

" wn(a,b,c,d,f,g,xend):=(&int;)[0]^(xend)x&lowast;yn(a,b,c,d,f,g,x)&DifferentialD;x;"

proc (a, b, c, d, f, g, xend) options operator, arrow, function_assign; int(x*yn(a, b, c, d, f, g, x), x = 0 .. xend) end proc

(8)

"constr(a,b,c,d,f,g,xend):=(&int;)[0]^(xend)(sqrt(1+((&DifferentialD;)/(&DifferentialD;x)(yn(a,b,c,d,f,g,x)))^(2))-50)&DifferentialD;x=0;"

proc (a, b, c, d, f, g, xend) options operator, arrow, function_assign; int(sqrt(1+(diff(yn(a, b, c, d, f, g, x), x))^2)-50, x = 0 .. xend) = 0 end proc

(9)

 

maximize(wn(a, b, c, d, f, g, xend), constr(a, b, c, d, f, g, xend), initialpoint = {a = -0.2e-1, b = 1.06, c = 0.14e-2, d = 0.46e-3, f = -0.12e-2, g = -0.14e-2, xend = 30})

maximize(-(1/16)*(8*a*xend^2*(-d)^(11/2)*exp(d*xend^2+f*xend)-8*g*xend^2*(-d)^(13/2)+4*a*f*xend*(-d)^(9/2)*exp(d*xend^2+f*xend)+8*b*xend*(-d)^(11/2)*exp(d*xend^2+f*xend)+2*exp(d*xend^2+f*xend)*(-d)^(7/2)*a*f^2+4*b*f*(-d)^(9/2)*exp(d*xend^2+f*xend)+8*c*(-d)^(11/2)*exp(d*xend^2+f*xend)-erf((1/2)*(2*d*xend+f)/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*d^3*a*f^3+2*erf((1/2)*(2*d*xend+f)/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*d^4*b*f^2-4*erf((1/2)*(2*d*xend+f)/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*d^5*c*f+8*a*(-d)^(9/2)*exp(d*xend^2+f*xend)+erf((1/2)*f/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*a*f^3*d^3-2*erf((1/2)*f/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*b*f^2*d^4+4*erf((1/2)*f/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*c*f*d^5-2*a*f^2*(-d)^(7/2)-4*b*f*(-d)^(9/2)-8*c*(-d)^(11/2)+6*erf((1/2)*(2*d*xend+f)/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*d^4*a*f-4*erf((1/2)*(2*d*xend+f)/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*d^5*b-6*erf((1/2)*f/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*a*f*d^4+4*erf((1/2)*f/(-d)^(1/2))*Pi^(1/2)*exp(-(1/4)*f^2/d)*b*d^5-8*a*(-d)^(9/2))/(-d)^(13/2), int((1+((2*a*x+b)*exp(d*x^2+f*x)+(a*x^2+b*x+c)*(2*d*x+f)*exp(d*x^2+f*x))^2)^(1/2)-50, x = 0 .. xend) = 0, initialpoint = {a = -0.2e-1, b = 1.06, c = 0.14e-2, d = 0.46e-3, f = -0.12e-2, g = -0.14e-2, xend = 30})

(10)

 

Download test.mw

With thanks to @sand and @janhardo for their help in solving a variational problem using Maple, I'm presenting a puzzle worth remembering. It was originally published in an IBM competition over 20 years ago under simpler conditions than those presented here, and later posed in a more challenging form in private circles:

A farmer wants to buy a section of a large meadow/pasture for his sheep. He likes a lone, large oak tree on the meadow. This tree is to be the starting and ending point of the fence around the desired section. The fence is exactly 100 meters long. The farmer creates a sketch of the situation. He places the oak tree at the origin of a Cartesian coordinate system with a positive y-axis pointing north and sketches the estimated location of the desired meadow section east of the oak tree. The seller then stipulates that the price per square meter increases linearly eastward by a factor of 1/m³. An agreement is reached, and the farmer now considers the optimal route for the fence to maximize the return on his investment.

The fence route without corners and the value of the purchased meadow must be calculated.

In the attached file, I would like to evaluate the integral according to (16) and the minimum according to (17). I would appreciate your help. The goal is to calculate the coefficients a and b.

Euler_eq.mw

In the attached file test1, two terms are to be compared using the "is" function. Theoretically, these terms are equal. A plot is provided for illustration. However, regardless of which symbol ("equal," "not equal," etc.) is used in "is," the result is always "false." What am I doing wrong?

restart

simplify(exp(u)/(1+exp(u))^2)

exp(u)/(1+exp(u))^2

(1)

is(exp(u)/(1+exp(u))^2 = 1/(4*cosh((1/2)*u)^2))

false

(2)

plot([exp(u)/(1+exp(u))^2, 1/(4*cosh((1/2)*u)^2)], u)

 

NULL

Download test1.mw

1 2 3 4 5 6 7 Last Page 1 of 17