D:\j_Iam_TEMP\_jh\jh_k123_momentForce_v4b.wxmx

~/.maxima/deriv.mac и выполнять в Maxima строку load(deriv)$ deriv(какое-нибудь-выражение);

https://maxima.sourceforge.io/ru/maxima-tarnavsky-6-diff.html

kill(all);

L1-x1,L2-x2,L-x... - coordinates,start with L-x

ro:1000;g:9.81;d_h:1;db:1;dw:d_h*db;

h:[1,2,3,4,5];

for i:1 thru 5 step 1 do (P[i]:ro*g*h[i]*dw,display(P[i]));

P;

P_all:P[1]+P[2]+P[3]+P[4]+P[5];

h_start:0;

mP_all:P[1]*(h[1]-h_start)+P[2]*(h[2]-h_start)+P[3]*(h[3]-h_start)+P[4]*(h[4]-h_start)+P[5]*(h[5]-h_start);

h_all:mP_all/P_all,numer;

digit_floor3(x):=block([digit_all,digit_3],
   digit_all:x*1000,
    digit_3:(floor(digit_all))/1000,
   return (digit_3));

h_all:digit_floor3(h_all),numer;

label_h_all:sconcat(h_all);

fstr3(sW,sS,sU):=block([l,eqq,w,u,my_string],
    l:sconcat(sS),
    eqq:sconcat("="),
    w:string(sW),
    u:concat(sU),
   my_string:concat(l,eqq,w,u),
return (my_string));

sW:[P[1],P[2],P[3],P[4],P[5],P_all,h[1],h[2],h[3],h[4],h[5],h_all];

sS:['P1,'P2,'P3,'P4,'P5,'P_all,'h1,'h2,'h3,'h4,'h5,'h_all];

sU:['N,'N,'N,'N,'N,'N,'m,'m,'m,'m,'m,'m];

text_string:fstr3(sW[12],sS[12],sU[12]);

/* fstr_sum(sW,sS,sU,G1,G2):=block([name,eqq,plus,w,u,g1,g2,my_string],
    name:sconcat(sS),
    eqq:sconcat("="),
    plus:sconcat("+"),
    w:string(sW),
    u:concat(sU),
    g1:G1,
    g2:G2,
   my_string:concat(name,eqq,g1,u,plus,g2,u,eqq,w,u),
return (my_string));  */;

/* fstr_sum(sW[3],sS[3],sU[3],G1,G2);  */;

del1:0.5;

