diff --git a/pybamm/expression_tree/array.py b/pybamm/expression_tree/array.py
index 3c247db5..2cc5c5a6 100644
--- a/pybamm/expression_tree/array.py
+++ b/pybamm/expression_tree/array.py
@@ -25,7 +25,7 @@ class Array(pybamm.Symbol):
 
     def __init__(self, entries, name=None, domain=[]):
         if name is None:
-            name = str(entries)
+            name = "Array of shape {!s}".format(entries.shape)
         super().__init__(name, domain=domain)
         self._entries = entries
 
diff --git a/pybamm/expression_tree/matrix.py b/pybamm/expression_tree/matrix.py
index 7df8b706..9cd61e1e 100644
--- a/pybamm/expression_tree/matrix.py
+++ b/pybamm/expression_tree/matrix.py
@@ -22,4 +22,6 @@ class Matrix(pybamm.Array):
     """
 
     def __init__(self, entries, name=None, domain=[]):
+        if name is None:
+            name = "Matrix of shape {!s}".format(entries.shape)
         super().__init__(entries, name=name, domain=domain)
diff --git a/pybamm/expression_tree/symbol.py b/pybamm/expression_tree/symbol.py
index 5b9ae47c..1436246d 100644
--- a/pybamm/expression_tree/symbol.py
+++ b/pybamm/expression_tree/symbol.py
@@ -96,7 +96,9 @@ class Symbol(anytree.NodeMixin):
         which would then mess with loop-checking in the anytree module
         """
         return hash(
-            (self.__class__, self.name) + tuple([child.id for child in self.children])
+            (self.__class__, self.name)
+            + tuple([child.id for child in self.children])
+            + tuple(self.domain)
         )
 
     def render(self):
@@ -181,9 +183,13 @@ class Symbol(anytree.NodeMixin):
         return self._name
 
     def __repr__(self):
