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
0
votes
1answer
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 ...
0
votes
0answers
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 ...
0
votes
0answers
37 views

Strange behaviour Plotting User-defined Function: Charting`Private`pvar$

I am using MMA 12.0.0. I create a user-defined function and plot it. ...
0
votes
0answers
48 views

Problem when doing a 3d-plot of a function

So I have been working with Mathematica I have defined a function called funcional that receives $u, \alpha, \beta, y2 , x3 $ where the first one is a function of ...
0
votes
0answers
35 views

Problem when integrating a discontinuous function

I have this simple code: ...
0
votes
0answers
27 views

replacing a founded value in a function

Here is the sample F[r_] := r^2 + r^3 DerivI[r_] := D[F[r], r] A = FindRoot[DerivI[r], {r, 9}] B = F[r] /. r -> A I want to replace ...
0
votes
0answers
29 views

Variant on `PrimeZetaP`

Mathematica has PrimeZetaP for the prime zeta function $\sum_p \frac{1}{p^s}$ where the sum is taken over all primes. How do I use Mathematica to make an ...
0
votes
0answers
32 views

Pulling answer from previous output

This will probably be a very simple answer. I am trying to find a way to pull the last output from a line and define it as a separate variable so it can be used in a later function. Specifically in ...
0
votes
0answers
86 views

Finding ellipse formulas from set of ellipse relations

Question: Given the ellipse relations below, what additional ellipse formulas/relations/equations can I derive? I asked a question similar to this in Finding formulas from other formulas and ...
0
votes
0answers
39 views

Defining a function and order of operations

I feel I have a profound misunderstanding of how Mathematica works. Here's an example that confuses me: Say that for a matrix $A$ I want to extract the first $\mathrm{Tr}(A)$ normalized eigenvectors (...
0
votes
0answers
50 views

Delayed Rule right-hand-side mis-evaluation

Outline I am trying to create a rule that will give me a minus sign if the number of times A is applied on X is odd where A is some οperator and X a random quantity. Some of the configurations of ...
0
votes
0answers
37 views

Creating a special product function

I am having trouble working with lists inside functions with Mathematica. Basically, I have a list of numbers and a special way to multiply them. I want to have a function that is able to create a ...
0
votes
0answers
46 views

Define a function including two solve solutions

I'm trying to combine the solutions coming from two NSolves and define a new function that I've to integrate. Basically I've defined two ...
0
votes
0answers
79 views

NSolve not solving my transcendental equation

Would be grateful for your help in tackling this complex polynomial where I am trying to solve for x. When I run the code below, I get the message: value x of ...
0
votes
0answers
91 views

Define the partial derivatives of a multivariable function

I have some vector $K = [K_1, K_2,...K_n]$ which is a function of variables $(x,y)$ i.e. $K = K(x,y)$ I want to symbolically calculate the partial derivatives e.g. $\partial_x K$, $\partial_x \...
0
votes
0answers
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 ...
0
votes
1answer
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: ...
0
votes
0answers
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$?
0
votes
0answers
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, ...
0
votes
0answers
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: ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
2answers
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): ...
0
votes
0answers
22 views

Error while defining custom matrix function

I'm trying to define a custom matrix Ry with a parameter x, in Mathematica. ...
0
votes
0answers
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 (...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
61 views

Problem with arc length

...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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: ...
0
votes
0answers
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 ...
0
votes
0answers
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. ...
0
votes
0answers
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: ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ?...
0
votes
0answers
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 ...
0
votes
0answers
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: ...
0
votes
0answers
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 ...
0
votes
0answers
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}\...
0
votes
0answers
44 views

Editing the function argument

I'd like to construct a function, that changes its own input. The code ...
0
votes
0answers
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}]:- ...
0
votes
0answers
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 : ...
0
votes
0answers
65 views

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

Basicaly I have this function: ...
0
votes
0answers
118 views

How to give a function multiple variables in a mapped and nested list?

I come from python (not advanced tho), and have been learning mathematica. I'm currently struggling with the following code: This is a basic version of what i wanted to implement: ...
0
votes
0answers
76 views

HannWindow implementation and discretization speed

I would like to discretize a series of HannWindows, but two issues arise. First, my manual implementation of HannWindow seems to ...