Group Abstract Group Abstract

Message Boards Message Boards

How to make Sum work with the error Sum::vexdep with dependencies

Attachments:
POSTED BY: Peter Burbery
7 Replies
POSTED BY: Gianluca Gorni

I want the code to be as robust as possible. There's a lot of helpful functions for this like GraphQ, IntegerQ, RealValuedNumericQ and RealValuedNumberQ coming in 13.3, PolynomialQ, etc.

POSTED BY: Peter Burbery

Your pattern test accepts List[Red]:

In[36]:= MatchQ[List[Red], l_?(Function[{x}, ListQ[x], {}])]

Out[36]= True
POSTED BY: Gianluca Gorni

Yes I know, I can't really think of an example where List isn't accepted. The point stands, though.

POSTED BY: Peter Burbery

I am trying to understand your function ReplacePlusMinus. First question: what is the purpose of the complicated pattern test l_?(Function[{x}, ListQ[x], {}])? Why not this simpler form:

myReplacePlusMinus[l_List] := 
 SequenceReplace[l, {x_, -x_} :> PlusMinus[x]]

Have you tried ReplacePlusMinus in these examples?

ReplacePlusMinus[{1, -1}]
ReplacePlusMinus[{-a, a}]

Are you ok with the output?

POSTED BY: Gianluca Gorni
POSTED BY: Peter Burbery
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard