file D:\_j_knuba_2026\jMAXIMA\jh_Job_ex08a_v6.wxmx

TEST OBJECT OF single operations of the K123

/* add size h_D and coordinate X,Y for cross P_x & P_z  */

Умова. Визначити параметри вектору сили гідростатичного тиску на двосегментну ламану поверхню "STU". Нахилена під кутом до горизонту
прямокутний елемент поверхні "ST" із висотою  H=3м та шириною поверхні B=1м. Вертикальний сегмент поверхні "TU" висотою h1=4м.
Координати нахиленого сегменту поверхні:  нижня грань поверхні (x0=1, y0=1), координати верхньої грані (x1=5, y1=4). Координата верхньої грані
вертикального сегменту (x2=5, y2=8). Висота вертикальної проекції поверхні "SUx" дорівнює різниці координат y2-y0=7.
Тиск на вільній поверхні рідини атмосферний.
Визначити величини горизонтальної та ветрикальної проекцій вектору сумарної сили гідростатичного тиску. Визначити величину сумарного
вектору сили тиску. Побудувати епюру вертикальної проекції сили тиску, показати об'єм тела тиску, розрахувати  та позначити координату
центру тиску (крапка D, координати (X,Y)).

kill(all);

load("draw")$

fileName:"jh_Job_ex08a_v7.wxmx";

x_right:9; label_left:3; label_vert:1.5; label_URL:0.2; delta_x:4;

ro:1000;g:9.81;x0:1;y0:1;x1:x0+delta_x;y1:4;B:1;h1:0;y2:y1+h1;x2:x1;

Hall:y1−y0+h1;H:y1−y0+h1;Hwater:y1+h1;

# VARIANT # 1 (standart)

# P_x

alpha:atan((y1-y0)/(x1-x0)),numer;grad_alpha:(180/%pi)*alpha,numer;

h_C_x:(Hall/2);w_x:Hall*B;I:(B*Hall**3)/12,numer;

p_c:ro*g*h_C_x;

P_x:p_c*w_x;

h_D:h_C_x+(I)/(h_C_x*w_x),numer;h_D_x:Hall-h_D+y0;

# P_z

W1:(((x1-x0)*(y1-y0))/2)*B; 

W2:((x1-x0)*(h1))*B; 

W:W1+W2;

P_z:(W)*ro*g;

P:sqrt(P_x**2+P_z**2);

phi:atan(P_z/P_x),numer;grad_phi:(180/%pi)*phi,numer;

size plot2d - x1

x1_:x1+x_right;

scale

scale_L:P_x;scale_P_x:P_x/scale_L;scale_P_z:P_z/scale_L,numer;scale_P:P/scale_L,numer;

Draw

h1;Hall;Hwater;H;x1;h_D_x;h_D;scale_P_x;scale_P_z;scale_P_x;P;P_x;P_z;

Coordinate X, Y 

W1:(((x1-x0)*(y1-y0))/2)*B;mW1:W1*((1/3)*(x1-x0)+x0);

W2:(((x1-x0)*h1))*B;mW2:W2*(0.5*(x1-x0)+x0);

X:(mW1+mW2)/(W1+W2),numer;

P1:(((y1-y0+h1)/2)*ro*g)*((y1-y0+h1)*B);mP1:P1*(((y1-y0+h1)*(1/3)));

P2:(((h1)/2)*ro*g)*((h1)*B);mP2:P2*(Hall-(2/3*h1));

Y:(mP1-mP2)/(P1-P2);Y:h_D_x;

/*   X:x0+(x1-x0)/3; Y:h_D_x;  h1:0  */;

/* 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)
)$

h_C_x:ds(h_C_x),numer; w_x:ds(w_x),numer; I:ds(I),numer; hi_D:ds(h_D),numer; p_c:ds(p_c),numer;

P_x:ds(P_x),numer; P_z:ds(P_z),numer; P:ds(P),numer; hi_D_x:ds(h_D_x),numer;

alpha_:ds(grad_alpha),numer; phi_:ds(grad_phi),numer; 

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

H2:y1+h1+3;

epura

b:(2/Hall)*(Hall-0.1*y1);

-(2/Hall)*(Hall-1*y1);y1;

if h1 < 7 then Hall_add:Hall+7 else Hall_add:Hall;

if y0 > 1 then y_bottom:0 else y_bottom:-1;

x1_;Hall;Hall_add;x_left:2;

x1_;

Coordinate phi

Xi:X-scale_P_x; Yi:Y+scale_P_z;

(scale_P_z/scale_P_x)=(y-Y)/(X-x);

(X-x)*(scale_P_z/scale_P_x)+Y=y;

fyP(scale_P_z,scale_P_x,X,Y,x):=(X-x)*(scale_P_z/scale_P_x)+Y;  /* Vector  */

