How can I simplify this expression using "abs" function?

14 ビュー (過去 30 日間)
Sathish
Sathish 2023 年 11 月 20 日
編集済み: Torsten 2023 年 11 月 20 日
  8 件のコメント
Sathish
Sathish 2023 年 11 月 20 日
Thank you for your suggestions.
Walter Roberson
Walter Roberson 2023 年 11 月 20 日
I think in the Wolfram output that the # stand in for the variable whose value has to be found to make the expression zero

サインインしてコメントする。

回答 (2 件)

Star Strider
Star Strider 2023 年 11 月 20 日
This seems to work —
syms n k
Expr = 7/6 * symsum((2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^3 - k)-(k*(k+1)*(2*k+1))/6, k, 1, n-1)
Expr = 
Expr = simplify(Expr, 500)
Expr = 
.
  5 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 11 月 20 日
The abs() call is inside the symsum() call.
Star Strider
Star Strider 2023 年 11 月 20 日
編集済み: Star Strider 2023 年 11 月 20 日
Edited —
syms n k
Expr = symsum(abs((2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^2 - k)/6-(k*(k+1)*(2*k+1))/6), k, 1, n-1)
Expr = 
Expr = simplify(Expr, 400)
Expr = 
.

サインインしてコメントする。


Torsten
Torsten 2023 年 11 月 20 日
編集済み: Torsten 2023 年 11 月 20 日
You must determine the value for k0 where the expression
2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^2 - k - k*(k+1)*(2*k+1)
changes sign from positive to negative. Then you can add
1/6*(2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^2 - k - k*(k+1)*(2*k+1))
from k = 1 to k = floor(k0) and add
-1/6*(2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^2 - k - k*(k+1)*(2*k+1)))
from k = floor(k0)+1 to k = n-1.
syms n k
p = simplify(2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^2 - k - k*(k+1)*(2*k+1))
p = 
s = solve(p,k,'MaxDegree',3)
s = 
result = simplify(1/6*symsum(2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^2 - k - k*(k+1)*(2*k+1),k,1,floor(s(1)))-...
1/6*symsum(2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^2 - k - k*(k+1)*(2*k+1),k,floor(s(1))+1,n-1))
result = 
subs(result,n,13)
ans = 
6444
k = 1:12;
n = 13;
expr = 1/6*abs(2*n^3 + 3*n^2 + n - 2*k.^3 - 3*k.^2 - k - k.*(k+1).*(2*k+1))
expr = 1×12
817 809 791 759 709 637 539 411 249 49 193 481
sum(expr)
ans = 6444

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by