file: D:\_j_knuba_2026\jMAXIMA\jh_Job_ex03.wxmx

ref https://www.k123.org.ua/data/_jh_ex2b_3a_v2.html
https://sourceforge.net/projects/maxima/files/Maxima-Windows/

kill(all);

load(draw);

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

H1:R+h1;

size plot2d - x1

x1:R+long_x;

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

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:(R**2-((%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;

x_z:h_D_/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; 

if h1 < 1 then H2:H1+1 else H2:H1;

draw2d(
    xrange = [0,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 */
  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.15,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,0]]),
    points([[R,h_D_]]),
    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.5]),
    line_width=1,
    line_type = dashes,
    head_angle = 180,
    vector([0,h_D_],[R,0]), /* horizontal line dot to vector P_x  */
    vector([x_z,R],[0,-R]),  /* vertical line dot to vector P_z  */
    vector([0,0],[R,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+scale_P_X,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  */
    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("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])
);

draw2d(grid      = true,
             line_type = solid,
             key       = "y^2=x^3-2*x+1",
             implicit(y^2=x^3-2*x+1, x, -4,4, y, -4,4),
             line_type = dots,
             key       = "x^3+y^3 = 3*x*y^2-x-1",
             implicit(x^3+y^3 = 3*x*y^2-x-1, x,-4,4, y,-4,4),
             title     = "Two implicit functions" )$