The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [functions]

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

2,491 questions
Filter by
Sorted by
Tagged with
37 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 ...
44 views

Quadratic form for specific formula as matrix reprezentation

So I have problem for specific formula to create Quadratic_form form from $$y = 3 + x_1 - 2 x_4 + 2 x_3 x_4 + x_2 (-x_3 + x_4)$$ as matrix \begin{bmatrix} 1 & 0 & 0 & 0 \\ ...
33 views

How to force Mathematica to give answer in certain functional form?

I want Mathematica to evaluate $$0=\psi (x) \left(\frac{k x^2}{2}-\text{En}\right)-\frac{\hbar ^2 \psi ''(x)}{2 m}$$ and give me answer in terms of the Hermite polynomials but it gives me result in ...
33 views

Contour Plot not taking previously defined expressions?

I am new to Mathematica so my question might sound a bit silly, but I hope you help me. While learning ContourPlot, I have learned that when I use the previously ...
83 views

How to get the nth value of a function with arbitrary number of arguments

I know that I can define a function of a List and get the nth argument like: f[x_List]:=x[]+x[] What if the argument of ...
183 views

The use of SlotSequence in If[#1 > #2, ##] &

The below function when applied to a list of two elements, will output the maximum between the two: If[#1 > #2, ##] & For example: ...
93 views

Function value errors in NDSolveValue

I am solving a second order differential equation described by odey below. For the asymptotics, I have the following code which will be used as initial conditions for NDSolve. ...
32 views

Equation with infinitely many solutions [migrated]

Find all solutions to the equation sin(2x) cos(2x) = 1/2 that are in the interval [0,16]. Give all your answers as exact values, and state the number of solutions.
25 views

113 views

Best practice with Return in Module or Block

I am a bit confused on the use of Return in either Block or Module when defining a custom ...
54 views

Expected value of Product of N terms from a Distribution

I don't understand how to calculate The Expected value of ∏ x(i) for N values of x(i) taken from a uniform distribution. i.e. to generalise ...
162 views

How to animate a function plot

How can I plot a function e.g. f[x_] := Sin[x], point by point (animation).
70 views

Help me with understanding root objects [duplicate]

I solved an polynomial equation of degree 20 and got root objects as solutions. I cannot understand how to match such output to any standard analytic form. After studying ...
75 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 ...
24 views

Factor[p(x), a, b] not working in Galois theory package

I have downloaded Galois theory package from http://library.wolfram.com/infocenter/Articles/2872/ and I currently have Mathematica v 12.0. When I loaded the module (I needed to delete the blue stuff ...
37 views

What is used for the % symbol in mathematica? [duplicate]

Im new in mathematica i want to know logic about this program. I got this code: {{vo, vn, Ii}} = {vo, vn, Ii} /. %; i know that the syntax /. is for replacement but i dont know whats going on with ...
48 views

Get Inverse Function in a certain domain

I'm trying to make Mathematica giving me the inverse function of $f$ (below) when restricted to the interval $[v,1]$. Using ConditionalExpression or ...
302 views

Improving Performance of an XY Monte Carlo

I normally write my Monte Carlo codes in Fortran for speed, but I was doing some quick and dirty work and wrote one in Mathematica for the XY model on a square lattice (see Kosterlitz-Thouless ...
38 views

How can I consolidate mapping code between different levels of lists?

I have a list with the following structure: ...
28 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 \...
19 views

Numerical Maximization with Alternating Sum

I need to maximize a function that involves an alternating sum and a set of constraints. I have tried the following code: NMaximize[{(-1)^{m}*n!, n + m == 7, m > 0, n > 0}, {m, n}] However, the ...
49 views

highest power of x of a number k that is less than n

For this code: a = IntegerExponent[k,7]; (*a is highest power of 7 that divides k*) I would like to find b, where b is: ...