janhardo

375 Reputation

8 Badges

10 years, 90 days

MaplePrimes Activity


These are replies submitted by janhardo

@janhardo 

Both procedures give the same result.
Procedure 2 is not yet as solid as procedure 1 and ease of use, so some adjustments to be made.



ImplicitPlot3D_withCurveProjection(x^2 + y^2 - z, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t ->0, 0..2*Pi, 30);



More convenient is to leave the current procedure 1 and start with a new procedure 2 for implicitplot3D surfaces

this new second procedure :
The procedure still lacks
- a size and orientation in the input
- control on procedure input of x,y,z via equation
- control on special function value output 
- the line integral notation with its value 
- the equation of the space curve 
- the output value of the procedure ( length of the projection curve )
 

restart;

ImplicitPlot3D_withCurveProjection := proc(f, n, x_range, y_range, z_range, x_t, y_t, z_t, t_range, num_vertical_lines)
    local implicit_function, plot_result, space_curve, projection_curve, combined_plot, is_closed, projection_curve_length, space_curve_length, solve_z, t_values, t_increment, points, i, t, t_increment_vert, vertical_lines, x_val, y_val, z_val_space, z_val_projection;
    uses plots, plottools, Student[Calculus1];

    # Basic check on the correct number of arguments and their types
    if nargs <> 10 or not type(f, algebraic) or not type(n, numeric) or
       not type(x_range, range) or not type(y_range, range) or not type(z_range, range) or
       not type(x_t, procedure) or not type(y_t, procedure) or not type(z_t, procedure) or
       not type(t_range, range) or not type(num_vertical_lines, posint) then
        error "Error: Incorrect input. Ensure all parameters are correctly typed and provided in the following order: ImplicitPlot3D_withCurveProjection_withPoints(f, n, x_range, y_range, z_range, x_t, y_t, z_t, t_range, num_vertical_lines). Each parameter must match its expected type and range.";
    end if;

    # Create the implicit expression
    implicit_function := f = n;

    # Generate the 3D plot of the implicit surface
    plot_result := implicitplot3d(implicit_function, x = x_range, y = y_range, z = z_range, axes = boxed, grid = [30,30,30], style = surface, title = sprintf("Implicit plot of %a = %a with space curve and its vertical projection", f, n));

    # Define the parametric space curve
    space_curve := spacecurve([x_t(t), y_t(t), z_t(t)], t = t_range, color = "red", thickness = 2);

    # Solve the surface equation for z if possible
    solve_z := solve(f = n, z);

    # Define the projection curve on the surface, vertical projection to z solved from surface equation
    projection_curve := spacecurve([x_t(t), y_t(t), eval(solve_z, {x = x_t(t), y = y_t(t)})], t = t_range, color = "blue", thickness = 2, linestyle = 2);

    # Check if the curve is closed
    is_closed := evalb(x_t(op(1, t_range)) = x_t(op(2, t_range)) and y_t(op(1, t_range)) = y_t(op(2, t_range)));

    # Calculate the length of the projection curve
    projection_curve_length := evalf(Int(sqrt(diff(x_t(t), t)^2 + diff(y_t(t), t)^2 + (diff(eval(solve_z, {x = x_t(t), y = y_t(t)}), t))^2), t = t_range));

    # Calculate the length of the space curve
    space_curve_length := evalf(Int(sqrt(diff(x_t(t), t)^2 + diff(y_t(t), t)^2 + diff(z_t(t), t)^2), t = t_range));

    # Calculate t values for points
    t_values := [seq(op(1, t_range) + i * (op(2, t_range) - op(1, t_range)) / num_vertical_lines, i = 0 .. num_vertical_lines)];

    # Calculate the increment for t values
    t_increment := (op(2, t_range) - op(1, t_range)) / num_vertical_lines;

    # Calculate points on the space curve
    points := [seq([eval(x_t(t_values[i])), eval(y_t(t_values[i])), eval(z_t(t_values[i]))], i = 1..num_vertical_lines)];

    # Calculate the increment for vertical t values
    t_increment_vert := (op(2, t_range) - op(1, t_range)) / num_vertical_lines;

    # Plot vertical lines from space curve to projection curve
    vertical_lines := [];
    for i from 0 to num_vertical_lines-1 do
        x_val := eval(x_t(op(1, t_range) + i * t_increment_vert));
        y_val := eval(y_t(op(1, t_range) + i * t_increment_vert));
        z_val_space := eval(z_t(op(1, t_range) + i * t_increment_vert));
        z_val_projection := eval(solve_z, {x = x_val, y = y_val});
        vertical_lines := [op(vertical_lines), plottools:-line([x_val, y_val, z_val_space], [x_val, y_val, z_val_projection], color = "green")];
    end do;

    # Combine both plots, space curve, projection curve, and vertical lines
      combined_plot := display({plot_result, space_curve, projection_curve, seq(vertical_lines[i], i = 1..num_vertical_lines)}, axes = boxed);



    # Print the combined plot
    print(combined_plot);

    # Print whether the curve is closed or not
    if is_closed then
        printf("The space curve is closed.\n");
    else
        printf("The space curve is not closed.\n");
    end if;

    # Print the length of the projection curve
    printf("Length of the projection curve (vertical green lines from spacecurve): %a\n", projection_curve_length);

    # Print the length of the space curve
    printf("Length of the space curve: %a\n", space_curve_length);

    # Provide detailed information on how to use the procedure correctly after execution
    printf("Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:\n\n");
    printf("f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1\n");
    printf("n: Numeric value that the implicit equation equals to. Example: 0\n");
    printf("x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2\n");
    printf("x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0\n");
    printf("t_range: Range for the parameter t. Example: 0..2*Pi\n");
    printf("num_vertical_lines: Number of vertical lines to be plotted.\n");
    printf("Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)\n");
