file: D:\_j_knuba_2026\jMAXIMA\jh_Job_ex06_v3.wxmx
origin D:\_j_kifnuba_2026\jMAXIMA\jh_Job_ex05_v3.wxmx
data 25.05.2026 22:20

kill(all);

load(draw);

ro:1000;g:9.81;h1:2;B:2;R:1;long_x:4; label_left:2.5; label_vert:1.5; label_URL:0.2;

------------  Center weight z_c  Body presure -----------------

W1_:B*R*h1;W2_:((%pi*R**2)/4)*B,numer;W_:W1_+W2_;

mW1_:0.5*R*W1_;mW2_:0.4244*R*W2_;mW_:mW1_+mW2_;z_c_:mW_/W_;

----------   the end center weight   Body presure  ------

H1:R+h1;

size plot2d - x1

x1:R+long_x;

fy(x):=R-sqrt((R)**2-x**2);

dx:0.1;

ni:10;yi[0]:1;xi[0]:0;yi[1]:0;xi[1]:0;

for i:2 step 1 thru ni do (yi[i]:fy(dx*i),xi[i]:dx*i,display(yi[i]));

draw2d(proportional_axes=xy,
    color = black,
    fill_color = lightblue,
line_width = 2,
polygon([[xi[0],yi[0]],
[xi[1],yi[1]],
[xi[2],yi[2]],
[xi[3],yi[3]],
[xi[4],yi[4]],
[xi[5],yi[5]],
[xi[6],yi[6]],
[xi[7],yi[7]],
[xi[8],yi[8]],
[xi[9],yi[9]],
[xi[10],yi[10]]]),
    polygon([[0,R],
[0,H1],
[R,H1],
[R,R]]),
    color = red,
    line_width = 8,
 /*    explicit(f05(x),x,0,R), 1/4 circle  */
explicit(fy(x),x,0,R) /* 1/4 circle  */)$

set_draw_defaults(
xrange = [0,2],
yrange = [0,4],
    proportional_axes=xy,
line_width=4,color=black,
grid = true,
title = "Step by step plot" )$

 gr2d: points, polygon, rectangle, ellipse, vector, explicit, implicit, parametric and polar.
gr3d: points, explicit, parametric and parametric_surface. 

line_type indicates how lines are displayed; possible values are solid and dots, both available
in all terminals, and dashes, short_dashes, short_long_dashes, short_short_long_dashes,
and dot_dash, which are not available in png, jpg, and gif terminals. 

# P_X

P_X:integrate(ro*g*(H1-h)*B,h,0,R);

mP_X:integrate(ro*g*(H1-h)*B*h,h,0,R);

h_D_:mP_X/P_X;h_D:H1-h_D_;

test P_x standart ----------

h_C:H1-R/2,numer;

p_C:ro*g*h_C;

w:R*B;

P_X_test:p_C*w;

I_0:(B*R**3)/12,numer;

h_D:h_C+(I_0)/(h_C*w);

scale_L:P_X;

scale_P_X:P_X/scale_L;

# P_Z

W1:(((%pi*(R**2))/4))*B,numer;

W2:h1*R*B;

P_Z1:W1*ro*g;P_Z2:W2*ro*g;P_Z1+P_Z2;

W:W1+W2;

P_Z:W*ro*g;

scale_P_Z:P_Z/scale_L;

fi:atan(P_Z/P_X);fi_gr:fi*(180/%pi),numer;

z_c:(0.5*R*W2+0.4244*R*W1)/W;

x_z:z_c/scale_P_Z;

P:sqrt(P_Z**2+P_X**2);scale_P:P/scale_L;

# title = "Сила тиску на криволінійну
поверхню",

# DRAW

size picture  x - x1 & y - H1 

R;h1;H1;x1;h_D_;x_z;scale_P;scale_P_Z;scale_P_X;P;P_X;P_Z;

/* Definition of a block with local variables  */
ds(r) := block([x, n],
    n:100,
  x:r*n,
    x:floor(x),
    x:x/100,
  return(x)
)$

 Pi_X:ds(P_X),numer; Pi_Z:ds(P_Z),numer; Pi:ds(P),numer; fi_gr:ds(fi_gr),numer; hi_D_:ds(h_D_),numer;

xi_z:ds(x_z),numer;

if h1 < 2 then H2:H1+4 else H2:H1;