size1:d_h;n:5;x_axis:n+4;y_axis:n+3;

 draw2d(xrange = [h_start-1,x_axis],
yrange = [-1,y_axis],
  font      = "Arial",
           font_size = 30,
title="jh_k123_momentForce_v3-4b.wxmx",
  grid = true,
  proportional_axes=xy,
line_width=1,color=black,
   fill_color = "#DDDDFF",
    rectangle([-size1/2+h[1],5],[size1/2+h[1],5-size1]),
    rectangle([-size1/2+h[2],5],[size1/2+h[2],5-(size1*2)]),
    rectangle([-size1/2+h[3],5],[size1/2+h[3],5-(size1*3)]),
    rectangle([-size1/2+h[4],5],[size1/2+h[4],5-(size1*4)]),
    rectangle([-size1/2+h[5],5],[size1/2+h[5],5-(size1*5)]),
    points_joined = false,
    color=red,
   point_size=1,
   line_width=1.3,
   line_type = solid,
point_type = filled_circle,
points([[h[1],5],[h[2],5],[h[3],5],[h[4],5],[h[5],5]]),
    /* axis */
    line_type = solid,
   color=black,line_width=1,
   head_both = false,
   head_length = 0.4,
   head_angle = 10,
vector([0,0],[0,8]),
    vector([0,0],[7,0]),
    label(["h[m]",x_axis-3*del1,0-del1]), 
    label(["P[N]",0-del1,y_axis-del1]), 
    color=red,
    vector([h[1],5],[0,-1]),
    vector([h[2],5],[0,-2]),
    vector([h[3],5],[0,-3]),
    vector([h[4],5],[0,-4]),
    vector([h[5],5],[0,-5]),
    label([fstr3(sW[1],sS[1],sU[1]),h[1],n-size1-del1]),
    label([fstr3(sW[2],sS[2],sU[2]),h[2],n-size1*2-del1]),
    label([fstr3(sW[3],sS[3],sU[3]),h[3],n-size1*3-del1]),
    label([fstr3(sW[4],sS[4],sU[4]),h[4],n-size1*4-del1]),
    label([fstr3(sW[5],sS[5],sU[5]),h[5],n-size1*5-del1]),
     color=blue,
    vector([0,n+del1],[h[1],0]),
    vector([0,n+del1*2],[h[2],0]),
    vector([0,n+del1*3],[h[3],0]),
    vector([0,n+del1*4],[h[4],0]),
    vector([0,n+del1*5],[h[5],0]),
    color=blue,
    label([fstr3(sW[7],sS[7],sU[7]),h[1],n+1.5*del1]),
    label([fstr3(sW[8],sS[8],sU[8]),h[2],n+2.5*del1]),
    label([fstr3(sW[9],sS[9],sU[9]),h[3],n+3.5*del1]),
    label([fstr3(sW[10],sS[10],sU[10]),h[4],n+4.5*del1]),
    label([fstr3(sW[11],sS[11],sU[11]),h[5],n+5.5*del1]),
    color=black,
    head_both = true,
    vector([0,n+del1/2],[h_all,0]),
    label([fstr3(sW[12],sS[12],sU[12]),h_all,n+del1]),
    head_both = false,
    line_width=4,
    vector([h_all,n],[0,-2]), 
    label([fstr3(sW[6],sS[6],sU[6]),n+del1,n-1-del1]),
    points_joined = false,
   point_size=1.5,
   line_width=1.3,
   line_type = solid,
point_type = filled_circle,
points([[h_all,5]]),
/*      GPL */
font      = "Arial",
           font_size = 16,
  color = "#0e406e",
label_orientation = 'vertical,
label(["www.k123.org.ua ",n+2.5,n/2]),
  label(["Kopanytsia Y (c)  2025",n+3.5,n/2])
   )$ 

# TEST

P_test:integrate(ro*g*(n-hi)*db,hi,0,n);

mP_test:integrate(ro*g*((n-hi)**2)*db,hi,0,n);

h_D:mP_test/P_test;

Pi(hi,i):=ro*g*(n-dhii*i)*db*dhii;

sum_P:0; nn:5;dhii:n/nn;

for i:0 step 1 thru nn do (dP:Pi(dhii,i),sum_P:sum_P+dP);

sum_P;

# Simple

kill(all);

P:[1.1,2.5,3.4,4.7,6.3];P_max:0;n:5;

for i:1 thru n step 1 do (if P_max< P[i] then P_max: P[i] else P_max: P_max);

P_max;

h:[1,2,3,4,5];dh:1;h_start:5;x_axis:h_start+dh;y_axis:P_max;n:5;size1:1;del1:1;

digit_floor3(x):=block([digit_all,digit_3],
   digit_all:x*1000,
    digit_3:(floor(digit_all))/1000,
   return (digit_3));

fstr3(sW,sS,sU):=block([l,eqq,w,u,my_string],
    l:sconcat(sS),
    eqq:sconcat("="),
    w:string(sW),
    u:concat(sU),
   my_string:concat(l,eqq,w,u),
return (my_string));

NM_k123(P,h,n):=block([P_all,mP,i,N,h_all,Result],
    N:n,
    P_all:0,
    mP:0,
    for i:1 thru N step 1 do (P_all:P_all+P[i],mP:mP+P[i]*h[i]),
    h_all:mP/P_all,
    Result:[P_all,h_all],
return (Result));

D:NM_k123(P,h,n);P_all:D[1],numer;h_all:digit_floor3(D[2]),numer;

