How do i code an integral that needs to be differentiated. L=int1/0(2+t^2)dt

조회 수: 6 (최근 30일)
Scott Stearns
Scott Stearns 2021년 6월 18일
댓글: Rahul 2025년 7월 24일
The answer I've gotten would be . As would then be . I'm just trying to figure out how to verify/code this into MATLAB. If anyone could help I'd be very appreciative.
Full problem solving: Find the length of the curve. r(t)=<2t, t^2, 1/3t^3>, 0<=t<=1
Code written thus far:

답변 (1개)

Rahul
Rahul 2025년 7월 23일
Hi Scott,
I understand that you're working on calculating the arc length of a 3D parametric curve defined by 'r(t)' over a defined interval and are looking to verify and implement this in MATLAB. The provided snippet seems to be an evaluating the arc length by first computing the derivative and its magnitude.
To compute the arc length of a parametric curve in 3D space, you can evaluate the integral of the norm of its first derivative over the given interval. Since the components of the vector function are continuous and differentiable polynomials, MATLAB's Symbolic Math Toolbox offers an ideal way to compute this exactly and with minimal manual effort.
Using the Symbolic Math Toolbox, the process can be broken down into the following steps:
  1. Define the vector function 'r(t)' symbolically
  2. Differentiate 'r(t)' with respect to t
  3. Compute the Euclidean norm (magnitude) of the derivative
  4. Integrate this magnitude from 't = 0' to 't = 1' to obtain the arc length
% Step 1: Symbolic definition
syms t
r = [2*t, t^2, (1/3)*t^3];
% Step 2: Derivative
dr = diff(r, t);
% Step 3: Magnitude of derivative
dr_mag = sqrt(sum(dr.^2));
% Step 4: Definite integration over [0, 1]
arc_length_sym = int(dr_mag, [0, 1]);
% Convert to numeric if needed
arc_length_val = double(arc_length_sym);
% Display results
disp('Exact Arc Length (symbolic): ');
Exact Arc Length (symbolic):
disp(arc_length_sym)
fprintf('Arc Length (numeric): %.6f\n', arc_length_val);
Arc Length (numeric): 2.333333
For this particular curve, the integrand simplifies to 't^2 + 2', and the definite integral over [0,1] evaluates to 7/3 (approximately 2.3333). This confirms that the symbolic engine is working correctly and simplifies algebraic expressions automatically.
For more information regarding the usage of various functions mentioned in the given code snippet, you can refer to the following documentation links:
  댓글 수: 2
Walter Roberson
Walter Roberson 2025년 7월 23일
I notice that the output of disp(arc_length_sym) is dulled out. This is an Answers bug that I am currently reporting to Mathworks. I would appreciate it if you did not edit the output while Mathworks investigates.
Rahul
Rahul 2025년 7월 24일
Sure, I will not be editing the answer any further.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by