end proc:

# Voorbeeldaanroep
ImplicitPlot3D_withCurveProjection(x + y + z, 0, -10.5..10.5, -10.5..10.5, -20..20, t -> t, t -> 3*cos(t), t -> 3*sin(t), 0..1*Pi, 5);

 

The space curve is not closed.
Length of the projection curve (vertical green lines from spacecurve): 7.907090108
Length of the space curve: 9.934588266
Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:

f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1
n: Numeric value that the implicit equation equals to. Example: 0
x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2
x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0
t_range: Range for the parameter t. Example: 0..2*Pi
num_vertical_lines: Number of vertical lines to be plotted.
Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)

 

ImplicitPlot3D_withCurveProjection(x + y + z, 0, -10.5..10.5, -10.5..10.5, -20..20, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi,8);

 

The space curve is closed.
Length of the projection curve (vertical green lines from spacecurve): 8.737752571
Length of the space curve: 6.283185307
Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:

f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1
n: Numeric value that the implicit equation equals to. Example: 0
x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2
x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0
t_range: Range for the parameter t. Example: 0..2*Pi
num_vertical_lines: Number of vertical lines to be plotted.
Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)

 

 

ImplicitPlot3D_withCurveProjection(x + y +z, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi,10)

 

The space curve is closed.
Length of the projection curve (vertical green lines from spacecurve): 8.737752571
Length of the space curve: 6.283185307
Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:

f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1
n: Numeric value that the implicit equation equals to. Example: 0
x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2
x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0
t_range: Range for the parameter t. Example: 0..2*Pi
num_vertical_lines: Number of vertical lines to be plotted.
Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)

 

ImplicitPlot3D_withCurveProjection(2*x+y^2-z, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> 2*cos(t), t -> sin(t)+1, t -> 0, 0..1/2*Pi,10);
=============================================================
this example is from procedure 1 en its not the same plot 
===============================================================

 

 

The space curve is not closed.
Length of the projection curve (vertical green lines from spacecurve): 3.653877920
Length of the space curve: 2.422112055
Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:

f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1
n: Numeric value that the implicit equation equals to. Example: 0
x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2
x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0
t_range: Range for the parameter t. Example: 0..2*Pi
num_vertical_lines: Number of vertical lines to be plotted.
Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)

 

 

The idea to take the examples of procedure 1 and input them in procedure 2:  to compare plots 
f(x,y) = implicitplot3d ?

Download ImplicitPlot3D_withCurveProjection_-maple_primes_.mw

Used another example from the fist procedure in this second procedure ,but don't get the same plots
( the axes orientation is not the same)

