So I want to be able to count the number of neighbour pairs of opposite sign in a list of 1's and -1's (eg. 1 for {1,1,1,-1,-1} and 3 for {1,-1,1,-1,-1}), but I can't work out the pattern matching syntax in Mathematica even after reading the documentation. I was thinking to use the Count function. Anybody able to help, please?(adsbygoogle = window.adsbygoogle || []).push({});

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Basic Mathematica pattern matching

Loading...

Similar Threads - Basic Mathematica pattern | Date |
---|---|

New to mathematica, some basic help needed | May 10, 2014 |

Basic Mathematica help | Dec 15, 2010 |

Basic Mathematica question | Apr 28, 2010 |

Basic help with Mathematica 5.2, please? | Jan 21, 2007 |

Basic Mathematica Help | Feb 16, 2006 |

**Physics Forums - The Fusion of Science and Community**