P_all:P[1]+P[2]+P[3]+P[4]+P[5];

mP:P[1]*h[1]+P[2]*h[2]+P[3]*h[3]+P[4]*h[4]+P[5]*h[5];

h_all:digit_floor3(mP/P_all),numer;

sW:[P[1],P[2],P[3],P[4],P[5],P_all,h[1],h[2],h[3],h[4],h[5],h_all];

sS:['P1,'P2,'P3,'P4,'P5,'P_all,'h1,'h2,'h3,'h4,'h5,'h_all];

sU:['N,'N,'N,'N,'N,'N,'m,'m,'m,'m,'m,'m];

 draw2d(xrange = [-del1,x_axis+3*del1],
yrange = [-del1,y_axis+3*del1],
  font      = "Arial",
           font_size = 30,
title="jh_k123_momentForce_v4b.wxmx",
  grid = true,
  proportional_axes=xy,
line_width=1,color=black,
   fill_color = "#DDDDFF",
    rectangle([-size1/2+h[1],y_axis],[size1/2+h[1],y_axis-size1*P[1]]),
    rectangle([-size1/2+h[2],y_axis],[size1/2+h[2],y_axis-(size1*P[2])]),
    rectangle([-size1/2+h[3],y_axis],[size1/2+h[3],y_axis-(size1*P[3])]),
    rectangle([-size1/2+h[4],y_axis],[size1/2+h[4],y_axis-(size1*P[4])]),
    rectangle([-size1/2+h[5],y_axis],[size1/2+h[5],y_axis-(size1*P[5])]),
    points_joined = false,
    color=red,
   point_size=1,
   line_width=1.3,
   line_type = solid,
    /* point_type [bullet, circle, plus, times, asterisk, box, square, triangle, delta, wedge, nabla, diamond, lozenge],  */
    point_type = filled_down_triangle,
/* point_type = filled_circle,  */
points([[h[1],y_axis],[h[2],y_axis],[h[3],y_axis],[h[4],y_axis],[h[5],y_axis]]),
    /* start points */
    points_joined = true,
    color=black,
   point_size=0.1,
   line_width=1,
   line_type = solid,
    points([[h[1],y_axis],[h[1],y_axis+del1/2]]),
    points([[h[2],y_axis],[h[2],y_axis+del1]]),
    points([[h[3],y_axis],[h[3],y_axis+del1*1.5]]),
    points([[h[4],y_axis],[h[4],y_axis+del1*2]]),
    points([[h[5],y_axis],[h[5],y_axis+del1*2.5]]),
    /* the end start points */
    point_size=2,
    point_type =  filled_down_triangle,
    points([[0,y_axis]]),
    point_type = filled_down_triangle,
    color=black,
    points([[h_all,y_axis]]),
     head_both = false,
    head_length = 0.4,
   head_angle = 10,
     line_width=2,
    vector([h_all,y_axis],[0,-y_axis/2]),
    /* h_all ?  */
    head_both = true,
    line_width=1,
    vector([0,y_axis/2+del1],[h_all,0]),
    label(["h-?",h_all/2,y_axis/2+del1/2]),
    label(["P-?",h_all+del1/2,y_axis/2+del1/2]),
 /*    axis */
    line_type = solid,
   color=black,
    line_width=1,
   head_both = false,
   head_length = 0.4,
   head_angle = 10,
vector([0,0],[0,y_axis+3*del1]),
    vector([0,0],[x_axis,0]),
    label(["h[m]",x_axis/2,-0.5*del1]), 
    label(["P[N]",0-del1/3,y_axis+2.5*del1]), 
    color=red,
   /*    vector([h[1],5],[0,-1]),
    vector([h[2],5],[0,-2]),
    vector([h[3],5],[0,-3]),
    vector([h[4],5],[0,-4]),
    vector([h[5],5],[0,-5]),   */
    label([concat(P[1]),h[1],y_axis-size1/2]),
    label([concat(P[2]),h[2],y_axis-size1/2]),
    label([concat(P[3]),h[3],y_axis-size1/2]),
    label([concat(P[4]),h[4],y_axis-size1/2]),
    label([concat(P[5]),h[5],y_axis-size1/2]),
    color=black,
    head_both = true,
    line_width=0.5,
    vector([0,y_axis+del1/2],[h[1],0]),
    vector([0,y_axis+del1],[h[2],0]),
    vector([0,y_axis+del1*1.5],[h[3],0]),
    vector([0,y_axis+del1*2],[h[4],0]),
    vector([0,y_axis+del1*2.5],[h[5],0]),
    label([concat(h[1]),h[1]-del1/2,y_axis+del1/2]),
    label([concat(h[2]),h[2]-del1,y_axis+del1]),
    label([concat(h[3]),h[3]-del1,y_axis+del1*1.5]),
    label([concat(h[4]),h[4]-del1,y_axis+2*del1]),
    label([concat(h[5]),h[5]-del1,y_axis+2.5*del1]),
/*     color=black,
    head_both = true,
    vector([0,n+del1/2],[h_all,0]),
    label([fstr3(sW[12],sS[12],sU[12]),h_all,n+del1]),
    head_both = false,
    line_width=4,
    vector([h_all,n],[0,-2]), 
    label([fstr3(sW[6],sS[6],sU[6]),n+del1,n-1-del1]),
    points_joined = false,
   point_size=1.5,
   line_width=1.3,
   line_type = solid,
point_type = filled_circle,
points([[h_all,5]]),
    GPL */
font      = "Arial",
           font_size = 16,
  color = "#0e406e",
label_orientation = 'vertical,
label(["www.k123.org.ua ",x_axis+2*del1,y_axis/2]),
  label(["Kopanytsia Y (c)  2025",x_axis+2.5*del1,n/2])
   )$ 