-        """returns the string `__class__(id, name, parent expression)`"""
-        return "{!s}({}, {!s}, {!s})".format(
-            self.__class__.__name__, hex(self.id), self._name, self.parent
+        """returns the string `__class__(id, name, children, domain)`"""
+        return "{!s}({}, {!s}, children={!s}, domain={!s})".format(
+            self.__class__.__name__,
+            hex(self.id),
+            self._name,
+            [str(child) for child in self.children],
+            [str(subdomain) for subdomain in self.domain],
         )
 
     def __add__(self, other):
diff --git a/pybamm/expression_tree/vector.py b/pybamm/expression_tree/vector.py
index b2abb123..ad7c2b1e 100644
--- a/pybamm/expression_tree/vector.py
+++ b/pybamm/expression_tree/vector.py
@@ -24,6 +24,8 @@ class Vector(pybamm.Array):
     """
 
     def __init__(self, entries, name=None, domain=[]):
+        if name is None:
+            name = "Vector of shape {!s}".format(entries.shape)
         super().__init__(entries, name=name, domain=domain)
 
 
@@ -46,7 +48,7 @@ class StateVector(pybamm.Symbol):
 
     def __init__(self, y_slice, name=None, domain=[]):
         if name is None:
-            name = str(y_slice)
+            name = "StateVector with slice '{!s}'".format(y_slice)
         super().__init__(name=name, domain=domain)
         self._y_slice = y_slice
 

improve string represenation of nodes in the expression tree
for debugging. Improve these things:
- matrices are printed out fully, need some summary (e.g. size)
- parents of the node are printed out, not terribly informative, perhaps use children instead
diff --git a/tests/test_expression_tree/test_matrix.py b/tests/test_expression_tree/test_matrix.py
index 1df04518..65a73f38 100644
--- a/tests/test_expression_tree/test_matrix.py
+++ b/tests/test_expression_tree/test_matrix.py
@@ -22,13 +22,13 @@ class TestMatrix(unittest.TestCase):
         self.assertEqual(self.mat.size, 9)
 
     def test_matrix_evaluate(self):
-        self.assertTrue((self.mat.evaluate() == self.A).all(), self.A)
+        np.testing.assert_array_equal(self.mat.evaluate(), self.A)
 
     def test_matrix_operations(self):
-        self.assertTrue(((self.mat + self.mat).evaluate() == 2 * self.A).all())
-        self.assertTrue(((self.mat - self.mat).evaluate() == 0 * self.A).all())
-        self.assertTrue(
-            ((self.mat * self.vect).evaluate() == np.array([5, 2, 3])).all()
+        np.testing.assert_array_equal((self.mat + self.mat).evaluate(), 2 * self.A)
+        np.testing.assert_array_equal((self.mat - self.mat).evaluate(), 0 * self.A)
+        np.testing.assert_array_equal(
+            (self.mat * self.vect).evaluate(), np.array([5, 2, 3])
         )
 
     def test_matrix_modification(self):
diff --git a/tests/test_expression_tree/test_symbol.py b/tests/test_expression_tree/test_symbol.py
index a7b764d6..2d123a79 100644
--- a/tests/test_expression_tree/test_symbol.py
+++ b/tests/test_expression_tree/test_symbol.py
@@ -141,33 +141,44 @@ class TestSymbol(unittest.TestCase):
         """
         a = pybamm.Symbol("a")
         b = pybamm.Symbol("b")
+        c = pybamm.Symbol("c", domain=["test"])
+        d = pybamm.Symbol("d", domain=["test"])
         hex_regex = r"\-?0x[0-9,a-f]+"
-        self.assertRegex(a.__repr__(), r"Symbol\(" + hex_regex + r", a, None\)")
-        self.assertRegex(b.__repr__(), r"Symbol\(" + hex_regex + r", b, None\)")
         self.assertRegex(
-            (a + b).__repr__(), r"Addition\(" + hex_regex + r", \+, None\)"
+            a.__repr__(),
+            r"Symbol\(" + hex_regex + r", a, children\=\[\], domain\=\[\]\)",
         )
         self.assertRegex(
-            (a + b).children[0].__repr__(), r"Symbol\(" + hex_regex + r", a, a \+ b\)"
+            b.__repr__(),
+            r"Symbol\(" + hex_regex + r", b, children\=\[\], domain\=\[\]\)",
         )
         self.assertRegex(
-            (a + b).children[1].__repr__(), r"Symbol\(" + hex_regex + r", b, a \+ b\)"
+            c.__repr__(),
+            r"Symbol\(" + hex_regex + r", c, children\=\[\], domain\=\['test'\]\)",
         )
         self.assertRegex(
-            (a * b).__repr__(), r"Multiplication\(" + hex_regex + r", \*, None\)"
+            d.__repr__(),
+            r"Symbol\(" + hex_regex + r", d, children\=\[\], domain\=\['test'\]\)",
         )
         self.assertRegex(
-            (a * b).children[0].__repr__(), r"Symbol\(" + hex_regex + r", a, a \* b\)"
+            (a + b).__repr__(),
+            r"Addition\(" + hex_regex + r", \+, children\=\['a', 'b'\], domain=\[\]\)",
         )
         self.assertRegex(
-            (a * b).children[1].__repr__(), r"Symbol\(" + hex_regex + ", b, a \* b\)"
+            (c * d).__repr__(),
+            r"Multiplication\("
+            + hex_regex
+            + r", \*, children\=\['c', 'd'\], domain=\['test'\]\)",
         )
         self.assertRegex(
-            pybamm.grad(a).__repr__(), r"Gradient\(" + hex_regex + ", grad, None\)"
+            pybamm.grad(a).__repr__(),
+            r"Gradient\(" + hex_regex + ", grad, children\=\['a'\], domain=\[\]\)",
         )
         self.assertRegex(
-            pybamm.grad(a).children[0].__repr__(),
-            r"Symbol\(" + hex_regex + ", a, grad\(a\)\)",
+            pybamm.grad(c).__repr__(),
+            r"Gradient\("
+            + hex_regex
+            + ", grad, children\=\['c'\], domain=\['test'\]\)",
         )
 
     def test_symbol_visualise(self):

pip install -e .[dev,docs]
parse_log_pytest
requirements.txt
pytest flake8
3.6
requirements.txt requirements-dev.txt requirements-docs.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
anyio==3.6.2
anytree==2.8.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
async-generator==1.10
attrs==22.2.0
Babel==2.11.0
backcall==0.2.0
bleach==4.1.0
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
comm==0.1.4
contextvars==2.4
cycler==0.11.0
dataclasses==0.8
decorator==5.1.1
defusedxml==0.7.1
docutils==0.18.1
entrypoints==0.4
flake8==3.9.2
guzzle-sphinx-theme==0.7.11
idna==3.10
imagesize==1.4.1
immutables==0.19
importlib-metadata==4.8.3
iniconfig==1.1.1
ipykernel==5.5.6
ipython==7.16.3
ipython-genutils==0.2.0
ipywidgets==7.8.5
jedi==0.17.2
Jinja2==3.0.3
json5==0.9.16
jsonschema==3.2.0
jupyter==1.1.1
jupyter-client==7.1.2
jupyter-console==6.4.3
jupyter-core==4.9.2
jupyter-server==1.13.1
jupyterlab==3.2.9
jupyterlab-pygments==0.1.2
jupyterlab-server==2.10.3
jupyterlab_widgets==1.1.11
kiwisolver==1.3.1
MarkupSafe==2.0.1
matplotlib==3.3.4
mccabe==0.6.1
mistune==0.8.4
nbclassic==0.3.5
nbclient==0.5.9
nbconvert==6.0.7
nbformat==5.1.3
nest-asyncio==1.6.0
notebook==6.4.10
numpy==1.19.5
packaging==21.3
pandas==1.1.5
pandocfilters==1.5.1
parso==0.7.1
pexpect==4.9.0
pickleshare==0.7.5
Pillow==8.4.0
pluggy==1.0.0
prometheus-client==0.17.1
prompt-toolkit==3.0.36
ptyprocess==0.7.0
py==1.11.0
-e git+https://github.com/tinosulzer/PyBaMM.git@8749cbfa644e8ca59d692a46501e58f926e47d1b#egg=pybamm
pycodestyle==2.7.0
pycparser==2.21
pyflakes==2.3.1
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
pyzmq==25.1.2
requests==2.27.1
scipy==1.5.4
Send2Trash==1.8.3
six==1.17.0
sniffio==1.2.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
terminado==0.12.1
testpath==0.6.0
tomli==1.2.3
tornado==6.1
traitlets==4.3.3
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
webencodings==0.5.1
websocket-client==1.3.1
widgetsnbextension==3.6.10
zipp==3.6.0

name: PyBaMM
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - anyio==3.6.2
      - anytree==2.8.0
      - argon2-cffi==21.3.0
      - argon2-cffi-bindings==21.2.0
      - async-generator==1.10
      - attrs==22.2.0
      - babel==2.11.0
      - backcall==0.2.0
      - bleach==4.1.0
      - cffi==1.15.1
      - charset-normalizer==2.0.12
      - comm==0.1.4
      - contextvars==2.4
      - cycler==0.11.0
      - dataclasses==0.8
      - decorator==5.1.1
      - defusedxml==0.7.1
      - docutils==0.18.1
      - entrypoints==0.4
      - flake8==3.9.2
      - guzzle-sphinx-theme==0.7.11
      - idna==3.10
      - imagesize==1.4.1
      - immutables==0.19
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - ipykernel==5.5.6
      - ipython==7.16.3
      - ipython-genutils==0.2.0
      - ipywidgets==7.8.5
      - jedi==0.17.2
      - jinja2==3.0.3
      - json5==0.9.16
      - jsonschema==3.2.0
      - jupyter==1.1.1
      - jupyter-client==7.1.2
      - jupyter-console==6.4.3
      - jupyter-core==4.9.2
      - jupyter-server==1.13.1
      - jupyterlab==3.2.9
      - jupyterlab-pygments==0.1.2
      - jupyterlab-server==2.10.3
      - jupyterlab-widgets==1.1.11
      - kiwisolver==1.3.1
      - markupsafe==2.0.1
      - matplotlib==3.3.4
      - mccabe==0.6.1
      - mistune==0.8.4
      - nbclassic==0.3.5
      - nbclient==0.5.9
      - nbconvert==6.0.7
      - nbformat==5.1.3
      - nest-asyncio==1.6.0
      - notebook==6.4.10
      - numpy==1.19.5
      - packaging==21.3
      - pandas==1.1.5
      - pandocfilters==1.5.1
      - parso==0.7.1
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pillow==8.4.0
      - pluggy==1.0.0
      - prometheus-client==0.17.1
      - prompt-toolkit==3.0.36
      - ptyprocess==0.7.0
      - py==1.11.0
      - pycodestyle==2.7.0
      - pycparser==2.21
      - pyflakes==2.3.1
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pyrsistent==0.18.0
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyzmq==25.1.2
      - requests==2.27.1
      - scipy==1.5.4
      - send2trash==1.8.3
      - six==1.17.0
      - sniffio==1.2.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - terminado==0.12.1
      - testpath==0.6.0
      - tomli==1.2.3
      - tornado==6.1
      - traitlets==4.3.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - wcwidth==0.2.13
      - webencodings==0.5.1
      - websocket-client==1.3.1
      - widgetsnbextension==3.6.10
      - zipp==3.6.0
prefix: /opt/conda/envs/PyBaMM

tests/test_expression_tree/test_symbol.py::TestSymbol::test_symbol_repr
tests/test_expression_tree/test_matrix.py::TestMatrix::test_array_wrapper tests/test_expression_tree/test_matrix.py::TestMatrix::test_matrix_evaluate tests/test_expression_tree/test_matrix.py::TestMatrix::test_matrix_modification tests/test_expression_tree/test_matrix.py::TestMatrix::test_matrix_operations tests/test_expression_tree/test_symbol.py::TestSymbol::test_has_spatial_derivatives tests/test_expression_tree/test_symbol.py::TestSymbol::test_multiple_symbols tests/test_expression_tree/test_symbol.py::TestSymbol::test_symbol_domains tests/test_expression_tree/test_symbol.py::TestSymbol::test_symbol_evaluation tests/test_expression_tree/test_symbol.py::TestSymbol::test_symbol_init tests/test_expression_tree/test_symbol.py::TestSymbol::test_symbol_is_constant tests/test_expression_tree/test_symbol.py::TestSymbol::test_symbol_methods tests/test_expression_tree/test_symbol.py::TestSymbol::test_symbol_visualise
pybamm/expression_tree/array.py pybamm/expression_tree/vector.py pybamm/expression_tree/matrix.py pybamm/expression_tree/symbol.py
pybamm/expression_tree/array.py pybamm/expression_tree/vector.py pybamm/expression_tree/matrix.py pybamm/expression_tree/symbol.py