Questions tagged [conditional]

Questions about programming or mathematical constructs that enable verification, selection, or branching behavior when one or more criteria are determined to be True.

319 questions
Filter by
Sorted by
Tagged with
115 views

How to include conditional statements in NIntegrate?

I have a function g which is the result of another integrated function f. This function (f) ...
48 views

Getting unexpected results form If expressions [closed]

I'm mystified by this: g[a_, b_, c_] := Module[{d}, d = If[(b < 1), b, b + 1]; If[a < b, d = 0.]; d*c] g[a, 20, 40] ...
91 views

Is Mathematica computing the conditional expectation correctly?

Given a simple case of say 2 independent trials each with probability of success 1/3. Consider a random variable that is gives the 3 times the total successes. We can define this random variable in ...
48 views

Conditional formatting of Table with Join and Transpose

A simple example of what I'm trying to do (but I want to be able to apply the same principle to much larger data sets and with more complicated functions for low ...
71 views

...
32 views

Checking if an edge is an element of a list of edges

I have graph whose edge list is given by ...
46 views

How do I modify my code to detect cycles in this Collatz-like recursion?

A popular variant of the Collatz recursion is the following. Given a positive integer $n_i$, If $n_i$ is even, $n_{i+1}=n/2$, If $n_i$ is odd, $n_{n+1}=3n-1$. The Mathematica code I'm using to ...
34 views

Highlight largest value in each column of Table // TableForm

I am exploring colossally abundant numbers; in particular the set of specific 'critical epsilon values'. I table the function DivisorSigma[1, n]/n^(1 + \[Epsilon]) ...
425 views

List, map function based on a condition

I have the following list: ...
59 views

Combining With, If and SetDelayed

I just noticed that With[{x = 1}, If[x == 0, 0, 1]] returns 1 (as I expected) but ...
34 views

Why does NumberForm disturb the output of Rationalize? [duplicate]

I am currently using Rationalize after NumberForm in order to check if the some values of my function are in the ...