# Questions tagged [functions]

Questions about the use of built-in Mathematica functions, including pure functions.

3,309 questions
Filter by
Sorted by
Tagged with
113 views

### I can't find the reason for the flat chart [closed]

That's what I need to do. There is a function Φ[α,β,z] in which the replacement of k1 and k2 is used. Thus, an analytical representation of the integral characteristic of the solution of the problem ...
357 views

### How to use PlusMinus properly?

As an easy exercise, I would like to define a function $$f(x)=\pm x$$ and be able to ListPlot the function for some discrete values. Here is what I tried ...
• 397
1 vote
28 views

### Efficient construction of a formal polynomial using list manipulations

I have a code which is probably extremely inefficient given my inexperience with Mathematica list manipulation. Take as input data: ...
• 1,287
103 views

### Introduce formal symbols indexed by natural numbers

I'm going to describe a toy example here which I'm hoping with some help, I can then soup up into the more complex application I have in mind. Suppose the input is a list of lists, and for now take ...
• 1,287
236 views

### Why does this Fourier transform not match the formula?

From this page: So I'm trying to get that result in Mathematica. From the fourier formula above, we can see that {a, b} = {1,-1}. However, the code below returns a different result. ...
• 1,750
1 vote
99 views

• 51
66 views

### Packed/Unpacked array - what object/like 0 or 1?/how to check/ [duplicate]

In Mathematica, there is a concept called packed array. ...
• 2,451
32 views

### Recursive error encountered when updating rules of assignment [closed]

I'm working on a problem which requires associating a single (complex) number with a pair of binary vectors. I'm doing this by creating a set of assignments through a function I call ...
• 595
90 views

### How to remove duplicates from a pair with some conditions?

Here is a simpler example of my real problem. Assume that I have a groups which includes sublists as follows: ...
• 2,147
36 views

### Extracting function domain from a finite set of assignments

Suppose we define a function through a finite collection of equalities, e.g., f[1] = 1; f[26] = 321 and so on. We can extract the set of output values by running <...
• 595
39 views

### Delete list item if message is thrown

I have a nested list with each element containing FindRoot like this: {FindRoot[a,b], FindRoot[c,d], FindRoot[e,f],...} ...
• 147
181 views

### Find shortest distance between two functions [closed]

The problem is to find the shortest distance for given functions: y=x^2+7/2 and y=ln(x) without using Minimize. Does anyone have any idea how to approach this ...
• 51
527 views

### How can I use variables instead of slots in DeleteCases?

Here is a toy example to illustrate my problem. I have a list of 3-tuples and I want to delete elements from this list that satisfy a condition shown below. ...
• 1,750
31 views

### Using the recursion index to compare with a value in another list

I am trying to generate an arrivals and departures plot for a signalised junction with the following parameters: lambda: rate of arrival c: cycle length of traffic lights g: length of time signal is ...
122 views

### How to get a function from a string?

I'm trying to create a function that takes in input a function written as string and the return it applying a ToExpression and an Evaluate (Code below). The goal of this function is to transform the ...
• 69
480 views

### How to simplify function with Abs?

I'm trying to remove Abs below. ...
• 1,750
794 views

### How can I apply a function only to even-index elements of a list?

A = {1, 2, 3, 4, 5} and, Dd[P_] := P + 1 How can I map "Dd" into "A" such that the outcome is: {1, 3, 3, 5, ...
• 61
53 views

### RunProcess : Save directly to Mathematica Variable

I can convert mysource.jpg to myresult.jpg using an external program myprog.exe, and set a ...
• 2,451
61 views

### Stop NotebookEvaluate before the end of a notebook depending on test inside this notebook

CONTEXT: Hello, I have 2 notebooks, lets call them "Main.nb" and "FileProcessing.nb". In my "Main.nb" I have a Do loop where the iterating parameter goes over 300 .csv ...
• 31
117 views

### Speed Up the Gelman-Rubin-History function

A bit of background information I have created a function to calculate the convergence of the Gelman Rubin diagnostic (useful in Bayesian analysis). The function seems to work as I want, however I ...
26 views

### Confusing abnormalities observed when counting a specific operator in an expression [duplicate]

Recently I have met with some confusing abnormalities when trying to determine if there is a specific operator (usually Plus[] ) in an expression by programming. ...
• 289
137 views

### A question related to the usage of LegendLayout -> {"Row", 1}

I saw this piece of code from an answer by @Syed here. ...
• 2,147
190 views

### Why is the matrix "mat" not modified here?

Why is the matrix mat not modified here? I expected it changes with list1 and list2 so that <...
• 1,750
28 views

### How to combine several similar terms in computation of algebra?

As the title shows, how can I combine several similar terms when I try to compute some complex algebra terms. For example, I want the result of \frac{1}{6} b_1 \left(-\left(b_2^2 \left(-2 \sqrt{3} e^...
• 101
37 views

### Eliminate point of function

So I have a function f(x) and I know that for x=x1 the function goes to infinity. I want to remove this point of the function and a "new" function that interpolates from x1- to x1+ at that ...
143 views

### Double quotes as a 'function' (verbatim ToString?)

Can we construct a function F such that F makes any typed text into a string. Just like double quotes. ...
• 2,451
42 views

### Non-Gaussian Hidden Markov Process

I'm using estimated process to simulation a Hidden Markov Process with two states using data derived from different ARIMA processes ...
255 views

### How can I delete duplicates with Abs?

I have this list with some duplicate elements and I want to delete duplicate ones. ...
• 1,750
103 views

### Why is this region in RegionPlot3D wrong?

I believe this is simple, but I can't wrap my head around forming region for RegionPlot3D. I have been reading and trying to understand how to write the region but ...
• 1,750
1 vote
107 views

### Why does this TeXForm cause many errors?

Why do I get this error? I don't do any calculation with this. I just want to use TeXForm and then wrap MaTeX around it. ...
• 1,750
1k views

### Why does this triple integral take so long?

How can I compute this triple integral? I tried this but it has been running for a long time and not return result yet. ...
• 1,750
48 views

### Function for probability distribution approximation of a compound random variable

In the book (Klugman et al, 2019) on can see the Example 9.12. The number of claims has a Poisson–ETNB distribution with Poisson parameter 𝜆 = 2 and ETNB parameters 𝛽 = 3 and 𝑟 = 0.2. The claim ...
• 111
226 views

### Three equation solving analytically in Mathematica

Im doing coding in iterative schemes but I do not know to solve three equations analytically in Mathematica step by step. For example I given thre equations in the attached figure. I want to solve ...
• 169
169 views

### Why is this RevolutionPlot3D empty in the middle around x = 0.5?

Why is this RevolutionPlot3D empty in the middle around x = 0.5 like this? ...
• 1,750
174 views

### How can I fill this region?

How can I fill this region? Plot[{x^2, x^2 - 2 x + 1}, {x, -2, 2}, PlotRange -> {Automatic, {0, 0.5}}, GridLines -> Automatic]
• 1,750
1 vote
78 views

### Ploting a function

I just ploted y[x],y'[x] but I would like to plot other function which is g[x] based on my solution but it can't plot this ??!! ...
• 381
123 views

### How to insert some number of parentheses into an expression to get smallest integer result?

Assume that I have an expression like this (without evaluating) expr = 1/2/3/4/5/6/7/8/9/10 You can insert some number of parentheses into the expression above to ...
• 2,147