1
$\begingroup$

I'm getting started with Mathematica, as I have been using Maple in the past. Is it possible to define two variables $\alpha_1, \alpha_2$ and then still use $\alpha$ as a parameter of a function and, for example, plot it.

$\alpha_1:=5$ $\alpha_2:=10$

$a:=\sum_{i=1}^{2}\alpha_i \cdot \alpha$

Plot[a,{α,0,10}]

I have found that I have to use a different variable, such as $\tilde{\alpha}$ for that to work. Any way around that?

On a side note, is it possible to have Mathematica treat an expression such as $a_b$ as one variable, but still understand subscripts on other defined variables such as $a_1, a_2, …$? I understand that the Symbolize package is used for that, but did not quite get how to symbolize only specific expressions.

I apologize for my lack of deeper understanding in Mathematica, but that's what you get when you use something as soothing to the eye as Maple ;)

$\endgroup$
1
$\begingroup$

As you say, it is best not to use the same variable inside and outside of Subscript. However, nothing is stopping you from using a string inside of Subscript:

Subscript["α", 1] = 5;
Subscript["α", 2] = 10;

a := Sum[Subscript["α", i] α, {i, 2}]

Plot[a, {α, 0, 10}]

enter image description here

Can you explain why you need to treat $a_b$ as one variable?

$\endgroup$
  • $\begingroup$ It is a mostly readability - "ab" would of course work as a variable, but ultimately I want to print my worksheets and then have them look nice. I've been using the Palettes (Basic Math Assistant) for graphical fractions etc. for that very purpose. Am I confusing Mathematica too much with LaTeX? $\endgroup$ – Wasserwaage Sep 24 '18 at 14:59
  • $\begingroup$ @Wasserwaage In what context does Subscript[a, b] (or Subscript["a", "b"]) not work as a variable? $\endgroup$ – Carl Woll Sep 24 '18 at 15:01
  • $\begingroup$ It works, I am just trying to keep the potential for errors in my worksheet to a minimum - and defining Subscript[a,b] would have seemed like a sensible way to do that. Thanks! $\endgroup$ – Wasserwaage Sep 24 '18 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.