file D:\_j_knuba_2026\jMAXIMA\jh_Job_ex08_v2.wxmx

TEST OBJECT OF single operations of the K123

Умова. Визначити параметри вектору сили гідростатичного тиску на вертикальну прямокутну поверхню висотою H=3м та шириною B=1м.
Тиск на вільній поверхні рідини атмосферний.
Побудувати епюру гідростатичного тиску та позначити координату центру тиску (крапка D).

kill(all);

load("draw")$

long_x:7; label_left:3; label_vert:1.5; label_URL:0.2;

ro:1000;g:9.81;x0:0;y0:0;x1:0;y1:3;B:1;h1:0;

Hall:y1+h1;H:y1-y0;

# VARIANT # 1 (standart)

# P_x

h_C:(Hall-H/2);w:H*B;I:(B*H**3)/12;

p:ro*g*h_C;

P:p*w;

h_D:h_C+(I)/(h_C*w),numer;h_D_:Hall-h_D;

size plot2d - x1

x1_:x1-x0+long_x;

scale

scale_L:P;scale_P:P/scale_L;

scale_P:P/scale_L;

Draw

h1;Hall;H;x1;h_D_;h_D;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)
)$

h_C:ds(h_C),numer; w:ds(w),numer; I:ds(I),numer;p:ds(p),numer;

P:ds(P),numer; hi_D_:ds(h_D_),numer;

H2:y1+h1+3;

epura

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

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

if h1 < 2 then Hall_add:Hall+5 else Hall_add:Hall;

x1_;Hall;Hall_add;x_left:2;

draw2d(
    xrange = [-x_left,x1_], /* size picture  x - x1 & y - H1 */
yrange = [0,Hall_add],
    proportional_axes=xy,
    font      = "Arial",
    font_size = 16,
    grid = true,
    line_width=1,
    color=black,
title = "TEST OBJECT OF single operations of the K123",
       line_width=8,
       line_type = solid,
    points_joined = true,
    color=red,
      points([[x0,y0],[x1,y1],[x2,y1]]), /* inclined flat surface */
    line_width=1,
    color=black,
     line_type = dashes, 
    points_joined = true,
     fill_color = white,
      polygon([[-2,0],[0,Hall],[0,y0],[-2,0]]),
    line_width=4,
       line_type = solid,
    points_joined = true,
    color=red,
    points([[x0,y0],[x1,y1],[x1,Hall]]),/* inclined flat surface */
    line_width=1,
    color=black,
     line_type = dashes, 
    points_joined = true,
     fill_color = white,
      polygon([[-2,0],[0,Hall],[0,y0],[-2,0]]), /* rectangle epura of presure P_x */
    fill_color = gray90,
     line_type = solid,
      polygon([[-2,0],[-(2/Hall)*(Hall-1*y1),y1],[0,y1],[0,0],[-2,0]]), /* 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*y1),0.1*y1],[(2/Hall)*(Hall-0.1*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.2*y1),0.2*y1],[(2/Hall)*(Hall-0.2*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.3*y1),0.3*y1],[(2/Hall)*(Hall-0.3*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.4*y1),0.4*y1],[(2/Hall)*(Hall-0.4*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.5*y1),0.5*y1],[(2/Hall)*(Hall-0.5*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.6*y1),0.6*y1],[(2/Hall)*(Hall-0.6*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.7*y1),0.7*y1],[(2/Hall)*(Hall-0.7*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.8*y1),0.8*y1],[(2/Hall)*(Hall-0.8*y1),0]), /* horizontal presure vector p  */
    vector([-(2/Hall)*(Hall-0.9*y1),0.9*y1],[(2/Hall)*(Hall-0.9*y1),0]), /* horizontal presure vector p  */   
     color = "black",
 fill_color = light_blue,
    line_width=2,
    head_angle = 15,
    head_length = 0.25,
    color=black,point_type = filled_circle,
   point_size = 1.5,
   points_joined = false,
   points([[0,h_D_]]),
     label_orientation = horizontal,
 label(["P",x0-0.5,h_D_+0.5]), /* point P */
    line_width=1,
    line_type = dashes,
    head_angle = 180,
    vector([-1,h_D_],[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([x0-1,h_D_],[+scale_P,0]),  /* horizontal vector P  */
    font      = "Arial",
    font_size = 16,
   color = "#0e406e",
    label_orientation = horizontal,
 label(["www.k123.org.ua ", x1_-long_x/2,Hall_add-label_URL]),
   label(["Kopanytsia Y (c)  2026",  x1_-long_x/2,Hall_add-3*label_URL]),
    label_orientation = horizontal,
    label_alignment = left,
color = black,
     label([concat("h_{C}=: ", string(h_C)," m"), x1_-label_left, y1*2]),
    label([concat("w=: ", string(w)," m"), x1_-label_left, y1*1.8]),
    label([concat("p=: ", string(p)," Pa"), x1_-label_left, y1*1.6]),
    label([concat("I=: ", string(I)," m"), x1_-label_left, y1*1.4]),
     label([concat("h_D_{coord}=: ", string(hi_D_)," m"), x1_-label_left, y1*1.2]),
    label([concat("P=: ", string(P)," N"), x1_-label_left, y1*0.8]),
    line_type = solid,
   color=black,line_width=1,
   head_both = true,
   head_length = 0.2,
   head_angle = 10,
    vector([x1+scale_P+0.1,0],[0,h_D_]),  /* h_D_ */
   label_alignment = center,
    label_orientation = vertical,
    font_size = 10,
 label([concat("h_{D_{coord}}=: ", string(hi_D_)," m"), x1+0.7, h_D_*0.6]),
    /* Input data */
 line_type = solid,
   color=blue,
    line_width=3,
    head_angle = 180,
   vector([-x_left,Hall],[x_left,0]),  /* horizontal line dot to vector P_x  */
    line_width=1,
    line_type = dashes,
    head_angle = 180,
    vector([x0,y1],[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+x_left-0.2,0],[0,y1]),  /* vertical line size H */
    label_alignment = center,
    label_orientation = vertical,
    font_size = 10,
 label([concat("H=: ", string(Hall)," m"), x1+x_left-0.5, Hall*0.6]), /* vertical  size H */
  line_type = solid,
   color=black,
    line_width=1,
    line_type = solid,
   head_both = false,
   head_length = 0.2,
   head_angle = 10,
    vector([x0-x_left/2,y1+0.4],[0,-0.4]),  /* vector p_a */ 
     font      = "Times-Italic",
    font_size = 16,
   color = "#0e406e",
    label_orientation = horizontal,
 label(["p_{a} ", x0-x_left/2-0.4,y1+0.4]),
    label(["D ", x0+0.3,hi_D_-0.1])
);