ImplicitPlot3D_withCurveProjection(2*x+y^2-z, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> 2*cos(t), t -> sin(t)+1, t -> 0, 0..1/2*Pi,10);





The procedure still lacks
- a size and orientation in the input
- control on procedure input of x,y,z via equation
- control on special function value output 
- the line integral notation with its value 
- the equation of the space curve 
- the output value of the procedure ( length of the projection curve )

restart;

ImplicitPlot3D_withCurveProjection := proc(f, n, x_range, y_range, z_range, x_t, y_t, z_t, t_range, num_vertical_lines)
    local implicit_function, plot_result, space_curve, projection_curve, combined_plot, is_closed, projection_curve_length, space_curve_length, solve_z, t_values, t_increment, points, i, t, t_increment_vert, vertical_lines, x_val, y_val, z_val_space, z_val_projection;
    uses plots, plottools, Student[Calculus1];

    # Basic check on the correct number of arguments and their types
    if nargs <> 10 or not type(f, algebraic) or not type(n, numeric) or
       not type(x_range, range) or not type(y_range, range) or not type(z_range, range) or
       not type(x_t, procedure) or not type(y_t, procedure) or not type(z_t, procedure) or
       not type(t_range, range) or not type(num_vertical_lines, posint) then
        error "Error: Incorrect input. Ensure all parameters are correctly typed and provided in the following order: ImplicitPlot3D_withCurveProjection_withPoints(f, n, x_range, y_range, z_range, x_t, y_t, z_t, t_range, num_vertical_lines). Each parameter must match its expected type and range.";
    end if;

    # Create the implicit expression
    implicit_function := f = n;

    # Generate the 3D plot of the implicit surface
    plot_result := implicitplot3d(implicit_function, x = x_range, y = y_range, z = z_range, axes = boxed, grid = [30,30,30], style = surface, title = sprintf("Implicit plot of %a = %a with space curve and its vertical projection", f, n));

    # Define the parametric space curve
    space_curve := spacecurve([x_t(t), y_t(t), z_t(t)], t = t_range, color = "red", thickness = 2);

    # Solve the surface equation for z if possible
    solve_z := solve(f = n, z);

    # Define the projection curve on the surface, vertical projection to z solved from surface equation
    projection_curve := spacecurve([x_t(t), y_t(t), eval(solve_z, {x = x_t(t), y = y_t(t)})], t = t_range, color = "blue", thickness = 2, linestyle = 2);

    # Check if the curve is closed
    is_closed := evalb(x_t(op(1, t_range)) = x_t(op(2, t_range)) and y_t(op(1, t_range)) = y_t(op(2, t_range)));

    # Calculate the length of the projection curve
    projection_curve_length := evalf(Int(sqrt(diff(x_t(t), t)^2 + diff(y_t(t), t)^2 + (diff(eval(solve_z, {x = x_t(t), y = y_t(t)}), t))^2), t = t_range));

    # Calculate the length of the space curve
    space_curve_length := evalf(Int(sqrt(diff(x_t(t), t)^2 + diff(y_t(t), t)^2 + diff(z_t(t), t)^2), t = t_range));

    # Calculate t values for points
    t_values := [seq(op(1, t_range) + i * (op(2, t_range) - op(1, t_range)) / num_vertical_lines, i = 0 .. num_vertical_lines)];

    # Calculate the increment for t values
    t_increment := (op(2, t_range) - op(1, t_range)) / num_vertical_lines;

    # Calculate points on the space curve
    points := [seq([eval(x_t(t_values[i])), eval(y_t(t_values[i])), eval(z_t(t_values[i]))], i = 1..num_vertical_lines)];

    # Calculate the increment for vertical t values
    t_increment_vert := (op(2, t_range) - op(1, t_range)) / num_vertical_lines;

    # Plot vertical lines from space curve to projection curve
    vertical_lines := [];
    for i from 0 to num_vertical_lines-1 do
        x_val := eval(x_t(op(1, t_range) + i * t_increment_vert));
        y_val := eval(y_t(op(1, t_range) + i * t_increment_vert));
        z_val_space := eval(z_t(op(1, t_range) + i * t_increment_vert));
        z_val_projection := eval(solve_z, {x = x_val, y = y_val});
        vertical_lines := [op(vertical_lines), plottools:-line([x_val, y_val, z_val_space], [x_val, y_val, z_val_projection], color = "green")];
    end do;

    # Combine both plots, space curve, projection curve, and vertical lines
      combined_plot := display({plot_result, space_curve, projection_curve, seq(vertical_lines[i], i = 1..num_vertical_lines)}, axes = boxed);



    # Print the combined plot
    print(combined_plot);

    # Print whether the curve is closed or not
    if is_closed then
        printf("The space curve is closed.\n");
    else
        printf("The space curve is not closed.\n");
    end if;

    # Print the length of the projection curve
    printf("Length of the projection curve (vertical green lines from spacecurve): %a\n", projection_curve_length);

    # Print the length of the space curve
    printf("Length of the space curve: %a\n", space_curve_length);

    # Provide detailed information on how to use the procedure correctly after execution
    printf("Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:\n\n");
    printf("f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1\n");
    printf("n: Numeric value that the implicit equation equals to. Example: 0\n");
    printf("x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2\n");
    printf("x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0\n");
    printf("t_range: Range for the parameter t. Example: 0..2*Pi\n");
    printf("num_vertical_lines: Number of vertical lines to be plotted.\n");
    printf("Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)\n");
