Questions tagged [functions]
Questions about the use of built-in Mathematica functions, including pure functions.
296
questions with no upvoted or accepted answers
1
vote
0answers
80 views
Using While properly
I am trying to make While[] work with function results and evaluate them at the same time.
...
1
vote
0answers
34 views
Convolve[…] behaves differently to that of Integrate[…] when numerically integrating the result
I am performing a convolution between two functions, and then I want to numerically integrate the result.
If I go:
...
1
vote
0answers
115 views
1
vote
0answers
38 views
Calculate with general discrete probability functions?
I would like to work with a discrete probability function $P[x\_]$ that only has the property that it is defined for $x\geq0$, such that
Sum[P[x],{x,0,Infinity}]
...
1
vote
0answers
36 views
Problem in importing function in NDSolveValue
I have a code for solving a system of 2 differential equations (sol1). Given that what's inside is a bit heavy, I define functions so that I can call them. My issue is that when I write everything ...
1
vote
0answers
72 views
Is there a way to order the QZ(or Gen. Schur) decomposition in mathematica?
Let's imagine I have two matrices $\Gamma_0$ and $\Gamma_1$.
The SchurDecomposition function in mathematica will return matrices $Q,\Lambda, Z, \Omega$, such that $...
1
vote
0answers
71 views
Recursive functions with integrals/derivatives return wrong results
I have the following recursive functions:
...
1
vote
0answers
47 views
Multiple Square Bracketed Function definition
I am familiar with the typical way of defining a function--such as
f[x_,y_]:=x+y
but I have not found a discussion of definitions such as
...
1
vote
0answers
89 views
Function that Generates all Normal Subgroups of a Group
I am trying to create a function which, given a group structure, generates a list of all the normal subgroups contained within it. But I am not sure how to proceed.
For now, I have the following:
<...
1
vote
0answers
38 views
Store a matrix function for a particular value of its argument and use it without calling the function again?
Suppose I have defined a function as:
f[x_]:={{x,x^2},{x^3,x}};
g[x_]:=f[x][[1,2]]+f[x][[2,2]]+f[x][[2,1]]
Now if I want to calculate ...
1
vote
0answers
75 views
Take double integral
I'm trying to take a double integral:
$\int_0^1\int_0^1 \left[\left(\tilde{B_V}(\alpha_V) \{||\}(\tilde{B_V}(\alpha_V) > \tilde{B_A}(\alpha_A) - 1 - \theta(1 - r))Z\right) + \left(\tilde{B_A}(\...
1
vote
0answers
140 views
1
vote
0answers
76 views
1
vote
0answers
77 views
1
vote
0answers
48 views
How to handle functions with varying number of arguments
Suppose I have a function that depends on variables $x_1, ... , x_n$.
For concreteness I may have $f(x) = v \cdot x$, with $v$ a certain vector.
Now I want to do certain operation with this function, ...
1
vote
0answers
86 views
1
vote
0answers
80 views
Operator on a multivariable function in a sum
I need to define an operator that does as follow for any function $h_m$.
$\qquad O[h_m](k,M,b,l_{max})=\sum_{l\neq (0,m)}^{l_{max}}il \left (h_l(k,M,b,l_{max}) b_{m-l}(k)- c_l\partial_k h_{m-l}(k,M,...
1
vote
0answers
84 views
Using Two Arguments on the Same Function
I'm having some trouble wrapping my head around how I would go about using two arguments in one function. In the first section of the code below, I have scraped some "tweets" on the Seeking Alpha ...
1
vote
0answers
179 views
Solve a system of time dependent equations where the Unknown variables are time dependent functions
I have to solve a system of time dependent equations ( $eqf1,eqf2,eqf3,...eqm5,eqm6$, inside the equations there are known time dependent functions) where the Unknown variables ($f32,fe3,me3...f47,m47$...
1
vote
0answers
86 views
Computationally Employ Sum over Ordered Partitions?
I have the following function defined, with two inputs $g$ and $h$:
...
1
vote
0answers
93 views
Colorize a 3D plot with given function of dependent variable and add a bar legend
I want to colorize a surface $u(t,x,y)$ generated by Plot3D with a given function of $u$. For example,
...
1
vote
0answers
58 views
Same functions in plot but in different ways get different graph
According the documentation in Wolfram, Plot uses in below way,
Plot[f,{x,xmin,xmax}]
So, there is my original code.
...
1
vote
0answers
79 views
Very slow Absolute value computation (Improvement need)?
I have to compute the following absolute value. When computing the absolute value of the two pieces separately, everything works fine. When summing up and then evaluating the Abs of the Sum, the code ...
1
vote
0answers
142 views
1
vote
0answers
41 views
FinancialDerivative with a delayed start
Using the function FinancialDerivative with an Asian style option doesn't seem to have a parameter that allows for a contract that averages over a specific time period in the future rather than over ...
1
vote
0answers
92 views
Convolve returns false result
Bug introduced in 9.0 or earlier and fixed in 10.0
I tried to convolve sin with sin and got this unexpected result:
Convolve[Sin[x], Sin[x], x, y]
(* 0 *)
Now I ...
1
vote
0answers
55 views
Different Derivative's output with ComplexExpand
Consider this expression
f = Abs[ x + I ]
with this assumption
$Assumptions = Element[x, Reals]
Now there is something ...
1
vote
0answers
82 views
Plotting Asymptotic Series
I apologise for being always here asking for the same questions, but I need to learn.
I have to plot this series
$$\frac{\pi}{2} - \frac{\cos x}{x}\left(\sum_{k = 0}^{+\infty} (-1)^k \frac{(2k)!}{x^...
1
vote
0answers
48 views
Extracting elements with a certain criteria from a pre existing list
Here I take just a random list of triples of size 10
...
1
vote
0answers
113 views
ListDensityPlot erroneously showing flat regions (NOT plot range issue)
I have a dataset (listed below). I'm trying to plot the dataset using ListDensity plot;
...
1
vote
0answers
414 views
Defining a piecewise function where the conditions are points
I am trying to define the following function in Mathematica:
$$pw=\begin{cases}
x y \cos \left(\frac{1}{x^2+y^2}\right) & (x,y)\neq(0,0) \\
0 & (x,y)=(0,0)
\end{cases}$$
I want to use this ...
1
vote
0answers
280 views
An array of functions
I need to define an array which every entry is a function. To be more specific, I want to solve the equation:
$$\frac{d \rho}{dt} = -i[H, \rho] + L[\rho]$$
in which $\rho$ is a matrix. This is a ...
1
vote
0answers
726 views
Polar to Cartesian and Cartesian to Polar Transformation
I have noticed some odd behavior when converting from Polar < -- > Cartesian.
For example; https://math.stackexchange.com/questions/290209/diff-eq-transformation-polar-coordinates
We want to ...
1
vote
0answers
78 views
The wire frame from a Plot3D gives a jumbled mess for a wire frame
Some time ago I found a post that turned the triangles of a mesh into polygons. I have spent 2 hours looking for that post and can not find it.
The problem: Plotting
...
1
vote
0answers
259 views
How to get user input using FormPage
I am designing a user interface for a word-ladder game using CloudDeploy, CloudExpression and FormPage and I am having trouble with receiving the user input from the form. What I basically need is a ...
1
vote
0answers
56 views
Is there any point to using a variable as a function parameter?
Normally one only sees patterns as function parameters:
fun1[x_]:=x^2
Is there any point to using a variable in a function definition:
...
1
vote
0answers
38 views
Function with many lines that takes image as parameter not returning same result as if I run the same lines of code
Running the exact same lines of code in a function produces just a return of the original image without any points identified, whereas when I run the exact body of the function line by line it works ...
1
vote
0answers
83 views
Finding correct combination of functions
I am trying to write code where I have an array $S$ or numbers in any order [5,4,2,1,....]
Then I have a specific set of functions that I can write. ...
1
vote
0answers
191 views
Help with calculating a complicated integral
Edit: The question is solved : )) Thank you for your attention !
I am sorry for mass questions, but the question bothers me a lot. So I would like to ask this question here.
This problem arises when ...
1
vote
0answers
51 views
When evaluating this integral Mathematica returns two different answers
When evaluating this integral in Mathematica 10.3 Student Edition:
...
1
vote
0answers
46 views
Defining an object which is function in some variables and tensor in some other indices
I am trying to define an object which function in some variable and tensor in other indices.
My attempt at it was:
...
1
vote
0answers
106 views
DiracDelta of a function
If I have, for instance,
FunctionExpand[DiracDelta[x^2+x-3]]
it evaluates to
...
1
vote
0answers
87 views
Which method to use for finding maximum without actually computing optimization function explicitly?
I am new to Mathematica and I am currently working on an optimization problem. The optimization function that I have easy to calculate for some assignment of variable but it is very difficult to ...
1
vote
0answers
258 views
How to simplify an expression with a radical sign nesting in a radical sign
Is there a function can simplify an expression with a radical sign nesting in a radical sign in Mathematica? I use V9.
RatDenmon is a function that can ...
1
vote
0answers
74 views
Input `Reduce[Mod[a + x, l] == 0, x]' and output `x == -a + kl`?
Reduce[a + x == k l && k > 0, x]
(* k > 0 && x == -a + k l *)
I think a + x == k l and ...
1
vote
0answers
100 views
What are the differences between these functions when used for NMaximize?
In short, the question is how to construct the function you want to optimize?
...
1
vote
0answers
100 views
Improving RationalInterpolation Result
The following code produces a {4,4} rational interpolation approximation accurate to 10^-6 or better over the range ...
1
vote
0answers
493 views
Crosscorrelation for nonperiodic signals
I want to detect patterns (of an absorption spectrum which is nonperiodic) with Mathematica automaticly. I have found CorrelationFuncion but as far as I understand, ...
1
vote
0answers
256 views
RowReduce doesn't work for this matrix?
I have this matrix
A={{0,1,1,w},{1,0,1,x},{-1,0,1,y},{0,1,1,z}}
where w, x, y, z are arbitrary constants. This matrix should be row reduced to the form
...
1
vote
0answers
62 views
Is it possible to calculate with declarations only?
simple Example:
maximize $u(x), x$
solution would show constraints:
$\frac{\partial u(x)}{\partial x} = 0$
$\frac{\partial^2 u(x)}{\partial x} < 0$
etc...
or do I always have to explicitly ...