2
$\begingroup$

I have a list of expressions

listOfStuff = {-(b^(3/2)/Sqrt[7 \[Pi]]), b^(3/2)/Sqrt[7 \[Pi]]}

When I try to access the first element of this list like so

First[listOfStuff]

This yields

-(b^(3/2)/Sqrt[7 \[Pi]])

If I try to access it either of the following two ways

listOfStuff[[0]]
Part[listOfStuff, 0]

I get

List

The notebook literally just prints "List". I'm new to Mathematica but not new to programming languages in general. I really don't understand what is going on here. Any help understanding this would be appreciated.

$\endgroup$
4
  • $\begingroup$ listOfStuff[[1]] is the First element. $\endgroup$
    – corey979
    Commented Oct 9, 2019 at 19:58
  • 2
    $\begingroup$ see Head >> Properties and Relations $\endgroup$
    – kglr
    Commented Oct 9, 2019 at 20:04
  • 3
    $\begingroup$ Oh I'm dumb. Forgot arrays start at one. Thanks. $\endgroup$ Commented Oct 9, 2019 at 20:09
  • $\begingroup$ List indexing in Mathematica starts from 1. However, the index zero contains the Head which is List in this case. $\endgroup$
    – Sâu
    Commented Nov 19, 2019 at 14:40

0

Browse other questions tagged or ask your own question.