# 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.

43 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
107 views

### Reduce[Sin[x]==0,x] splitting odd and even multiples of Pi

as from Title, I'm wondering why Mathematica does not automatically give a single, simple solution for the problem Reduce[Sin[x] == 0, x] for which I obtain the ...
211 views

### Is it possible to do probabilistic programming by variable elimination with plain Mathematica 10 or later?

Using frameworks like Figaro it is possible to do probabilistic programming by variable elimination to build a probabilistic model and then run inferences against it in a very intuitive way. Example: ...
866 views

### When are If, Piecewise, Switch, and Which interchangeable and when are they not?

Experimenting with joint dependent distributions via the TransformedDistribution function, I used the following to derive a distribution where the second variate is ...
70 views

523 views

### How can I perform a scan and plot of a parameter space?

I have three functions dependent on three independent variables, like so: H[u,m,s] S[u,m,s] SH[u,m,s] However, I don't actually know these functions--they are ...
101 views

### Using Which with a list

In a While loop I have: Y1 = Table[A1[[k]], {k, 1, j}]; c1 = Last[Flatten[Position[Y1, 1]]]; a1p[j] = Which[c1 == j, 0, c1 < j, t[j] - t[c1], True, t[j]]; I ...
209 views

### What is the symbol FENone for?

I have run into the symbol FENone multiple times. What is this symbol, and what is it designed to indicate? All I could find is that FE indicates the front-end, but it's unfortunately a very ...
174 views

### Recursion and If-statements

So I'm trying to write a recursion module in Mathematica (specifically for strassen multiplication but this doesn't matter). My issue is I don't really know how If ...
29 views

### How do I set a control in an “If” statement?

I have the following lines of code: ...
41 views

### How do I correctly set up an “If” statement?

I have the following list of variables: z=1; a={{A,B,C,D},{A,A,E,W},{B,B,B,B},{S,R,B,T,D},{M,M,M,M}} What I'm trying to do is set up a statement that reads ...
20 views

### Optimization of storages capacity

Consider a series of storages where different goods are added into daily. I would like to optimize the distribution of these goods between the storages in a way which takes into account some ...
40 views

44 views

### Using If statement to evaluate lists

I have a list of x,y values and i am finding the distance between each point, So for 20 point in my file I have something like this, ...
53 views

...
54 views

### Mathematica gives uncessary condition for integration of $(b - s)^\alpha(s - a)^\beta$

When I compute the integral of $(b - s)^\alpha(s - a)^\beta$ on $[a,b]$ by the following command: ...
75 views

### 3D-plot of a maximization of a definite integral

I'm applying the answer (If method) suggested by 'ThatGravityGuy' in this post in a more complicated case. Consider my objective function (pardon its formidable ...
56 views

### solving inside for loop and sorting x which are less than 3 and greater than -3 from the list

I give a simple function code here... Clear[a, x, t]; s = ParametricNDSolve[{x'[t] + a*x[t] == 0, x==1}, x, {t, 0, 100}, {a}] y = x /. s y /. s I ...
84 views

### Is there a way to find the Region of Convergence along with the Laplace Transform?

This is what I've tried so far. Is the inequality of the conditional expression the Region of Convergence? Why doesn't LaplaceTransform Generate conditions here? ...
62 views

### How can I better formulate a conditional statement?

To solve optimization problems I have seen this: Is there a more elegant way to do this with alternative conditional expressions? Is there something equivelant to ...
46 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 ...
58 views

### How can I select the true expansion?

I have a series expansion which gives two results. Series[-(1/ Sqrt[-1 + x + x z1^2 \[Chi]^2]) , {x, 0, 1}] /. y -> x I want only the series which is true. ...
42 views

### How to carry out a different function based on weighted probabilities

I am looking to carry out a function based on weighted probabilities I have looked at using If[] and random numbers but ...
388 views

### Can For loop be used with multiple conditions?

I am wondering if For could be used with multiple conditions (tests). For the simple example ...
35 views

...
72 views

### The conditions used in Sum or ParallelSum: Calling a function/variable

For some reason, I encounter a problem when doing the Sum and ParallelSum (or doing the Do or ParallelDo, e.g. such as the issue here), I figured that the potential cause of the problem can be ...
75 views

### How to put conditional for a iterator?

I have the next code: f = Table[ mtxt[[p[[i, j]] - wi ;; p[[i, j]] + we]], {i, n}, {j, m}] I want that wi and we have different values depend of the j value. For ...
80 views

### Solving a system of equations with conditional functions

With your help i am getting closer to the solution of my problem. I know that the code is long but most of it is boring definition. At the beginning i am just defining function, which works at the ...
342 views

### Use If condition with ListPlot

Here is my code to use If condition with PLot: ...