Questions tagged [functions]

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

243 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
136 views

Incorrect output from InverseFourierTransform

Bug introduced in 8.0.4 or earlier and fixed in 9.0.1 or earlier I am trying to compute the inverse Fourier transform of this expression ...
2
votes
0answers
615 views

Maximizing Large Multivariable Function over Region with Parameter Constraints

Brand new Mathematica user here. I have a complicated function to maximize, and thought I would try software like Mathematica instead of taking derivatives by hand. I found some Mathematica ...
2
votes
0answers
124 views

Which functions automatically generate new functions?

In his video http://www.wolfram.com/broadcast/video.php?channel=362&video=1643, Wolfram gives the following example: the output from dict = Nearest[WordData[]] ...
2
votes
0answers
131 views

Find eigenvalues without filling the matrix

Is it possible to find eigenvalues of a matrix without filling it? The matrix elements are given by a known function f[p1,p2]. This is relevant for a matrix too ...
2
votes
0answers
92 views

Complicated output from simple Eigenvalues problem

I have code that uses Eigenvalues on matrices of various sizes. But the output of what should be a very simple problem, namely finding the eigenvalue of a 1x1 matrix, is overly complicated. ...
2
votes
0answers
73 views

Panel size undesired behaviour

This is next question from the series: better avoid Panel if you care about details. previous about FrameMargins In the ...
2
votes
0answers
143 views

Are there some other ways to solve a second PDE except DSolve?

I have a partial differential equation as follows: $$\frac{\partial p(x,t)}{\partial t}=\text{Dp} \frac{\partial ^2p(x,t)}{\partial x^2}-\frac{p(x,t)-\text{p0}}{\tau }$$ What I try to do was to get ...
2
votes
0answers
453 views

Positive integrand giving negative answer

I'm integrating a positive function f(t) times sin(t) from 0 to pi/5 and get -38. Actually f is slightly negative for a short time (smallest value ~ -0.0005), but far from enough to explain this. ...
1
vote
0answers
37 views

Cache a function in mathematica

I have a function of one variable $f(x): \mathbb{R}\to \mathbb{C}$ which is very difficult to evaluate. Single evaluations may take hours, and I need to use the function at a large variety of points. ...
1
vote
0answers
28 views

Do I have to write the independent variable always?

I'm not used to using Mathematica. Please help me. What I want to do is similar to the following: U and V are unknown function ...
1
vote
0answers
51 views

How can I force the output of a computation to be as compact as possible, yet complete, by using functions?

I am computing some derivatives in Wolfram Mathematica 11.3. The functions that I have to differentiate (with respect to the state variables) are the equations of motion of a rocket in the atmosphere. ...
1
vote
0answers
44 views

FindFormula: can I change the standard TargetFunctions?

FindFormula seems to have a limited number of TargetFunctions: Possible functions for TargetFunctions are Plus, Times, Power, Sin, Cos, Tan, Cot, Log, Sqrt, Csc, Sec, Abs, and Exp. Is it ...
1
vote
1answer
51 views

Printing Values Within a Function

Below is a function to calculate the overlap between two gaussian functions. ...
1
vote
5answers
235 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, ...
1
vote
0answers
37 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]$: ...
1
vote
1answer
72 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
vote
1answer
46 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
98 views

NDSolve 2 functions 2 variables with intermediate calculation : (1 time-space eq) + (1 space eq)

I have a system of differential equation with this structure : $$\left\{\begin{split}&\partial_t n(t,r) + \nabla. \big(n(t,r)v(t,r)\big)=0 \\ & f\Big(n(t,r),v(t,r),\partial_r n(t,r),\...
1
vote
0answers
57 views

Force FindFormula to avoid Piecewise in the result?

Is it possible to provide any arguments to FindFormula to force it to avoid using Piecewise in the result, but instead try to ...
1
vote
0answers
26 views

Finding the positions of minima for a function with algebraic constants

I have a function of several variables: inverse[Qx_, Qy_]:= T - 2 J + 4 J1 Cos[(Qx + Qy)/2 a] Cos[(Qx - Qy)/2 a] - 2 J2 Cos[(Qx - Qy) a] + 2 J3 Cos[(Qx + Qy) a] ...
1
vote
0answers
47 views

How to preserve braces in result

I have a result from equation, for example p={{0<=x<=1/5||x==9/10},{0<=x<=1/5||x==9/10}} and using Cases[p, z_?NumericQ -> z, Infinity] I get {0,1/5,9/10,0,1/5,9/10} But I ...
1
vote
0answers
37 views

Attempting to create a toolbar with notebook tabs, unable to properly integrate functions

I recently learned that all the default Mathematica palettes were actually created in mathematica, and i have been trying to make something similar myself. And since learning that the DockedCell ...
1
vote
0answers
94 views

Is there an in-built function for the multivariate gamma distribution?

The Multivariate Gamma Distribution <- Wikipedia link with a description of the function. Is there an in-built function for the multivariate gamma distribution? I found out that there used to ...
1
vote
0answers
63 views

Series doesn't seem to work on functions

When you try to use the Multivariable option of Series, it doesn't work as intended, since it keeps terms of higher order than intended. Example: Expand a two-variable gaussian exponential to second ...
1
vote
0answers
51 views

Changing parameter in a _Mathematica_-defined function

I would like to use EllipticTheta with the sum running on the integers with a specific step. Is there a way to do that? To be more precise, I am trying to expand the following function $$\Theta_{\...
1
vote
0answers
74 views

Using While properly

I am trying to make While[] work with function results and evaluate them at the same time. ...
1
vote
0answers
24 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
40 views

Determine sign of the remainder for Taylor expansion

Consider the following function $\rho(x)$ (which we define using intermediary variables and functions) for $0 < u, v < 1/4$ and $x$ some positive number ...
1
vote
0answers
37 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
33 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
55 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
66 views

Recursive functions with integrals/derivatives return wrong results

I have the following recursive functions: ...
1
vote
0answers
46 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
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
69 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
134 views

Newton's method for nonlinear equations system

My code is: ...
1
vote
0answers
72 views

Dynamic Passing Function as Argument

...
1
vote
0answers
73 views

Possible bugs with InverseFunction in version 11.2

See these two examples ...
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
84 views

Mathematica can't evaluate the function at the point where it is smooth

Suppose the function ...
1
vote
0answers
68 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
79 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
158 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
73 views

Computationally Employ Sum over Ordered Partitions?

I have the following function defined, with two inputs $g$ and $h$: ...
1
vote
0answers
89 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
54 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
72 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

Find the relations between two parameters

...
1
vote
0answers
590 views

Derivative of Sign[x]

From wikipedia the derivative of the Sign[x] function has the following property: $\qquad \frac{d}{dx}{\rm Sign}[x]=2\delta[x]$ Where $\delta[x]={\rm DiracDelta}[x]$. It seems that Mathematica ...
1
vote
0answers
39 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 ...