3
$\begingroup$

I saw the topics here, but it's not clear at all how to clear variables with sub.

enter image description here

Ideas?

Btw, does anybody know why Mathematica won't give me the numerical value of the 4-th zeta function derivative at 0? It displays it symbolically, but not numerical value. enter image description here

$\endgroup$
0
7
$\begingroup$

Welcome to MMA SE! In general please post code instead of images.

Short answer: Subscript[a,0] =. (That's Unset in the docs.)

Long answer: and, well, although it's actually kind of a non-answer, my genuine advice here is: don't use subscripted variables in the first place, since they're pretty finicky. Instead use a[0], a[1], etc.

For one, you'll notice that a in your code is blue, not black, meaning there are no definitions associated with it. The definitions you've made have actually gotten attached to the symbol Subscript, so you'd have to either Clear[Subscript] to clear all subscripted values, or use Subscript[a,0] =.

Since every expression in Mathematica is either an atom or of the form f[a, b, c, ...] (stuff that seems like it isn't is, most often, just syntactic sugar), using a[i] is generally a lot more compatible with the rest of mathematica and therefore easier to code with. Consider Array[a, 3] which gets you {a[1], a[2], a[3]}; there are many more examples.

If you want to use this, but still want it to look like a subscript, you can use

Format[a[i_]] := Subscript[a, i]

and it will print as a subscript in output expressions.

Of course, if you're just doing one or two things, there's no problem using Subscript! But if you're doing a lot it can get a bit frustrating, and might be easier to use this structure.

I wanted to leave this as a comment, since it's more just "best practices" stuff than an answer per se, but it was too long, so here you go :)

$\endgroup$
2
  • $\begingroup$ Thanks. I have a different question now. Lol. Do you know why Mathematica won't give me the numerical value of the 4-th zeta function derivative at 0? It displays it symbolically, but not numerical value. $\endgroup$
    – user81908
    Oct 3 at 5:23
  • $\begingroup$ @user81908 Have you tried applying N? Derivative[4][Zeta][0] // N (which is what it seems you have up there) works for me. Again, please post code instead of images, otherwise no one can copy your code and test it to help out! $\endgroup$
    – thorimur
    Oct 3 at 5:32

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