1

enter image description here

How do I solve this type of question? I don't understand what im suppose to do. What does it mean "show two uses with different arguments?"

  • 3
    \newcommand{\summation}[2]{\ensuremath{\sum_{i=0}^{#1}#2_i}}. MWE: \documentclass{article} \newcommand{\summation}[2]{\ensuremath{\sum_{i=1}^{#1}#2_i}} \begin{document} \summation{n}{\alpha} \summation{m}{\beta} \end{document}. This site is not necessarily made for asking for solutions of homework problems. (I apologize for this comment if this is not a homework problem) –  Dec 15 '19 at 19:10
  • 1
    You ask, "What do they mean by ...?" Who is "they"? – Mico Dec 15 '19 at 20:03
  • @Schrödinger'scat Why \ensuremath? That is clearly misplaced here. – Henri Menke Dec 16 '19 at 01:19
  • @HenriMenke No, it is not, and please please do not make up any reason why it would be, we both know that it is not misplaced. –  Dec 16 '19 at 02:04
  • @Schrödinger'scat When not to use \ensuremath for math macro? I'm with Enrico on this one. – Henri Menke Dec 16 '19 at 02:13
  • @HenriMenke I am aware of these posts, and they do certainly not say in any way that what I am suggesting is inappropriate. My proposal is, however, merely to avoid the discussions "your suggestion causes an error" which you get if the user does not use math mode where they should. Ironically this triggered now another senseless discussion. To be clear, my suggestion does precisely provide a command that produces the very output that it is asked to produce. –  Dec 16 '19 at 02:19
  • Thanks allot for help, understand now what I'm supposed to do. – peachblossom Dec 16 '19 at 17:04

2 Answers2

2

I don't understand what I'm supposed to do.

I'm virtually certain that you are supposed to

  • create a TeX or LaTeX command -- a "macro" in TeX jargon -- called \summation which takes two arguments, and

  • show two uses of this macro, say, \summation{n}{\alpha} and \summation{m}{\omega}.

Presumably, you are also supposed to create a sample PlainTeX or LaTeX document which (a) features the macro definition and the two uses of \summation and (b) compiles without crashing.

First, a PlainTeX-based solution:

\def\summation#1#2{\sum_{i=0}^{#1}#2_i} % use in math mode only
$\summation{n}{\alpha}$, $\summation{m}{\omega}$
\bye

Second, a LaTeX-based solution:

\documentclass{article}
\newcommand\summation[2]{\sum_{i=0}^{#1}#2_i} % use in math mode only
\begin{document}
$\summation{n}{\alpha}$, $\summation{m}{\omega}$
\end{document}
Mico
  • 506,678
1

You can create this command by adding the following line in the preamble of your latex document:

\newcommand{\summation}[2]{$\sum\limits_{i=0}^{#1} #2 _i$}

And the question asks to use this command within text for different arguments. For example, you can add this code to the main latex file:

This is an example when we type \verb|\summation{n}{\alpha}| 
within text yields \summation{n}{\alpha} and if we change parameters 
as \verb|\summation{k}{\beta}| we get \summation{k}{\beta} after compilation.

after compiling you will get:

enter image description here

It is just to show that you have created a new command and you use it in your document in two different cases.

Sorpresa
  • 176
  • It's typographically rather questionable to use \sum\limits for inline-math material. Moreover, the OP's explicitly given task is to show a summation operation with the limits of summation to the side of the summation symbol. – Mico Dec 16 '19 at 00:36
  • 1
    Indeed, I should remove \limits and keep only \sum. Thanks :) – Sorpresa Dec 16 '19 at 11:45
  • Thanks allot for help, understand now what I'm supposed to do. – peachblossom Dec 16 '19 at 17:04