Answer

 draw2d(xrange = [-del1,x_axis+3*del1],
yrange = [-del1,y_axis+3*del1],
  font      = "Arial",
           font_size = 30,
title="jh_k123_momentForce_v4b.wxmx",
  grid = true,
  proportional_axes=xy,
line_width=1,color=black,
   fill_color = "#DDDDFF",
    rectangle([-size1/2+h[1],y_axis],[size1/2+h[1],y_axis-size1*P[1]]),
    rectangle([-size1/2+h[2],y_axis],[size1/2+h[2],y_axis-(size1*P[2])]),
    rectangle([-size1/2+h[3],y_axis],[size1/2+h[3],y_axis-(size1*P[3])]),
    rectangle([-size1/2+h[4],y_axis],[size1/2+h[4],y_axis-(size1*P[4])]),
    rectangle([-size1/2+h[5],y_axis],[size1/2+h[5],y_axis-(size1*P[5])]),
    points_joined = false,
    color=red,
   point_size=1,
   line_width=1.3,
   line_type = solid,
    /* point_type [bullet, circle, plus, times, asterisk, box, square, triangle, delta, wedge, nabla, diamond, lozenge],  */
    point_type = filled_down_triangle,
/* point_type = filled_circle,  */
points([[h[1],y_axis],[h[2],y_axis],[h[3],y_axis],[h[4],y_axis],[h[5],y_axis]]),
    /* start points */
    points_joined = true,
    color=black,
   point_size=0.1,
   line_width=1,
   line_type = solid,
    points([[h[1],y_axis],[h[1],y_axis+del1/2]]),
    points([[h[2],y_axis],[h[2],y_axis+del1]]),
    points([[h[3],y_axis],[h[3],y_axis+del1*1.5]]),
    points([[h[4],y_axis],[h[4],y_axis+del1*2]]),
    points([[h[5],y_axis],[h[5],y_axis+del1*2.5]]),
    /* the end start points */
    point_size=2,
    point_type =  filled_down_triangle,
    points([[0,y_axis]]),
    point_type = filled_down_triangle,
    color=black,
    points([[h_all,y_axis]]),
/*     head_both = false,
    head_length = 0.4,
   head_angle = 10,
     line_width=2,
    vector([h_all,y_axis],[0,-y_axis/2]),
     h_all ?  
    head_both = true,
    line_width=1,
    vector([0,y_axis/2+del1],[h_all,0]),
    label(["h-?",h_all/2,y_axis/2+del1/2]),
    label(["P-?",h_all+del1/2,y_axis/2+del1/2]),  */
 /*    axis */
    line_type = solid,
   color=black,
    line_width=1,
   head_both = false,
   head_length = 0.4,
   head_angle = 10,
vector([0,0],[0,y_axis+3*del1]),
    vector([0,0],[x_axis,0]),
    label(["h[m]",x_axis/2,-0.5*del1]), 
    label(["P[N]",0-del1/3,y_axis+2.5*del1]), 
    color=red,
   /*    vector([h[1],5],[0,-1]),
    vector([h[2],5],[0,-2]),
    vector([h[3],5],[0,-3]),
    vector([h[4],5],[0,-4]),
    vector([h[5],5],[0,-5]),   */
    label([concat(P[1]),h[1],y_axis-size1/2]),
    label([concat(P[2]),h[2],y_axis-size1/2]),
    label([concat(P[3]),h[3],y_axis-size1/2]),
    label([concat(P[4]),h[4],y_axis-size1/2]),
    label([concat(P[5]),h[5],y_axis-size1/2]),
    color=black,
    head_both = true,
    line_width=0.5,
    vector([0,y_axis+del1/2],[h[1],0]),
    vector([0,y_axis+del1],[h[2],0]),
    vector([0,y_axis+del1*1.5],[h[3],0]),
    vector([0,y_axis+del1*2],[h[4],0]),
    vector([0,y_axis+del1*2.5],[h[5],0]),
    label([concat(h[1]),h[1]-del1/2,y_axis+del1/2]),
    label([concat(h[2]),h[2]-del1,y_axis+del1]),
    label([concat(h[3]),h[3]-del1,y_axis+del1*1.5]),
    label([concat(h[4]),h[4]-del1,y_axis+2*del1]),
    label([concat(h[5]),h[5]-del1,y_axis+2.5*del1]),
    /*  answer  */
     color=blue,
    head_both = true,
    vector([0,y_axis/3],[h_all,0]),
    label([fstr3(sW[12],sS[12],sU[12]),h_all/2,y_axis/3+del1/2]),
    head_both = false,
    line_width=4,
    vector([h_all,y_axis],[0,-y_axis*(4/5)]), 
    label([fstr3(sW[6],sS[6],sU[6]),h_all+1.5*del1,y_axis*(2/5)]),
    points_joined = false,
   point_size=1.5,
   line_width=1.3,
   line_type = solid,
point_type = filled_circle,
points([[h_all,y_axis]]),
/*    GPL */
font      = "Arial",
           font_size = 16,
  color = "#0e406e",
label_orientation = 'vertical,
label(["www.k123.org.ua ",x_axis+2*del1,y_axis/2]),
  label(["Kopanytsia Y (c)  2025",x_axis+2.5*del1,n/2])
   )$ 