end proc:

# Voorbeeldaanroep
ImplicitPlot3D_withCurveProjection(x + y + z, 0, -10.5..10.5, -10.5..10.5, -20..20, t -> t, t -> 3*cos(t), t -> 3*sin(t), 0..1*Pi, 5);

 

The space curve is not closed.
Length of the projection curve (vertical green lines from spacecurve): 7.907090108
Length of the space curve: 9.934588266
Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:

f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1
n: Numeric value that the implicit equation equals to. Example: 0
x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2
x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0
t_range: Range for the parameter t. Example: 0..2*Pi
num_vertical_lines: Number of vertical lines to be plotted.
Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)

 

ImplicitPlot3D_withCurveProjection(x + y + z, 0, -10.5..10.5, -10.5..10.5, -20..20, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi,8);

 

The space curve is closed.
Length of the projection curve (vertical green lines from spacecurve): 8.737752571
Length of the space curve: 6.283185307
Procedure successfully executed. To correctly use this procedure, provide parameters in the following order and format:

f: Algebraic expression for the implicit equation. Example: x^2 + y^2 - 1
n: Numeric value that the implicit equation equals to. Example: 0
x_range, y_range, z_range: Valid ranges for x, y, and z coordinates. Example for x and y: -1.5..1.5, and for z: -2..2
x_t, y_t, z_t: Parametric expressions for the space curve as functions of t. Example: x_t: t -> cos(t), y_t: t -> sin(t), z_t: t -> 0
t_range: Range for the parameter t. Example: 0..2*Pi
num_vertical_lines: Number of vertical lines to be plotted.
Complete example call: ImplicitPlot3D_withCurveProjection_withPoints(x^2 + y^2 - 1, 0, -1.5..1.5, -1.5..1.5, -2..2, t -> cos(t), t -> sin(t), t -> 0, 0..2*Pi, 5)

 

 

 


 

Download ImplicitPlot3D_withCurveProjection_-maple_primes_.mw

 

@acer 
Thanks, yes this is a 3D space curve and this is the effect and I see that the earlier created procedure has been modified for this.
I also added a small adjustment : 4 vertical green lines from the projection curve to the curve projected on the surface.
Surfaces in f(x,y,z) are even more complicated in shape 
The intention is to obtain an equation of the interpolation curve on the surface, just that's a bonus 
Am afraid that possibly mission impossible becomes obtaining these equations and then especially if the surfaces become more erratic.

booglengte_geenberekenin_plus_plot_vraag_maple_primes_engels_ac3d_kopie1-def.mw

NULL

# Herstart de sessie om alle oude variabelen en instellingen te wissen
restart;

# Definieer de parametrische vergelijkingen van de trefoil knoop
x := t -> sin(t) + 2*sin(2*t);
y := t -> cos(t) - 2*cos(2*t);
z := t -> -sin(3*t);

# Plot de kromme
plots:-spacecurve([x(t), y(t), z(t), t = 0..2*Pi], color = "Blue", thickness = 2, axes = boxed);