coordinate on sirfase

fy(x);xi0:1;yi0:1;xi1:x_z;yi1:h_D_;

fyL(x,h_D_,x_z):=R-(h_D_/(x_z))*x;

fyL(0.69,h_D_,x_z);fy(0.69);

fxi(yi,x_z,h_D_):=x_z-(h_D_-yi)*((x_z)/(h_D_));

fyL(0.683,h_D_,x_z);fy(0.683);fxi(fy(0.683),x_z,h_D_);

fyL(x,h_D_,x_z)- Vector; fy(x)- quarta circle

plot2d([fyL(x,h_D_,x_z),fy(x)],[x,0,R]);

n:10;dx:R/n,numer;

x_i:0.1;yiC:fy(x_i),numer;yiL:fyL(x_i,h_D_,x_z),numer;

x_i:dx;yiC:fy(x_i);yiL:fyL(x_i,h_D_,x_z);

x_i:x_i+dx;yiC:fy(x_i);yiL:fyL(x_i,h_D_,x_z);

x_i:x_i+dx;yiC:fy(x_i);yiL:fyL(x_i,h_D_,x_z);

x_i:x_i+dx;yiC:fy(x_i);yiL:fyL(x_i,h_D_,x_z);

x_i:x_i+dx;yiC:fy(x_i);yiL:fyL(x_i,h_D_,x_z);

x_i:x_i+dx;yiC:fy(x_i);yiL:fyL(x_i,h_D_,x_z);

x_i:x_i+dx;yiC:fy(x_i);yiL:fyL(x_i,h_D_,x_z);

coord_x(n,h_D_,x_z,R):=block
([dx,xi,yiC,yiL],
    dx:2*(R-x_z)/n,
    x_i:dx,
    for i:1 step 1 thru n do (yiC:fy(x_i),yiL:fyL(x_i,h_D_,x_z), if yiC>yiL then (x_i:x_i+dx,display
(x_i, yiC,yiL)) else (x_i:x_i,display ("stop"))),
        return (x_i)
);

coord_x(n,h_D_,x_z,R):=block
([dx,xi,yiC,yiL],
    dx:R/n,
    x_i:dx,
    for i:1 step 1 thru n do (yiC:fy(x_i),yiL:fyL(x_i,h_D_,x_z), if yiL>yiC then (x_i:x_i+dx) else (x_i:x_i)),
        return (x_i)
);

h_D_;x_z;R;

X:coord_x(500,h_D_,x_z,R);Y:fyL(X,h_D_,x_z);

X:ds(X),numer; Y:ds(Y),numer; 

n:10;dx:R/n;x_i:dx;

for i:1 step 1 thru n do (yiC:fy(x_i),yiL:fyL(x_i,h_D_,x_z), if yiC>yiL then (x_i:x_i+dx,display
(x_i, yiC,yiL)) else (x_i:x_i,display ("stop")));

for i:1 step 1 thru n do (yiC:fy(x_i),yiL:fyL(x_i,h_D_,x_z), if yiL>yiC then (x_i:x_i+dx,display (x_i, yiC,yiL)) else (x_i:x_i,display ("stop")));

