# Questions tagged [expression-test]

150 questions
Filter by
Sorted by
Tagged with
40 views

### How can I show that the equation holds?

Suppose we have the following data: $r=\frac{vk}{h^2}$ $u[i,j]$ is a function of two variables with $i,j$ integers. $\frac{u[i,j+1]-u[i,j]}{k}=v\frac{u[i+1,j]-2u[i,j]+u[i-1,j]}{h^2}$ Then I would ...
60 views

### How to test if $ⅈ$ is in an expression?

From this answer https://mathematica.stackexchange.com/a/9773/68791 and according to the documentation: FreeQ[list,form] test whether form occurs nowhere in ...
249 views

### How do I check if proportion of values in list are mostly positive?

I'd like to return a a boolean variable that tells me whether numbers in a list are mostly positive. For example: a = {3,2,3,4,-1,-2,-5,3} There are 5 ...
628 views

### how to write a condition for all elements of a list

I have a list a={no,no,no,no}; now I can want to an If so that if all elements of the above list are "yes" it does something ...
56 views

### TrueQ returning False on true, non-numerical statement

I'm trying to test the following logical statement: state = {{1,1,1}}; Or[state != 0, state != Null] but it's returning False ...
138 views

### Specifying that function argument is positive

Struggling with something basic. Suppose when defining f[x_] the outcome depends on Sign[x]. When calling this function, how do I tell Mathematica the sign of the argument? My attempt: ...
59 views

### Test if function of multiple variables is positive or negative given variable constraints

I have a function of multiple variables (5 to be exact). I would like to know if this function is positive or negative given certain constraints on each of the 5 variables. Here is a simplified ...
47 views

### How does one test whether or not an integration has succeeded?

This must be a very simple matter--but how to address it eludes me at the moment. I have a series of integrands--and want to flag whether the symbolic integation has succeeded or not (in order to ...
83 views

### How to prove a numerical identity?

Let be a function power function f[s_, r_] := Piecewise[{{s^r, s >= 0}, {0, True}}]; And its convolution ...
36 views

### Testing which expression is greater

I have two expressions: expr1 = e^2/(8 + 4*e + e^2) and expr2 = (d^2 - 2*d*e + e^2)/(8 + d^2 - 2*d*2 - 2*d*e + 4*e + e^2) ...
848 views

### How to check is there any negative term in a large list?

I want to check if a data set of size $10^{10}$ contains any non-positive elements. Positive[Name of dataset] returns a list of ...
150 views

### Why is IsomorphicGraphQ so very slow (in this instance)

Bug introduced in 10.0 or earlier and persisting through 12.0.0 Can someone explain why the following code does not complete within a reasonable time? ...
295 views

### Is there a defined priority for pattern matching?

If you define a function g, like so: g[x_?EvenQ] := "even" g[x_?NumberQ] := "number" why will Mathematica always return ...
89 views

### How to check expression depends on symbol in a particular way

Consider these two expressions: expr1 = a d g[X, c]^2 + e g[X, f] + 3 expr2 = a d g[X, c]^2 + e X + 3 How do I check whether these expressions depend on ...
298 views

### Which second arguments is VectorQ/MatrixQ/ArrayQ optimized for?

VectorQ and similar functions (MatrixQ, ArrayQ) treat certain second arguments specially. ...
38 views

### Symbolic variable for If argument [duplicate]

i want to realize an if in this way : var=expression; If[var==0, Print[Hello]]; If[var!=0, Print[Hey]]; The system doesn't know if ...
369 views

### About shorthand notation for conditional pattern (Paul Wellin “Essentials of Programming in Mathematica”)

I am reading Paul Wellin's "Essentials of Programming in Mathematica". Mr. Wellin wrote the following in his book: There is a convenient shorthand notation for conditional patterns that is ...
15 views

### I want to extract coefficients of a linear formula. But my code didn't work [duplicate]

I want to extract coefficients of a linear formula and I wrote the following function. But it didn't work. ...
44 views

### How to use === with condition?

I have two expressions, and they are same when k is positive and x is non-zero real number. Below code gives me ...
1k views

### Why no RationalQ or RealQ?

Interesting pattern came up as I go through the homework replies of my students. Why is there no RationalQ or RealQ? We have <...
109 views

### Create my own PrimeQ function [closed]

I want to create my own functions, for example: Functions like IntegerQ,EvenQ and OddQ. My ...
42 views

### How to test consistency of two assertions without hacking

Suppose I have a set of assumptions assum = x ∈ Reals && y ∈ Reals and I want to test an assertion like ...
82 views

### TrueQ returns False [closed]

I have coefficient of some expansion: Workingexpansion = tau/n - (A tau^2)/(27 n^3) - (B tau^3)/(5832 n^5); CoefficientList[Workingexpansion, tau][[2]] ...
88 views

### Trying to generate random even number

I am trying to generate a random even number, and then try to write the list of primes that are composing it as Goldbach conjecture says. It's just a test to learn how to use mathematica, so I would ...
58 views

### Testing for membership with Bags?

Is there a faster way to test for membership in an Internal`Bag other than unpacking the whole thing like this? ...
105 views

### How to tell whether a character is a letter-like form

Is there any way to programmatically tell whether a given character is a letter or letter-like form (see this reference page for what I mean)? One idea I had was to use ...
59 views