X;Y;

fyP(scale_P_z,scale_P_x,X,Y,2.5);

(y1−y0)/(x1−x0)=(y1−y)/(x1−x);

(x1−x)*((y1−y0)/(x1−x0))=y1−y;

y=y1−(x1−x)*((y1−y0)/(x1−x0));

fyL(x0,x1,y0,y1,x):=y1−(x1−x)*((y1−y0)/(x1−x0));  /* Flat line  */

fyL(x0,x1,y0,y1,1.7),numer;

Coordinates

coord_x(n,x0,x1,y0,y1,scale_P_z,scale_P_x,X,Y):=block
([dx,xi,yiC,yiL],
   dx:(x1-x0)/n,
   x_i:x0+dx,
   for i:1 step 1 thru n do (yiL:fyL(x0,x1,y0,y1,x_i),yiP:fyP(scale_P_z,scale_P_x,X,Y,x_i), if yiP>yiL then (x_i:x_i+dx) else (x_i:x_i)),
       return (x_i)
);

X_P:coord_x(100,x0,x1,y0,y1,scale_P_z,scale_P_x,X,Y),numer;

Y_P:fyL(x0,x1,y0,y1,X_P);

X_P:ds(X_P),numer; Y_P:ds(Y_P),numer; 

Draw of the Triangle

y0;y1;y2;x0;x1;x2;H;

draw2d(
    xrange = [-x_left,x1_], /* size picture  x - x1 & y - H1 */
yrange = [y_bottom,Hall_add],
    proportional_axes=xy,
    font      = "Arial",
    font_size = 12,
    grid = true,
    line_width=1,
    color=black,
title = "TEST OBJECT OF single operations of the K123",
      color=red,
     label_orientation = horizontal,
 label(["S",x0-0.4,y0-0.3]),/* point S */
    label(["T",x1+0.4,y1-0.3]),/* point T */
    label(["U",x2+0.4,y2+0.3]),/* point U */
    label(["U_x",x0+0.4,y2+0.4]),/* point U1 */
    line_width=1,
    color=black,
     line_type = dashes, 
    points_joined = true,
     fill_color = "#ddddee",
      polygon([[x0,y0],[x1,y1],[x1,Hwater],[x0,Hwater],[x0,y0]]), /* W  body of presure P_z */
       line_width=10,
       line_type = solid,
    points_joined = true,
    color=black,
    points([[x0,y0],[x0,y2]]), /* VERTICAL reflect of inclined flat surface  for P_x */
    color=red,
    line_width=10,
       line_type = solid,
    points_joined = true,
    points([[x0,y0],[x1,y1],[x1,y2]]), /* inclined flat surface */
    line_width=1,
    color=green,
    point_type = filled_circle,
   point_size = 1.5,
   points_joined = false,
      points([[x0,y0],[x0,y2]]), /*  Points of inclined flat surface  for P_x */
    color=green,
    points([[x0,y0],[x1,y1],[x2,y2]]),
    line_width=1,
    color=black,
     line_type = dashes, 
    points_joined = true,
     fill_color = white,
      polygon([[-2,y0],[0,Hall],[0,y0],[-2,y0]]), /*  Contour all Epura  for P_x */
   line_width=4,
       line_type = solid,
    points_joined = true,
    color=red,
    points([[x0,y0],[x1,y1],[x2,Hwater]]),/* inclined flat surface */
    line_width=1,
    color=black,
     line_type = dashes, 
    points_joined = true,
     fill_color = white,
      polygon([[-2,y0],[0,Hall+y0],[0,y0],[-2,y0]]), /* rectangle epura of presure P_x */
    fill_color = "#ddddee",
     line_type = solid,
      polygon([[-2,y0],[0,y2],[0,y0],[-2,y0]]), /* rectangle epura of presure P_x */
     /* Epura  */
    color = "blue",
    line_width=1,
    line_type = solid,
    head_angle = 10,
    head_length = 0.15,
    vector([-(2/Hall)*(Hall-0.1*H),0.1*H+y0],[(2/Hall)*(Hall-0.1*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.2*H),0.2*H+y0],[(2/Hall)*(Hall-0.2*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.3*H),0.3*H+y0],[(2/Hall)*(Hall-0.3*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.4*H),0.4*H+y0],[(2/Hall)*(Hall-0.4*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.5*H),0.5*H+y0],[(2/Hall)*(Hall-0.5*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.6*H),0.6*H+y0],[(2/Hall)*(Hall-0.6*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.7*H),0.7*H+y0],[(2/Hall)*(Hall-0.7*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.8*H),0.8*H+y0],[(2/Hall)*(Hall-0.8*H),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.9*H),0.9*H+y0],[(2/Hall)*(Hall-0.9*H),0]),/* horizontal presure vector p  */ 
    color = "black",
 fill_color = light_blue,
    line_width=2,
    head_angle = 15,
    head_length = 0.25,
    color=red,
    point_type = filled_circle,
   point_size = 1.5,
   points_joined = false,
   points([[x0,h_D_x]]), /*  point D_{x} on vertical  reflect */
    color=blue,
     label_orientation = horizontal,
 label(["P_x",X-0.8,Y+0.4]),/* point P_x */
 line_width=1,
    line_type = dashes,
    head_angle = 180,
    vector([-2,Y],[3*y1,0]), /* horizontal line dot to vector P  */
    color = "blue",
    line_width=3,
    line_type = solid,
    head_angle = 15,
    head_length = 0.25,
    vector([X-scale_P_x,Y],[+scale_P_x,0]),  /* horizontal vector P_x  */  
    label_orientation = horizontal,
    label_alignment = left,
    /*   Input data   */
    color = "#0e406e",
    label([concat("file:", string(fileName)), x0, Hall_add-1.5]),
    label([concat("x0=", string(x0)), x0, Hall_add-2]),
    label([concat("y0=", string(y0)), x0, Hall_add-2.5]),
    label([concat("x1=", string(x1)), x0, Hall_add-3.0]),
    label([concat("y1=", string(y1)), x0, Hall_add-3.5]),
    label([concat("alpfa=", string(alpha_)), x0, Hall_add-4.0]),
    label([concat("phi=", string(phi_)), x0, Hall_add-4.5]),
    label([concat("h_{1}=: ", string(h1)," m"), x0, Hall_add-5]),