draw2d(
    xrange = [-1,x1], /* size picture  x - x1 & y - H1 */
yrange = [0,H2],
    proportional_axes=xy,
    font      = "Arial",
            font_size = 16,
    grid = true,
    line_width=4,color=black,
title = "Pressure force on a curved surface",
     fill_color = light_blue,
    line_width=2,
polygon([[0,0],[0,H1],[R,H1],[R,0]]), /* rectangle Body of presure */
    fill_color = white,
    line_width=1,
    line_type = dashes,
    polygon([[-0.5*R,0],[0,H1],[0,0],[-0.5*R,0]]), /* rectangle epura of presure P_x */
    fill_color = gray90,
     line_type = solid,
  polygon([[-0.5*R,0],[-0.5*(R-R/H1),R],[0,R],[0,0],[-0.5*R,0]]), /* rectangle epura of presure P_x */
    /* Epura  */
    color = "blue",
    line_width=1,
    line_type = solid,
    head_angle = 10,
    head_length = 0.15,
    vector([-0.5*(R-0.1*R/H1),0.1*R],[0.5*(R-0.1*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.2*R/H1),0.2*R],[0.5*(R-0.2*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.3*R/H1),0.3*R],[0.5*(R-0.3*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.4*R/H1),0.4*R],[0.5*(R-0.4*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.5*R/H1),0.5*R],[0.5*(R-0.5*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.6*R/H1),0.6*R],[0.5*(R-0.6*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.7*R/H1),0.7*R],[0.5*(R-0.7*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.8*R/H1),0.8*R],[0.5*(R-0.8*R/H1),0]), /* horizontal presure vector p  */
    vector([-0.5*(R-0.9*R/H1),0.9*R],[0.5*(R-0.9*R/H1),0]), /* horizontal presure vector p  */
     color=black,
    fill_color = red,
filled_func = true,
    explicit(fy(x),x,0,R), /* 1/4 circle  */
    fill_color = light_blue,
    line_width=1,
    head_angle = 180,
vector([0,R],[R,0]), /* horizontal line between W1 &W2  */
    color = navy,
label(["W1",R-0.35,R-0.15]),
    label(["W2",R/2,H1-0.15]),
    label_orientation = vertical,
color = "#654321",
label(["Body presure",R-0.1,H1-1]),
    color = "black",
 fill_color = light_blue,
    line_width=2,
    head_angle = 15,
    head_length = 0.25,
    color=black,point_type = filled_circle,
   point_size = 2,
   points_joined = false,
points([[0,R]]),
    points([[X,Y]]),
    points([[0,h_D_]]), /* point P_x */
    label_orientation = horizontal,
    label(["P_x",-R+0.5,h_D_+0.2]),
    label_orientation = vertical,
    label(["P_z",x_z-0.2,R+0.9]),
    line_width=1,
    line_type = dashes,
    head_angle = 180,
    vector([-1,h_D_],[3*R,0]), /* horizontal line dot to vector P_x  */
    vector([x_z,R],[0,-R]),  /* vertical line dot to vector P_z  */
    vector([X,Y],[-1.5*R,1.5*scale_P_Z*R]),  /* direct angle line dot to vector P  */
    color = "blue",
    line_width=3,
    line_type = solid,
    head_angle = 15,
    head_length = 0.25,
    vector([-R,h_D_],[+scale_P_X,0]), /* horizontal vector P_x  */
    vector([x_z,R+scale_P_Z],[0,-scale_P_Z]), /* vertical vector P_y  */
    /*  vector([x_z+scale_P_X,h_D_+scale_P_Z],[-scale_P_X,-scale_P_Z]),  Full vector P  */
    vector([X-scale_P_X,Y+scale_P_Z],[+scale_P_X,-scale_P_Z]),  /* Full vector P  */
    font      = "Arial",
            font_size = 16,
   color = "#0e406e",
    label_orientation = horizontal,
    label(["www.k123.org.ua ", x1-long_x/2,H2-label_URL]),
   label(["Kopanytsia Y (c)  2026",  x1-long_x/2,H2-3*label_URL]),
    label_orientation = horizontal,
  /* label([string(P_X), x1-0.8, R/2]) */
    label_alignment = left,
color = black,
    label([concat("Y=: ", string(Y)," m"), x1-label_left, R*1.6]),
    label([concat("X=: ", string(X)," m"), x1-label_left, R*1.4]),
    label([concat("h_D=: ", string(hi_D_)," m"), x1-label_left, R*1.2]),
    label([concat("x_z=: ", string(xi_z)," m"), x1-label_left, R]),
    label([concat("P_x=: ", string(Pi_X)," N"), x1-label_left, R*0.8]),
    label([concat("P_z=: ", string(Pi_Z)," N"), x1-label_left, R*0.6]),
    label([concat("P=: ", string(Pi)," N"), x1-label_left, R*0.4]),
    label([concat("phi=: ", string(fi_gr)," grad"), x1-label_left, R*0.2]),
    line_type = solid,
   color=black,line_width=1,
   head_both = true,
   head_length = 0.2,
   head_angle = 10,
    vector([R+scale_P_X,0],[0,h_D_]), /* h_D_ */
    vector([0,R+0.3],[x_z,0]), /* x_z */
    label_alignment = center,
    label_orientation = vertical,
    font_size = 10,
   label([concat("h_d=: ", string(hi_D_)," m"), R+0.8, h_D_/2]),
    label_orientation = horizontal,
    label([concat("x_z=: ", string(xi_z)," m"), x_z/2,R+0.5])
);