Search found 2 matches

by phanttam
Thu Feb 04, 2016 12:06 am
Forum: Text Formatting
Topic: CALCULATOR PACKAGE, CHECK A NUMBER
Replies: 3
Views: 2180

CALCULATOR PACKAGE, CHECK A NUMBER

Thanks Stefan_K, could you introduce me another package?
I need if #1 = n
\sum\limits_{k=0}^{n}2^k=1+2+2^2+\ldots+2^{n-1}+2^n
else
\sum\limits_{k=0}^{2016}2^k=1+2+2^2+\ldots+2^{2015}+2^2016

I can
\def \SUM#1{
% check #1 is a number or not, if #1 is a number
$\sum\limits_{k=0}^{#1}2^k=1+2+2^2 ...
by phanttam
Wed Feb 03, 2016 11:09 pm
Forum: Text Formatting
Topic: CALCULATOR PACKAGE, CHECK A NUMBER
Replies: 3
Views: 2180

CALCULATOR PACKAGE, CHECK A NUMBER

I have a problem about CALCULATOR PACKAGE, I need check #1 is a number or not, could I use contitional command?
ex:
def \CHECK#1{
% if #1 a number
\if...?
#1 is a number
\else
#1 is not a number
\fi
}
\CHECK{3}

CHECK{n}

Thanks all!