2
$\begingroup$
ΔF = 0.0025;
Subscript[R, s] = Quantity[0.8, "SolarRadius"];
P = Quantity[8, "Days"];

When I solve for Rp all works great:

Subscript[R, s] = Quantity[0.8, "SolarRadius"];
ΔF = 0.0025; (*Transit depth*)
Solve[{Rp^2/Subscript[R, s]^2 == ΔF, Rp > 0}, Rp, Reals ]

but when I solve for a variable with a subscript (Subscript[R, p] instead of Rp), Mathematica finds no solution:

Subscript[R, s] = Quantity[0.8, "SolarRadius"];
ΔF = 0.0025; (*Transit depth*)
Solve[
  {Subscript[R, p]^2/Subscript[R, s]^2 == ΔF, Subscript[R, p] > 0}, 
  Subscript[R, p], Reals ]

enter image description here

enter image description here

Is there any way to avoid this and treat variables with subscript as normal (separate) variable names?

Interestingly, Mathematica seems to have no problem when, for example, a is given a subscript. It's only an issue when the variable that I solve for has a subscript.

$\endgroup$
8
  • 1
    $\begingroup$ With 11.1.1 for Mac OS X x86 (64-bit) (April 27, 2017) everything works as expected $\endgroup$
    – yarchik
    Jan 1, 2021 at 12:28
  • 7
    $\begingroup$ Don't use subscripts, you will be better of with regular variables. $\endgroup$
    – yarchik
    Jan 1, 2021 at 12:32
  • 5
    $\begingroup$ I have to agree with yarchik though. Don't use subscripts, or at least only use them for display purposes. You'll find the same advice in many questions on this site. A Subscript expression is not a Symbol and there are lots of parts of the language which don't work properly when you use subscripts instead of symbols for your variables. $\endgroup$ Jan 1, 2021 at 13:18
  • 2
    $\begingroup$ Good practice is to avoid variable that start with capital letter. $\endgroup$
    – vi pa
    Jan 1, 2021 at 22:27
  • 1
    $\begingroup$ I’m voting to close this question because the problem the OP is experiencing cannot be reproduced; I suspect it is being caused by corrupted lexical elements in the OP's Mathematica notebook. $\endgroup$
    – m_goldberg
    Jan 2, 2021 at 4:42

0

Browse other questions tagged or ask your own question.