color = black,
         label([concat("h_{C_{x}}=: ", string(h_C_x)," m"), x1_-label_left, y1*2.2]),
    label([concat("w_{x}=: ", string(w_x)," m"), x1_-label_left, y1*2]),
    label([concat("p_{c}=: ", string(p_c)," Pa"), x1_-label_left, y1*1.8]),
    label([concat("I=: ", string(I)," m"), x1_-label_left, y1*1.6]),
     label([concat("h_D=: ", string(hi_D)," m"), x1_-label_left, y1*1.4]),
     label([concat("h_D_{coord}=: ", string(hi_D_x)," m"), x1_-label_left, y1*1.2]),
    label([concat("P_{x}=: ", string(P_x)," N"), x1_-label_left, y1*1]),
     label([concat("P_{z}=: ", string(P_z)," N"), x1_-label_left, y1*0.8]),
    color=red,
    label([concat("P=: ", string(P)," N"), x1_-label_left, y1*0.6]),
    label([concat("X_{P}=: ", string(X_P)," m"), x1_-label_left, y1*0.4]),
    label([concat("Y_{P}=: ", string(Y_P)," m"), x1_-label_left, y1*0.2]),
   line_type = solid,
   color=black,
    line_width=1,
   head_both = true,
   head_length = 0.2,
   head_angle = 10,
    vector([x1+scale_P_x+0.1,0],[0,h_D_x]),/* h_D_x */ 
    label_alignment = center,
    label_orientation = vertical,
    font_size = 8,
 label([concat("h_{D_{crd}}=: ", string(hi_D_x)," m"), x1+0.7, h_D_x*0.6]),   /* Input data */
     vector([x1+scale_P_x+0.1,Y],[0,Hwater-Y]),/* h_D */ 
    label_alignment = center,
    label_orientation = vertical,
    font_size = 8,
 label([concat("h_{D}=: ", string(hi_D)," m"), x1+0.7, Y+(Hwater-Y)/2]),   /* Input data */
  line_type = solid,
   color=blue,
    line_width=4,
    head_angle = 180,
   vector([-x_left,Hwater],[x1+x_left,0]),  /* horizontal line dot to vector P_x  */
    line_width=1,
    line_type = dashes,
    head_angle = 180,
    vector([x0,y1],[x1+x_left,0]), /* horizontal line dot size H  */
    line_type = solid,
   color=black,
    line_width=1,
    line_type = solid,
   head_both = true,
   head_length = 0.2,
   head_angle = 10,
    vector([x1+1.5*x_left-0.2,y0],[0,y1-y0]),  /*  vertical line size H */
    vector([x1+1.5*x_left-0.2,y1],[0,h1]),  /* vertical line size h1 */
    vector([x1+2*x_left-0.2,y0],[0,Hall]),  /* vertical line size Hall */
   label_alignment = center,
    label_orientation = vertical,
    font_size = 10,
 label([concat("H=: ", string((y1-y0))," m"), x1+1.5*x_left-0.5, (y0+(y1-y0)/2)]), /* vertical  size H */
    label([concat("h_{1}=: ", string((h1))," m"), x1+1.5*x_left-0.5, (y1+(h1)/2)]), /* vertical  size H */
    label([concat("Hall=: ", string(Hall)," m"), x1+2*x_left-0.5, Hall*0.6]), /* vertical  size Hall */
  line_type = solid,
   color=blue,
    line_width=1,
    line_type = solid,
   head_both = false,
   head_length = 0.2,
   head_angle = 10,
    vector([x0-x_left/2,Hwater+0.5],[0,-0.4]),  /* vector p_a */
    font_size = 12,
   color = "#0e406e",
    label_orientation = horizontal,
 label(["p_{a} ", x0-x_left/2-0.4,Hwater+0.5]),
    label(["D_{x} ", x0+0.5,hi_D_x-0.2]),
    /* Vector P */
     font_size = 12,
    label_alignment = 'left,
    color = red,
    label([concat("D ( ", string(X_P),", ",string(Y_P),") "), X_P+0.3,Y_P-0.2]),
     font_size = 8,
    color=black,
    label([concat(" ( ", string(X),", ",string(Y),") "), X+0.1,Y+0.1]), 
   color=black,
    point_type = filled_circle,
   point_size = 1.5,
   points_joined = false,
   points([[X,Y],[x0,y0],[x1,y1],[x2,y2]]),
      /*dot direct line of  VECTOR P  */
   line_type = solid,
   color=black,
    line_width=1,
    line_type = short_long_dashes,
    vector([X-2*scale_P_x,Y+2*scale_P_z],[3*scale_P_x,-3*scale_P_z]), /* vectorP */
    line_width=2,
    line_type = solid,
    vector([-2,0],[x1_-2,0]), /* Axis 0X */
    /* VECTOR P  */
   line_type = solid,
   color=red,
    line_width=3,
    line_type = solid,
   head_both = false,
   head_length = 0.3,
   head_angle = 10,
    vector([X-scale_P_x,Y+scale_P_z],[scale_P_x,-scale_P_z]), /* vectorP */
    color = red,
    label_orientation = horizontal,
 label(["P ", X-scale_P_x-0.5,Y+0.9]),
    /*   Vector P_z  */
    color = blue,
    label_orientation = vertical,
    label(["P_{z} ", X-0.3,Y+0.8]),
    vector([X,Y+scale_P_z],[0,-scale_P_z]), /* vector P_z */
    line_width=1,
    color=black,
     line_type = short_long_dashes, 
    points_joined = true,
    polygon([[X,0],[X,Hwater+0.3]]),
    line_type = dots,
    polygon([[x1,0],[x1,y1]]),
   polygon([[X-scale_P_x,y0],[X-scale_P_x,Hall]]),
    polygon([[x0,Y+scale_P_z],[X+0.3,Y+scale_P_z]]),
    polygon([[x1,Hwater],[x1+4,Hwater]]),
    polygon([[-x_left,y0],[x1_,y0]]),
    line_type = solid,
    color = black,
    line_width=2,
    ellipse(x0, y0, 0.75, 0.75, 0, alpha_),
    ellipse(Xi, Yi, 0.4, 0.4, -2, -phi_+2),
    label_orientation = horizontal,
     label([concat("alpfa= ", string(alpha_)), x0+1.1,y0+0.3]),
    label([concat("phi= ", string(phi_)), Xi+0.1,Yi+0.4]),
    /* Малюємо прямокутник під текст */
  fill_color = "#F6F7EC",
  color      = "#819896",
  rectangle([x1_-x_right/2,Hall_add], [x1_,Hall_add-4*label_URL]),
    font      = "Arial",
    font_size = 18,
   color = "#0e406e",
    label_orientation = horizontal,
 label(["www.k123.org.ua ", x1_-x_right/2,Hall_add-label_URL]),
   label(["Kopanytsia Y (c)  2026",  x1_-x_right/2,Hall_add-3*label_URL]),
    line_width=1,
    point_type = filled_circle,
   point_size = 1.5,
   points_joined = false,
   color=black,
    points([[X_P,Y_P]]),
   color = red,
    label_orientation = horizontal,
 label([string(X),-2,Y+0.1]),
    label([string(Y),X,0+0.2])
)$

Варіант 2.  Вертикальна секція "TU" відсутня, h1=0.