"maple.ini in users"

 

proc (t) options operator, arrow; sin(t)+2*sin(2*t) end proc

 

proc (t) options operator, arrow; cos(t)-2*cos(2*t) end proc

 

proc (t) options operator, arrow; -sin(3*t) end proc

 

 

 

# Herstart de sessie om alle oude variabelen en instellingen te wissen
restart;

# Definieer de kromme als een benoemde functie 'TrefoilKnot'
TrefoilKnot := t -> [sin(t) + 2*sin(2*t), cos(t) - 2*cos(2*t), -sin(3*t)];

# Gebruik de functie 'TrefoilKnot' om de kromme te plotten
plots:-spacecurve(TrefoilKnot(t), t = 0..2*Pi, color = "Blue", thickness = 2, axes = boxed);

"maple.ini in users"

 

 

 
restart;
with(plots):
with(CurveFitting):

# Define the Trefoil Knot function
TrefoilKnot := t -> [sin(t) + 2*sin(2*t), cos(t) - 2*cos(2*t), -sin(3*t)];

# Generate interpolation points
interpolatiepunten := [seq(TrefoilKnot(t), t = evalf(0)..evalf(2*Pi), evalf(Pi/16))];


print("Interpolatiepunten:", interpolatiepunten);  # Check the interpolation points

# Extract x, y, z coordinates from the points
xPoints := [seq(p[1], p = interpolatiepunten)];
yPoints := [seq(p[2], p = interpolatiepunten)];
zPoints := [seq(p[3], p = interpolatiepunten)];
print("x Points:", xPoints);  # Check x points
print("y Points:", yPoints);  # Check y points
print("z Points:", zPoints);  # Check z points

# Generate t-values for the spline interpolation
tValues := [seq(i, i = 0..nops(interpolatiepunten)-1)]:
print("t Values:", tValues);  # Check t values

# Create splines for each coordinate
xSpline := Spline(tValues, xPoints, t, degree=3);
ySpline := Spline(tValues, yPoints, t, degree=3);
zSpline := Spline(tValues, zPoints, t, degree=3);
print("x Spline:", xSpline);  # Check x Spline
print("y Spline:", ySpline);  # Check y Spline
print("z Spline:", zSpline);  # Check z Spline

# Define the interpolated Trefoil Knot function
InterpolatedTrefoilKnot := t -> [xSpline(t), ySpline(t), zSpline(t)];

# Create plots for the original and interpolated knots
originalPlot := spacecurve(TrefoilKnot(t), t = 0..2*Pi, color = "Blue", thickness = 2, title = "Original Trefoil Knot");
interpolatedPlot := spacecurve(InterpolatedTrefoilKnot(t), t = 0..nops(interpolatiepunten)-1, color = "Red", thickness = 2, title = "Interpolated Trefoil Knot");

# Display the plots
display(Array([originalPlot, interpolatedPlot]), axes = boxed, orientation = [45, 45]);

 

 

 
 

 

 

 

 

 

 

 

 

original curve- interpolation curve- derative curve : take the integral to get the equation ?
 

 

Download interpolatiekromme_uitzoeken.mw

I am not quite finished with the procedure yet
In the plot caption :
- line integral notation with /symbolic numerical value 
- parameter curve equation entered
-equation of the projection curve 
 
On how many ways i can program this for storing data ? 

@Carl Love 
Thanks, very instructive this procedure. 

Thanks, looks good.
Try to add some more text to get even a clearer picture.
This procedure is a nice basis to extend to more complicated surfaces f(x,y,z) with a spatial domain curve.
This example was already very instructive.

Thanks, Admit it may be a bit unclear, will try to word it more clearly.

Integral expression = Elliptic expression = float expression 

That can be shown in the plot itself this above output.
Also outside the plot would be useful to show the outcome of the procedure.  

Thanks , It seems that in the procedure there is a provision if a special function occurs in the arc length ( red curve) calculation then a numeric value of this is shown?
Can the special function symbolic expression  just remain with the numeric value behind it in the plot?
 

VisualizeFunctionAndCurve(2*x+y^2, sin(t)+1, 2*cos(t), 0, [0, 1/2*Pi]);

