1

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 ;)

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
Wasserwaage
  • 115
  • 5

1 Answers1

2

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?

Carl Woll
  • 130,679
  • 6
  • 243
  • 355
  • 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? – Wasserwaage Sep 24 '18 at 14:59
  • @Wasserwaage In what context does Subscript[a, b] (or Subscript["a", "b"]) not work as a variable? – Carl Woll Sep 24 '18 at 15:01
  • 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! – Wasserwaage Sep 24 '18 at 15:20