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.

Filter by
Sorted by
Tagged with
0
votes
0answers
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 ...
0
votes
0answers
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 \\ ...
0
votes
1answer
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 ...
1
vote
1answer
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 ...
3
votes
2answers
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[[1]]+x[[2]] What if the argument of ...
11
votes
2answers
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: ...
0
votes
0answers
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. ...
-1
votes
0answers
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.
0
votes
0answers
25 views

Correctly Evaluating the existence of Large Solutions

I'm trying to correctly evaluate $$D(S\cap[a,b])=\lim_{n\to\infty}\frac{\left|S\cap{F_n\cap[a,b]}\right|}{\left|F_n\cap[a,b]\right|}$$ where $D$ is the density of $S\cap[a,b]$ (in $A\cap[a,b]$), $[...
0
votes
1answer
24 views

At how many of these points is f(x,y) (strictly) greater than both g(x,y) and h(x,y)? and

I try too find out the solution but is not work. Please help! This what I wrote:
4
votes
1answer
85 views

Real and imaginary parts of complex logarithm

I need to obtain the real and imaginary parts of the below expression with Mathematica: $(- i a - m^2) \ln(\frac{i m^2}{2 a})$, where $a$ and $m$ are real. So we have: ...
0
votes
0answers
17 views

InverseFunction cannot evaluate negative arguments

I have difficulty figuring out where my code fails. I want to obtain $\textbf{ry}$ which is the inverse function of rho (see below). When I input positive values for its argument, there's no problem. ...
0
votes
1answer
53 views

Plotting a Wavefunction [closed]

I am trying to plot a wavefunction for a 1D Particle in a box. I attached my code below, when I run it, it shows a plot with no lines on it. I am new to mathematica, so I am not sure what I am doing ...
-1
votes
1answer
54 views

What is the problem in this program? [closed]

The output is showing running only. For[m = 0, m < 0.05, m++, For[a = 5, a < 20, a + 1, a1 = a*(a/2); x[m] = a1 ]; ];
2
votes
2answers
77 views

How to convert list of variables x1, x2, x3 ,x4 … x10 to list of x1_,x2_,x3_..x10_?

I'm writing a function where I need to give many inputs. I created a list of variables from Table function. My aim is to get ...
1
vote
0answers
70 views

If someone would want to think about the question: mathematical-optimization “Banknote”

I solved the puzzle of IBM Ponder This September 2019 by my code written with mathematica. I would like to share this code after the solution that will come as soon, and discuss it. In the meantime, ...
3
votes
2answers
123 views

Is there any command similar to Delaunay of matlab?

After finding this webpage where they mention the generation of land using matlab, In its section how it works, explain its operation in detail, I started trying to do it in MMA but I am doubtful of ...
0
votes
1answer
60 views

Domain specifications for InverseFunction

I have difficulty implementing on how to specify the domain that I want for ry which is the inverse function of rho. The necessary condition is that, $\textbf{ry}$ must remain $\textbf{positive}$ for ...
0
votes
0answers
26 views

Easiest way to simultaneously keep track of two values in a list

