# Questions tagged [functions]

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

3,326 questions
Filter by
Sorted by
Tagged with
1 view

### Additional line in the Plotting

I'm trying to plot a function, the problem is that the plot contains additional lines which originate from the solution itself, but at the same time removing the solutions will delete a whole portion ...
1 vote
7 views

### Find first position satisfying condition, which is true after a certain element

I've made a function called Earliest I believe it is useful and there isn't built-in function like that (at present). The purpose of the post is to try out the code ...
122 views

### How can I plot only legend of this?

How can I plot only lengend of this? ...
27 views

### When a function is defined by other functions [closed]

I have the following functions: x1P[t1_,t2_]:=8/3*1/(1+t1)+(2t2^2-4t1-4t1t2-1)/(2(1+t1)^2) x2P[t1_,t2_]:=(1+2t1-t2)/(1+t1) lP[t1_,t2_]:=1/(2(1+t1)) And I would ...
41 views

### Replacement of a variable only for a part of an expression [closed]

I am trying to do a replacement of a variable on a general expression, but only for a part of the expression and not all of it. As a simple example, consider the following expression ...
1 vote
29 views

### Additional lines in the plotting graph

I tried to plot the following ...
148 views

### How to plot two functions?

a[x_,y_]:=x^3+y^2; b[x_,y_]:=x^2+y^3; I want to plot a[x,y] in x axis and b[x,y] in y axis for different values of x and y say, we fix y=1 and x goes from 1 to 10.
101 views

...
1 vote
65 views

### Possible bug: Wrong limit for EllipticE?

I encountered problem with computing limits of Elliptic functions E and F. For example, ...
65 views

### How to do this recursion relation in Mathematica effectively?

I have a function $h_{\Delta,l}(r,\eta)$ satisfying \begin{equation} h_{\Delta,l}(r,\eta)=\tilde{h}_{l}(r,\eta)+\sum_{k}\frac{c(k)}{\Delta-(1-l-k)}r^{k}h_{1-l+k,l+k}(r,\eta) \end{equation} where $k$ ...
41 views

### A way to tell mathematica to not alphabetically order second derivatives

I have a frame of vector fields $E_1 ,... ,E_6$ and it's convenient for me to write $E_1(f)$ as Dt[f,e1] where e1 is an ...
1 vote
46 views

### How to simplify a function imposing that it is equal to zero?

I have a function calculated by Mathematica given by $F=\frac{1}{2r^3}sin[\theta]Y^{(1,0)}[\theta, \phi]((-4m+L(1+L)r)h0[t,r]+r(-2m+r)(-rh0^{(0,2)}[t,r]+2h1^{(1,0)}[t,r]+rh1^{(1,1)}[t,r]))$ and I want ...
191 views

### Determination of a Function

I have an expression: $5e^{13t} = F(e^{14t})$. I want to use Mathematica to determine $F$ on this function to be $F(q) = 5q^{13/14}$. How do I do this? Sorry if this seems trivial -- I can't quite ...
631 views

### What is the best method to search pattern for 2D list?

What is the best method to search patterns for 2D list ? Let L be following 2D-list : ...
621 views

...
36 views

### Using discrete distribution to fit continuous distribution and then reproduce the same discrete distribution, all on the same Plot

I'm using the discrete distribution function to fit the continuous distribution by method of moments, and then, trying to reproduce the same discrete distribution function. The data used to plot the ...
277 views

### Is there any way to get nthComposition of a function?

I need to find the nthComposition of a function. I thought there could be something like nthComposition[f,x,5] means five times composition of f with x as input parameter. I don't want to repeat f in ...
220 views

### Strange behavior of 'SquareFreeQ'

What is the cause of this strange behavior of SquareFreeQ while PrimePowerQ works correctly: ...
1 vote
75 views

### How to create a matrix with multiple variables defining the elements?

I am a learner start using Mathematica to study quantum mechanics. In many cases, I am try to construct matrix with functions like this: For example, let f be a function taking 4 variables x1,x2,x3,x4,...
71 views

### How to take the derivative with respect to a function with more than one variable?

I have a function that includes another function inside. I want to know the derivative at every point x. I have spent a lot of time trying to figure out how to do this, but I am very lost. I have ...
1 vote
85 views

### Value of allegedly infinite limit is different for different values of the variables

I have a $5$-variables function $f(x,y,z,u,v)$ and I want to compute the limit as $x\to\frac{3\pi}u$; using this code for general values of parameters, Mathematica gives the answer ...
37 views

### Confused result in RepeatedTiming

RepeatedTiming[expr,t] does repeated evaluation for at least t seconds. I use this function to measure 1+1 for 3 seconds.But it actually took more than 3 seconds. ...
259 views

### Why does FindSequenceFunction not work in this case?

Why does this not work? FindSequenceFunction[{1/2, (2/3)^2, (3/4)^4, (4/5)^6, (5/6)^8}, n] (*FindSequenceFunction[{1/2,4/9,81/256,4096/15625,390625/1679616},n]*) I ...
370 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 ...
1 vote
29 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: ...
107 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 ...
247 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 vote
100 views

66 views

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

In Mathematica, there is a concept called packed array. ...
34 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 ...
94 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: ...
37 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; f = 321 and so on. We can extract the set of output values by running <...
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],...} ...
187 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 ...
532 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. ...
32 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 ...