# Variants 2

kill(all);

G1:1;G2:6;L1:0;L2:8;G:G1+G2;L:13; n:L+1;

mG1:(L-L1)*G1;mG2:(L-L2)*G2;

L3:(mG1+mG2)/G,numer;

label_L:sconcat(L3);

fL(L1,L2,G1,G2):=((L-L1)*G1+(L-L2)*G2)/(G1+G2);

fL((L1),(L2),G1,G2),numer;

size1:sqrt(G1),numer;size2:sqrt(G2),numer;

del1:0.5;

draw2d(xrange = [-2,14],
yrange = [-5,6],
  font      = "Arial",
           font_size = 30,
title="jh_k123_momentForce.wxmx",
  grid = true,
  proportional_axes=xy,
line_width=4,color=black,
   fill_color = "#eeeeee",
rectangle([-size1/2+L1,-size1/2+L1],[size1/2+L1,size1/2+L1]),
    rectangle([-size2/2+L2,-size2/2],[size2/2+L2,size2/2]),
     points_joined = false,
    color=red,
   point_size=1,
   line_width=1.3,
   line_type = solid,
point_type = filled_circle,
points([[L1,0],[L2,0],[L,0],[L,4]]),
    label(["G1=+1",L1,-size1/2-del1]),
     label(["G2=+6",L2,-size2/2-del1]),
     points_joined = true,
   point_size=0.1,
   line_width=1.3,
   line_type = solid,
points([[L1,0],[L1,4],[L2,4],[L2,0],[L2,4],[L,4],[L,0]]),
     line_type = solid,
   color=black,line_width=1,
   head_both = true,
   head_length = 0.4,
   head_angle = 10,
vector([L1,-4],[(L-L1),0]),
    label(["L1",(L-L1)/2,-4+del1/2]),
    vector([L2,-3],[(L-L2),0]),
    label(["L2",(L-L2)/2+L2,-3+del1/2]),
    color=red,
    vector([L,3],[(L-L),0]),
    label(["L=?",(L-L)/2+L,3+del1]),
    head_both = false,
     vector([L,4],[0,3*del1]),
    label(["G=G1+G2",L,4.5]),
   /*     GPL */
font      = "Arial",
           font_size = 16,
  color = "#0e406e",
label_orientation = 'vertical,
label(["www.k123.org.ua ",n+1,n/2]),
  label(["Kopanytsia Y (c)  2025",n+2,n/2])
   )$ 

