Questions tagged [functions]

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

299 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
80 views

How to get a function from a numerical integration?

I wold like to know how to get a function from a numerical integration. Here is an example: h[y_?NumericQ] := NIntegrate[y*Sin[Sin[x]], {x, 1, 2}] h[2] Then my ...
18 views

Problem with makeOperator which yields Polynomials of an operator

Hi Is it possible to improve the macro provided by Jens Polynomial expansion of operator ...
37 views

79 views

How to turn an algorithm into a function

I have written a script to help me find the several local minima of a dataset. It takes two arguments: the dataset list and an x-coordinate value that tells the script from where to start looking for ...
145 views

Automating a large operation by making a function

I would like to automate the following operation. To be transparent I shall put my code into separate chunks and explain the process. Suppose I have the following: ...
45 views

How to define a function in an implicit form

Know the 2-variables function $F(x,y)$. How can I define the function $x\to f(x)$ s.t. $F(x,f(x))=0$?
63 views

Function works outside For loop but not inside, and loop fails spectacularly

I'm building two lists, each to carry a different representation of the same set of objects. One list, list2, is constructed first; then the second list, ...
69 views

How to list all the possible functions of given structure?

I can run this command : Tuples[{ Tuples[{x, y, z}, 2], {a, b, c}}] to list all combinations that looks like: ...
48 views

Function iteration

I wrote a function in Mathematica that applies certain construction steps on the "incidence matrix" of a graph in order to obtain a new graph with certain properties. These construction steps can be ...
45 views

Obtaining the equation type of an interpolated function

I used InterpolatingFunction on a set of points. How can I know the type of that equation ? (polynomial, sinusoidal, logarithmic,etc...). I am looking for a general case answer. Here is an example ...
89 views

Problems with creating a matrix with functions

I have a function which gives me all the coordinates of a certain bloc in a lattice (with the help of another function for rows and columns): ...
22 views

Error while defining custom matrix function

I'm trying to define a custom matrix Ry with a parameter x, in Mathematica. ...
42 views

How to graph a text as a function of some arbitrary parameters?

I'm trying to graph a text in a couple of plots I have. I want to be able to edit the text depending on the values I choose (rho0, zp, zm, temp, ion, and perm) and show them at some point in my plot (...
127 views

How to solve “Coordinate should be a triple of numbers”?

Something seems different with duplicated question "How to solve this error? āshould be a triple of numbers or a Scaled form.ā ", MMA tips may tell that Abs do not ...
70 views

How to find a domain at which a function is non-zero

Consider some function f[x,y]. Is there any way to find a domain at which it is non-zero? Namely, I would like to compute the integral ...
37 views

Defining a function through an ODE containing unspecified operators

I want to do some algebra using a function only defined through a DE containing unspecified operators. The DE is $$\partial_zu(z) = \left[\hat{D}+\hat{N}(z,u)\right] u(z).$$ Here $u$ lives in ...
52 views

How to exclude some methods?

Can I exclude one or several methods from methods tried by a function? When we use some 'algorithm-intensive' function, we can often specify whether we want to proceed according to the chosen method ...
61 views

...
22 views

Acquire a single-variable function by slicing a 3d graph along a given line

Consider my Calculus 2 math problem: Given a function f[x,y]=x^2-3xy and two vectors a = {1,2} and b = {1,1}. Spanning a linear ...
34 views

To assign an array to a function

// Pre-defined parameter kS = 2*(\[Pi]*NefS)/LambdaSS; Here, NefS is a function of LambdaSS. The matrix m (i,j) defined corresponding value of NefS (jth ...
29 views

How attribute a restrition for a variable inside a function

I have a function like this way: f[x_] := x + 2; In[148]:= f[b + 2] Out[148]= 4 + b How to impose a condition that the variable ...
66 views

Imposing conditions on argument for a function definition

Suppose that I wish to use "Piecewise" to merge two different interpolating functions (obtained via a NDSolve of some ODE), defined over negative and positive arguments respectively, like: ...
302 views

How to copy a function/list/array without reference

I have code that runs in a loop to generate a function that has values assigned every multiple of a user-supplied step size. I want to copy the final function "value-wise" to a different function so ...
49 views

Defining a derivative as a function does not work

I have a fairly complicated function VIcase1L[b_,\[Epsilon]_, d_] := ....... All I wanted to to was to derive it this function with respect to b and define it. ...
30 views

Minimum of explicit functions in vector form

For fun, related to this question about minimizing implicit functions, how can I find the minimum of an explicit one expressed as a vector? For instance, an ellipse: ...
38 views

Function that once called “erase” every other definition of my notebook

I encounter a really weird effect in Mathematica and I don't know what the wrong thing is nor how to correct it. I work with vectors of four components and I have a minimal set of definitions that I ...
87 views

Find the maximum of a function involved with Floor function

My function is $$f(H,p) = \left\lfloor \dfrac{\lfloor H/p\rfloor + 3 - \sqrt{(\lfloor H/p\rfloor + 1)^2 - 4H}}{2} \right\rfloor$$ The constraints are $H \geq p(4p-1)$, $p$ is prime although ...
53 views

Create a color function from dynamic panel

I would like to generate a color function from the dynamic panel code and use it as I want...instead of using Copy to Clip Board and then past in myTM.... Any idea ?...
268 views

DSolve inverse function

I trying to solve a differential equation DSolve[{D[r[a], a] == 3 r[a]/a (w - (g *(1 + w)*(1 + r[a]))/(1 + g*r[a])),r[1] == r0}, r, a] But the solution is a ...
56 views

Constructing a user function with an integral

Maybe this is a basic task to perform but I haven't found any literature. I am performing a convolution of two functions: ...
103 views

How to find ranges of values where specific conditions are true?

I'm trying to get Mathematica to solve a particular inequality in terms of the variables (and constants) of interest to find where the inequality holds as true. Specifically, I have three functions of ...
63 views

How to accelerate NDSolve for PDE with user defined functions?

I would like to solve the following 2D+1 PDE \$\partial_t \mathcal{P}(t,\theta,\omega)=-\partial_{\theta}( \omega\mathcal{P})+\partial_{\omega}\left[(\tau_i n\cos(n\theta)-\tau_m(\theta))\mathcal{P}\...
44 views

Editing the function argument

I'd like to construct a function, that changes its own input. The code ...
32 views

How to change the formulae of FeatureExtraction?

I have a feature extraction function fe, which gives me n/0.816497 as the output of fe[{1}]:- ...
56 views

Functions definitions with variable arguments

How do you define a variable amount of functions with a variable amount of arguments? I don't get the reference at all : ...
65 views

Is there a way to Connect a function ''normally'' through its Pole?

Basicaly I have this function: ...