Thanks, yes this definitely became an overhaul of the procedure ( I didn't expect )
I definitely need to study this : how some things have been changed and why.
What is the objection to using a function operator instead of an expression notation ?
This procedure is still for simple surfaces it appears
For more complicated surfaces it becomes f(x,y,z) and the domain becomes a space curve
I still want to try to extend the existing procedure... 

If this should work the VisualizeFunctionAndCurve () procedure, then a further modification for the domain curve  

A plane curve can be represented in two ways: by an equation H(x,y)=0 (the implicit description) and parametrically by a pair of equations with one parameter (the parameter description).

@sija 
Thanks, i will look at it again

Interesting, but from the looks of it, none of the animations work in Maple 2024, or am I mistaken? 

Have revisited the task and have the idea that this elaboration could be better in Maple ? 

restart;
 

"maple.ini in users"

(1)

# Define functions and variables
f := (x, y) -> 2*x + y^2;  # Function f(x, y)
x := t -> 1 + t;           # Function x(t)
y := t -> 2*t;             # Function y(t)
 

proc (x, y) options operator, arrow; 2*x+y^2 end proc

 

proc (t) options operator, arrow; t+1 end proc

 

proc (t) options operator, arrow; 2*t end proc

(2)

# Compute derivatives
dx_dt := D(x);  # Derivative of x with respect to t
dy_dt := D(y);  # Derivative of y with respect to t
 

1

 

2

(3)

# Definitie van de functies x(t) en y(t)
x(t) := t + 1;
y(t) := 2*t;

# Definitie van de functie f(x(t), y(t))
f(x, y) := 2*x + y^2;
f_t := unapply(f(x(t), y(t)), t);  # Omzetten van f in termen van t

# Berekenen van de afgeleiden
dx_dt := diff(x(t), t);
dy_dt := diff(y(t), t);

# Definitie van de uitdrukking voor booglengte (ds)
ds := sqrt(dx_dt^2 + dy_dt^2);

# Bereken de booglengte van de kromme van t = 0 tot t = 1
curve_length := Int(f_t(t)*ds, t = 0 .. 1);
evaluated_curve_length := value(Int(f_t(t)*ds, t = 0 .. 1));

# Output van de inerte en geëvalueerde vorm van de booglengte
curve_length = evaluated_curve_length;

t+1

 

2*t

 

y^2+2*x

 

proc (t) options operator, arrow; 4*t^2+2*t+2 end proc

 

1

 

2

 

5^(1/2)

 

Int((4*t^2+2*t+2)*5^(1/2), t = 0 .. 1)

 

(13/3)*5^(1/2)

 

Int((4*t^2+2*t+2)*5^(1/2), t = 0 .. 1) = (13/3)*5^(1/2)

(4)

# Plotting
with(plots):
    surface := plot3d(f(x, y), x = 0..3, y = 0..4, axes=boxed, labels=['x', 'y', 'z'], style=surfacecontour):  # 3D surface plot of the function f
    curve := spacecurve([x(t), y(t), f(x(t), y(t))], t = 0..1, color=red, thickness=2):  # Parametric space curve
    line_xy := spacecurve([[1, 0, 0], [2, 2, 0]], color=black, thickness=2, linestyle=2):  # Line in the xy-plane from (1,0) to (2,2)
    vertical_line1 := spacecurve([[1, 0, 0], [1, 0, f(1,0)]], color=blue, thickness=2):  # Vertical line from the xy-plane to the spacecurve at x=(1,0)
    vertical_line2 := spacecurve([[x(0.5), y(0.5), 0], [x(0.5), y(0.5), f(x(0.5), y(0.5))]], color=blue, thickness=2):  # Vertical line at t=0.5
    vertical_line3 := spacecurve([[x(1), y(1), 0], [x(1), y(1), f(x(1), y(1))]], color=blue, thickness=2):  # Vertical line at t=1

   

 # Display all plots together in a single visualization
    display(surface, curve, line_xy, vertical_line1, vertical_line2, vertical_line3, title="3D Plot of f(x,y) = 2x + y^2 with Curve and Vertical Lines");

 
 

 

Download lijnintegraal_2e_poging_maple_primes.mw

First 6 7 8 9 10 11 12 Last Page 8 of 48