L1;L2;L;

kill(all);

G1:1;G2:6;L1:0.5;L2:8.9;G:G1+G2;L:-1;

mG1:(L1+L)*G1;mG2:(L2+L)*G2;

L3:(mG1+mG2)/G,numer;

fL(L1,L2,G1,G2):=(L1*G1+L2*G2)/(G1+G2);

fL((L-L1),(L-L2),G1,G2),numer;

size1:sqrt(G1),numer;size2:sqrt(G2),numer;

del1:0.5;

draw2d(xrange = [-2,14],
yrange = [-5,6],
  font      = "Arial",
           font_size = 30,
title="jh_k123_momentForce.wxmx",
  grid = true,
  proportional_axes=xy,
line_width=4,color=black,
   fill_color = "#eeeeee",
rectangle([-size1/2+L1,-size1/2+L1],[size1/2+L1,size1/2+L1]),
    rectangle([-size2/2+L2,-size2/2],[size2/2+L2,size2/2]),
     points_joined = false,
    color=red,
   point_size=1,
   line_width=1.3,
   line_type = solid,
point_type = filled_circle,
points([[L1,0],[L2,0],[L,0],[L3,4]]),
    label(["G1=+1",L1,-size1/2-del1]),
     label(["G2=+6",L2,-size2/2-del1]),
     points_joined = true,
   point_size=0.1,
   line_width=1.3,
   line_type = solid,
points([[L1,0],[L1,4],[L2,4],[L2,0],[L2,4],[L,4],[L,0]]),
     line_type = solid,
   color=black,line_width=1,
   head_both = true,
   head_length = 0.4,
   head_angle = 10,
vector([L1,-4],[(L-L1),0]),
    label(["L1",(L-L1)/2,-4+del1/2]),
    vector([L2,-3],[(L-L2),0]),
    label(["L2",(L-L2)/2+L2,-3+del1/2]),
    color=red,
    vector([L3,3],[(L-L3),0]),
    label(["L3=?",(L-L3)/2+L3,3+del1]),
    head_both = false,
     vector([L3,4],[0,3*del1]),
    label(["G=G1+G2",L3,4.5]),
      /*  GPL */
font      = "Arial",
           font_size = 16,
  color = "#0e406e",
label_orientation = 'vertical,
label(["www.k123.org.ua ",12,1.3]),
  label(["Kopanytsia Y (c)  2025",12.5,1.3])
   )$ 