How To solve this equation?

5 Comments

I see no equal sign, nor any unknowns.
idk my professor just gave me this equation and I don't know how to solve it.
Do you see a " = " sign somewhere ? I don't . So it's not an equation. And if it's not an equation, there is nothing to solve for.
@Alif, I think your professor wants you to sum up the expression from to . It should be relatively easy to calculate that in Excel if your professor didn't specifically instruct you to use MATLAB.
there instruct to use a mathlab @Sam Chak
this the instruction "Calculate the result of the following equation using MATLAB"

Sign in to comment.

Answers (2)

Here is the numerical approach.
format long g
x = 1:1000;
y = (nthroot(5*x + 2, 5))./x;
S = sum(y)
S =
21.5330354759271

4 Comments

@Alif, This is the for-loop method, but I'm unsure why the last digit (2) differs from the last digit (1) computed using the sum() command.
format long g
y = 0; % Initialize y to store the sum later
for x = 1:1000
y = y + (nthroot(5*x + 2, 5))/x;
end
disp(y)
21.5330354759272
Summing in reverse seems to be more accurate as it is sum the smallest elemenst first
format long g
y = 0; % Initialize y to store the sum later
for x = 1000:-1:1
y = y + (nthroot(5*x + 2, 5))/x;
end
disp(y)
21.5330354759271
Thank you, @Bruno Luong. I tried this on Octave.
Forward summation:
Backward summation:
I guess one can obtain more digits with MATLAB too
For reference Star Strider's vpa result is 21.533035475927133
x = 1:1000;
y = (nthroot(5*x + 2, 5))./x;
S = sum(y);
fprintf('sum command = %2.15f\n', S)
sum command = 21.533035475927122
y = 0; % Initialize y to store the sum later
for x = 1:1000
y = y + (nthroot(5*x + 2, 5))/x;
end
fprintf('sum forward = %2.15f\n', y)
sum forward = 21.533035475927161
yb = 0; % Initialize y to store the sum later
for x = 1000:-1:1
yb = yb + (nthroot(5*x + 2, 5))/x;
end
fprintf('sum backward = %2.15f\n', yb)
sum backward = 21.533035475927125
yvpa = 21.533035475927133;
% LSB differences
(y-yvpa)/eps(yvpa) % 8 LSB, not so good
ans = 8
(yb-yvpa)/eps(yvpa) % -2 LSB, not bad
ans = -2
(S-yvpa)/eps(yvpa) % -3 LSB, OK
ans = -3

Sign in to comment.

One approach —
syms x
f = symsum(((5*x+2)^(1/5))/x, x, 1, 1E+3)
f = 
fvpa = vpa(f)
fvpa = 
21.53303547592713329236358151811
.

3 Comments

@Star Strider, the expression you have written is incorrect -
syms x
((5*x+2)^1/5)/x
ans = 
You need to put the power inside parenthesis.
Fixed. I thought that the order of precedence would take care of that. (Too early here.)
^ takes precedence over /, so it's logical that would be executed first.

Sign in to comment.

Tags

Asked:

on 7 Oct 2023

Edited:

on 7 Oct 2023

Community Treasure Hunt

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

Start Hunting!