I have a bunch of functions a,b,c,... that all take in a list of images and return a list consisting of a list of transformed images, and a number (let's call it ...
0
votes
2answers
38 views

How would I plot the inequality lines together with the intersection plot of the inequalities?

For example, I've got the following code: Plot[{x >= 5, y >= 8, x + 2y <= 64, x + y <= 40}] This would plot: Now, this is fair enough. It shows me ...
3
votes
1answer
132 views

What does this superscript on HypergeometricPFQ mean?

I was messing around with some integrals and I got as output the following: What does the superscript on the last term in that expression mean? I looked at the documentation for HypergeometricPFQ, ...
0
votes
1answer
28 views

For different value of input module is giving same result

I have a simple module written to extract a certain shape for a certain value of ω, but I am getting the same result for different input values into the module. 1.mode[1] and mode[2] looks exactly ...
1
vote
0answers
34 views

How to speed up the evaluation of a sum of incomplete Gamma functions?

We need to do a ContourPlot for the following function $H[x,y,n]$: ...
2
votes
1answer
34 views

How to use a list as a part of arguments for a function?

I have a function, say f[x,y,z] and a list l={b,c}. What is a more concise way to write ...
1
vote
2answers
56 views

Determinant of matrix with asymptotic expansion

i have determinant which each element have asymptotic expansion. $\begin{bmatrix}1+5/s+6/s^3+O[1/s^4] & 1+8/s+4/s^2+O[1/s^4]\\1+2/s+2/s^3+O[1/s^4] & 1-1/s+8/s^3+O[1/s^4]\end{bmatrix}$ ...
6
votes
1answer
208 views

The differences amongst f[x_], f[x__], and f[x___] [closed]

This is probably very elementary but I have not used the following and I cannot find anything online, and I was unable to find something here. Can someone explain to me the differences amongst <...
0
votes
1answer
20 views

Properly defining and plotting a function that requires `NSolve`

I want to defined a function that solves some equation numerically: ...
1
vote
1answer
58 views

How to get ReplaceAll to happen before function call

I have a problem I am attempting to solve with NMinimize. I have a scoring function, which will give me a final score. The problem has many variables, so instead of having them as parameters, they ...
-1
votes
0answers
15 views

Changing ticks on axes and full bar legend of density plot

I want to remove the {$5*10^4$,$5*10^5$ and $5*10^6$} ticks from the y-axis as they look like eye-sore. How do I do that? Also my bar legend isn't giving the whole range i.e. 0 to Max range of Lkall (...
0
votes
0answers
35 views

Density Plot going out of range

I am plotting a function Lkall (shown in the picture below) with two inputs temp and n1d, ...
0
votes
1answer
78 views

Creation of a Function

I am trying to create two functions but I am having trouble. The first consists of converting degrees Fahrenheit to Kelvin using this formula (F - 32)*(5/9) + 273 ...
13
votes
1answer
629 views

What is the use of FullForm in Mathematica?

I would like to know where this "FullForm" in Mathematica will be useful. Kindly provide some examples. I just started learning Mathematica. If my question is wrong or not correct. I'm sorry about ...
5
votes
3answers
224 views

Problems with solving PDEs

I am using NDSolve to solve the two equations: ...
0
votes
1answer
69 views

stupid questions how to define a function of 2 variables [closed]

I have the code which works g[x_, y_] := f[x] + f[y] But then I tried vavg (distance_, time_) := distance/time And then ...
4
votes
1answer
51 views

Inverse of vector-valued function

Having a differentiable function $f : \mathbb{R}^2 \longrightarrow \mathbb{R}^2$ such that $\det D(f)$ (Jacobi determinant) does not vanish. How can we get the inverse function $f^{-1} : \mathbb{R}^2 \...
4
votes
1answer
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 ...
-1
votes
1answer
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 ...
5
votes
2answers
162 views

How to animate a function plot

How can I plot a function e.g. f[x_] := Sin[x], point by point (animation).
3
votes
1answer
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
1
vote
0answers
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 ...
0
votes
1answer
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 ...
16
votes
2answers
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 ...
1
vote
1answer
38 views

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

I have a list with the following structure: ...
0
votes
0answers
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 \...
1
vote
1answer
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 ...
0
votes
1answer
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: ...
1
vote
1answer
30 views

Why won't this PrintTemporary[Dynamic[…]] expression work in a function?

I found myself reusing this code all the time to monitor variables during execution, so I'm trying to make it into a function: ...
4
votes
4answers
125 views

How do I pass a “list of lists” as the argument to a function of the form F[x,y]? [duplicate]

I have a function F[x,y] and a list of the form: {{a1,b1},{a2,b2},{a3,b3},{an,bn}} Basically, I want to pass the list ...