# Questions tagged [functions]

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

3,148 questions
Filter by
Sorted by
Tagged with
47 views

### How to create a global function? [closed]

I am wondering how to create a global function. I want to build a function that will persist even when Mathematica's kernel is aborted and closed and eventually restarted. I think the answer has ...
54 views

### How to sort functions based on the number of arguments they take? [closed]

How can I find all functions with a certain number of arguments? For example, how can I find all the functions who do not require an argument like RandomReal[]? How can I find all the function that ...
48 views

### how to find the FWHM of a peak from an equation and not data set? [closed]

I want to find the FWHM of a conductance peak I created on mathematica (see Figure). until now I used the FindMaximum to calculate the max of the peak. ...
43 views

### How to get a list of all the Resource Functions on the Wolfram Function Repository? [duplicate]

I would like to find a way to get the name of every single ResourceFunction published on the Wolfram Function Repository. How can I find the names of every single function?
36 views

### How to define a matrix of functions that taking given letters as variable without giving specific expressions? [closed]

I have a vector defined by coord = {r, \[Theta], \[Phi], t}. Now I want to create a matrix of functions taking these $r,\theta,\phi,t$ as variables without giving ...
86 views

### What is the difference between Catenate and Flatten? [closed]

I am having a hard time understanding the difference between Flatten and Catenate. Consider the following example code: ...
I have a system of 9 coupled trigonometric equations (a 3X3 Matrix). I am trying to find four unknown angles $\theta_1, \theta_2, \phi_1, \phi_2$ by solving any 4 out of 9 such equations. $\text{M}=\... 2answers 186 views ### Defining a function recursively I want to construct polynomials (or just function)$f_n$from$f_{n-1}$using mathematica. For some kind of reason, I didn't manage to do this. So basically something like a recurrence table, but for ... 2answers 80 views ### Problems with TagSet I am new with TagSet and TagSetDelayed and I'm not understanding properly how they works. I introduced the following definition: ... 2answers 63 views ### Why the animation of a function gives different results from the integral? My function is: A1[B_, x_, t_] := (AiryAi[B*(x - (B^3*t^2)/4)])^2 (B is a constant) and if I use "Manipulate" : ... 2answers 51 views ### Partially Orderless Arguments in Functions I am a Mathematica beginner and I'm trying to implement a function of type f[i1_,i2_,i3_,i4_] such that it is orderless in the first two arguments and in the last ... 1answer 57 views ### NBodySimulation softening parameter I'm simulating the orbit of a binary black hole immersed in some halo of particles and the simulation does not want to continue on for the specified amount of time. It always halts at a seemingly ... 1answer 56 views ### How to find all functions that accept level specifications as an argument? How can I find a list of every function that takes a level specification as an argument? 1answer 43 views ### Integrate and InverseFunction I solve an easy example to check that Mathematica can understand the difference between ArcTan and ArcTanh but as you see here I can't get Arctanh??!! Even I don't know why the inverse function is not ... 0answers 47 views ### Loops Not Working- Kernel Crashes and Values Incorrectly Updated I haven't used Mathematica in a while so any help is very greatly appreciated. I am trying to run a program with nested for loops that runs two function evaluations in the inner most part of the loops.... 1answer 31 views ### I have a variable error and was curious to see if it's due to piecewise functions? So I have a displacement function sigx as a function of "t" (time) and sig.pre (pre-stress). At some time "dx": force "fo" goes to 0, and the same displacement function ... 1answer 109 views ### Biot-Savart Integral I want to calculate the magnetic field of a finite wire of current along the z axis. I assume a frame of reference like the one in Fig. below: It is a classical problem with a well known solution for ... 1answer 37 views ### Simplify function with condition not working [duplicate] I try to simplify the function Q below: Q[x_] := Sign[x] /; x > 1 Simplify[Q[x], Assumptions -> x > 1] (*return Q[x]*) But it doesn't work. However, if I ... 2answers 79 views ### Calculation of composite integrals I am facing trouble calulating the following integrals. Could you give me any advice? My code is the following: ... 0answers 42 views ### Silly trouble expressing recursive formulas? I am trying to code the following formulas: I did it in the following way: ... 0answers 40 views ### NIntegrate seems to not recognize multiplication of Piecewise function and f[t_]:= function, Why? Considering inputs: vti={0, 1.5, 2.4, 5.0675, 7.735, 10}; Vscc=1.5; PSA=0.025; f=0.6; m=10; I defined a function "pwtemp2", using "FC1" and &... 2answers 309 views ### Mean of boolean list In python I'm used to doing something like np.mean([True, False, True......]) to compute the fraction of True values in a list. ... 1answer 98 views ### Matching a Dynamic Argument Pattern times is a list of times i.e. matching {{hour_, min_, sec_Real}..}. I want to call ... 1answer 99 views ### general replacement I have 500 terms. and I want replace them with below function ... 0answers 22 views ### Adaptation of existing code to multivariable system I am trying to adapt the existing code from "Mathematica package for analysis and control of chaos in nonlinear system" by Gutierrez. This existing code calculates the Lyapunov Exponent by ... 0answers 60 views ### Big O notation - Strange result [closed] I tried to use the big O function in Mathematica, but I got a strange result. It should be different because the two terms should remain. ... 0answers 67 views ### Can't create matrix function of symbolic functions and assign values to elements So I have a problem regarding the symbolic matrix value assignment. Say I create a matrix function as: P[t_]:= {{P1[t]}, {P2[t]}, {P3[t]}}; Then I want to assign ... 1answer 78 views ### unexpected StringCases behaviour inside function module First, Let use see a = {"wx", "wy", "wz"}; AssociationThread[Flatten[StringCases[a, "w" ~~ d_ :> d]] -> a] gives <... 1answer 48 views ### Could anyone help me to plot the following function? [closed] Unfortunately Mathematica is not able to run the following program area[d_]:=Pi*d^2/4 Q=80/1000 v[d_]:=Q/area[d] [Nu]=10^-6 Reynolds[d_]:=v[d]*d/[Nu] [Epsilon]=0.04/1000 CW[[Lambda],d]:=1/Sqrt[[Lambda]... 1answer 70 views ### How to make an interactive solver function? I am working on creating a function that takes in any physics equation as a string and converts it to an equation that I will then paste into an interactive interface as asked here: How to make an ... 0answers 20 views ### (Laplace Coefficents) Integral function definition TLDR: need help defining two functions involving integrals in the form of "Laplace Coefficents". My intention is to define functions that involve Laplace Coefficents. In particular, if$$b_{... 0answers 29 views ### Suppressing tensor indices and function labels of a function I am trying to do some GR calculations, and want to write a code which shows the expressions symbolically using compact indices, rather than write all the quantities in detail. More precisely, ... 2answers 52 views ### How to use NSolve while specifying the range of one variable I have an equation that uses three variables that I have defined as follows: b[l_, m_, lt_] := 0.025 * (((1 - m)*l)^(-1/2))*((1 - m)*lt) - 5. After this definition, ... 1answer 94 views ### What's the meaning of Sign function applied to matrices with MatrixFunction? I have noticed that Sign function can be very well applied to matrices using MatrixFunction. It even works on some zero divisors,... 0answers 72 views ### Multivariate Pade approximant Does Mathematica generate multivariate or just two-variate Pade approximant? If so, what is the generating command? 0answers 44 views ### Error: "ReplaceAll: ... is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing." when solving a root I have this code: ... 0answers 38 views ### Create a function from another by substituting arguments Suppose I have a function f[x, coeff] ... 0answers 36 views ### Can't match custom head in function signature [closed] I have written a financial charting function which has the following signature; ... 1answer 31 views ### Setting rules for Gamma functions I have some expressions involving lots of Gamma functions. Now the arguments of the functions sometime go to zero, in which case I want to use the factorial instead of the Gamma function (since it ... 1answer 707 views ### How to make a haunting ghost? How to make a harmless ghost (one that looks like a flying bed sheet)? One can always make a Ghost Curve. Or one can define define a clever wiggly function with a random fluctuation. My initial guess ... 1answer 39 views ### What is the precedence or order of operation for multiple functions applied to a dataset? This is from the Wolfram Language book section 45 on the planets dataset. This works: ... 1answer 62 views ### How to manipulate functions? This is probably a simple question, I have matrix a , and I construct b from a by adding a variable to the first column. b is a function of variable d, and now I need to do mathematical calculation on ... 1answer 50 views ### Maximize function problem [closed] I don't understand why I'm getting no solution with the Maximize function in this case: while it returns the right result when I impose$y\leq0.999$(or, equivalently,$x\leq0.999$): 1answer 50 views ### How i can add an element of one sublist to other? I have list. st = {{1, 2, 3}, {}, {}} It is nessesary to add the first element of any sublist to start of other sublist. In a quick way. Example: from 1 to 2 ... 2answers 78 views ### NMaximize - global maximum fail - How to? Problem : Let x,y,z be non-negative real number whose sum is 1. Find maximum of 0.2x + 0.2y + x^2*z + y*z^2 What I did first was reducing variable. ... 1answer 54 views ### Asymptotic bode plot [closed] Is it possible to plot an asymptotic bode plot. I am interested in verifying my straight line bode plot approximations done by hand by using mathematica but the bodeplot function generates the curved ... 0answers 43 views ### How to define the normalized spacing? I want to write the formula for normalized spacing in Mathematica and I want to use it in rest of the problem. To write the formula$D=(n-i+1)(x_{(i)}-x_{(i-1)})$I wrote the following function. ... 0answers 63 views ### Ising Model 1D /Thermodynamics properties I want to plot the thermodynamics properties of the Ising model like free energy, entropy, magnetization..etc., when h=0 ( no external field ) and when h= finite values For the energy as function of ... 1answer 108 views ### How to expand a function as a linear combination of other functions? I would like to be able to expand certain functions as linear combinations of other specified functions when I know that the original function can be represented in such a way e.g. we know that$\sin^{...
When we have a function like $f(x) = x^2-1$ and we expand it in a power series about some $x = x_0$, does Mathematica automatically assume that $x$ is real valued?