Questions about the use of built-in Mathematica functions, including pure functions.
0
votes
2answers
165 views
Expansion in Basis Functions
I am trying to create an expansion of the form
f[x,y]->Sum[Cn[x] y^n,{n,1,order}]
To replace the function f by the ...
0
votes
1answer
97 views
Solving a differential equation for a variable in a function
This may sound like a very trivial question, but I need to solve a differential equation as follows:
...
9
votes
2answers
152 views
How can I get the right hand side of a delayed expression?
Imagine there is a given function f, defined with SetDelayed, say
f[x_] := Sin[x]^2 + Cos[x]^2.
Is it possible to get rhs of ...
0
votes
0answers
19 views
Define a Plot3D function with custom options [duplicate]
I am trying to define a Plot3D function with custom options, following (this previous SE question), but I'm running into a brick wall. I've narrowed the problem to the following 'toy' code:
...
4
votes
2answers
127 views
0
votes
1answer
190 views
How can I define a Step-Wise function in Mathematica (Not using Heaviside Step Function)? [closed]
I need to define a function, which has very different behaviour in different regions. There are about 13 different regions. A sample of my function is the foloowing table:
I want to define it as a ...
0
votes
0answers
66 views
Choosing the appropriate solution for the square root [closed]
My problem is the following: given the function
myfunc[x_, a_]:= (a^3 - (a^2)^(3/2))/(x)
the limit as x goes to 0 should be well defined and = 0. However,
...
1
vote
0answers
39 views
Confusing efficiency and evaluation when returning pure functions? [duplicate]
I have a function that takes some time to evaluate, that's meant to be a polynomial approximation to a function. The polynomial is defined by a list of coefficients, so I have the function ...
14
votes
4answers
435 views
Finding Limits in several variables
Is there a way to find a limit of a multivariable function, like
$$\lim_{(x,y)\to (0,0)} f(x,y)$$
with Mathematica?
When $f$ is continuous, we can use
$$\lim_{(x,y)\to (0,0)} ...
1
vote
2answers
62 views
Named patterns as function argument descriptors
I have a function timeToMinutes that takes a 24-hour time as a string argument (in digital clock format, e.g., "15:47") and converts it to the number of minutes ...
0
votes
2answers
101 views
Self-defined function to transform row vector into column vector, where am I wrong? [closed]
I defined a function row2col[] to transform row into column,
Where am I wrong?
...
2
votes
1answer
138 views
Problem using the DifferentialEvolution method of NMinimize [closed]
I have a function of 20 parameters, which 3 of the parameters are my physical parameters, and the others are pull terms to fix the errors. The goal is finding the global minimum of this function, to ...
2
votes
3answers
205 views
How make f[{x,y}] evaluate as f[x,y]?
I frequently encounter the situation where I have a function of two real variables defined, e.g.:
f[x_, y_] := 9 - x^2 - y^2
But then I need to feed into ...
5
votes
2answers
176 views
Is there an $n^{\text{th}}$ root function in Mathematica?
Is there a way to find $\sqrt[n]{x}$ with Mathematica beside of x^(1/n)
as this is something different, because this is not always the same
$$(-1)^{\frac{2}{4}}=i ...
3
votes
4answers
202 views
Extract function arguments
Is there a way to extract the arguments of a function? Consider the following example:
I have this sum
...
1
vote
1answer
149 views
Why does the first derivative of a piecewise continuous function turns out with discontinuities?
I have this piecewise continuous function which is also continuously differentiable over time :
...
5
votes
1answer
91 views
Does pass-by-value affect the performance of function calls?
I only have a little coding experience in C, and I remember I was told that pass by reference is more efficient than pass by value since the parameters don't need to be copied. Since there is no pass ...
2
votes
0answers
137 views
Minimization in mathematica [closed]
I have recently had a strange problem with NMinimize. I have a very huge function with respect to 20 parameters. When I ...
15
votes
4answers
238 views
Enforcing correct variable bindings and avoiding renamings for conflicting variables in nested scoping constructs
Using global variables the following turns an "expression" into a Function:
expr = 2 x;
Function[x, Evaluate[expr]]
Of course ...
1
vote
3answers
166 views
How do I create a matrix of functions?
I'm trying to create a matrix in which the elements are functions of two variables, but I can't figure out how to do it. Is it possible? The only way I could figure out is to define the matrix in ...
2
votes
1answer
116 views
Expression for the real 7/3 power
I need an expression for the real 7/3 power of a real-valued function, i.e., a reformulation of
f[x_] := g[x]^(7/3)
that works for negative values of ...
4
votes
1answer
137 views
A Faster way to combine two Lists of different structures into one of a different structure [duplicate]
I have the following two lists (each containing over 500,000 elements). Here is a sample:
...
1
vote
1answer
99 views
Forcing evaluation of ArgMax
How to force evaluation of ArgMax before its output gets used in Solve?
Background: I'm trying to solve for the Nash ...
2
votes
1answer
98 views
1
vote
0answers
70 views
Solving for vector elements in a function to which the vectors are not passed explicitly
I want to define a function which takes in two integers (indicating the lengths of 2 vectors), and solves a simple set of expressions at a set of points to find all the values in both the vectors.
so ...
1
vote
0answers
73 views
How can I obtain the function described by given set of central moments?
I want to investigate how my function P behaves with different probability functions rho as input variables.
This means
...
1
vote
1answer
109 views
Speeding up code by avoiding repeated evaluation of a function
I want to speed up my code and I have two ideas, but I don't know how I can implement them.
Here is a little part of my code, which I want to improve:
...
1
vote
1answer
102 views
Function definition and delayed assignment
I need to define the following function
MyWavelet[n_]["PrimalLowpass", prec_ : MachinePrecision] :=
Table[(-1)^(j - 1) h[[2*n - j]], {j, 0, 2*n - 1}]
which ...
9
votes
2answers
118 views
Function with custom Options and modified Options for built-in Symbols
I couldn't find a more descriptive title, but I guess an example will explain my problem.
I set up some customized Grid function including some additional ...
6
votes
3answers
162 views
Permanent minors
The function Minors yields the minors of a matrix. Is there a function that yields the permanent minors of a matrix?
4
votes
3answers
95 views
Creating a nonperiodic function in mathematica
I want to create a non-periodic square wave with values of 1 and -1(not necessarily alternating).
For e.g. I want to convert an arbitrary array like {1,-1,-1,1,-1,1,-1} into a function.
I tried ...
1
vote
3answers
165 views
Solve with v9 (issues with Subscript, Overscript, Superscript etc)
The way Solve works has changed in v9 ... in essence, to get the answers that one obtained under v8, one now often has to specify a lot more information about all ...
3
votes
1answer
111 views
Downvalues vs. Scoping for Functions
Regarding my recent question on using a default value for a function argument when a pattern was not met yielded some interesting answers, but the general consensus was "Yes this can be done, but ...
1
vote
0answers
22 views
Define a second name for a function [duplicate]
I'm working with an own package of functions. During development I noticed, that my naming scheme is not that clever; for example some of my functions are starting with capital letters. But I have ...
2
votes
1answer
155 views
Print out all functions in Mathematica
Sometimes I only remember parts of a function name and I want find that function name quickly, and if I search in the document center, it will give too much informations related to that and difficult ...
8
votes
1answer
226 views
Optimizing the performance of an algorithm
First - a bit of an introduction. If you're only interested in the code, you can skip this section.
The following question is drawn from Dennis E. Shasha's Puzzling Adventures, and is listed under ...
7
votes
6answers
258 views
Manipulate and Turning Expressions into Functions
I've been trying to use Manipulate to do interactive plotting, but I've been running into a few problems with saved expressions. I have an expression saved as "func" and I want to work with it and ...
2
votes
1answer
105 views
How to export/import function values [duplicate]
I have a function with two variables:
f[x_,y_]:=f[x,y] = ...
I calculated some values (they are fractions like 435345345/3424242424) and would like to store the ...
5
votes
2answers
161 views
How to declare a function of variable?
In my program, there are many functions relying on spatial coordinates: x, y, and z, which are also functions of time t, i.e., composite function. I need to differentiate some functions for example f:
...
7
votes
2answers
106 views
Method that can be used to collect the variables of a function
Suppose we have a function f[x, y, z] and we want to get all its variables Sequence[x,y,z], what method can we use then? The ...
7
votes
2answers
151 views
How do I write a function that can be used in a rule to modify both sides of an equation? [duplicate]
I sometimes need fine grain control over equations in Mathematica in order to help me understand how to solve a problem manually. A greatly simplified example of a session might be something like ...
6
votes
4answers
170 views
Function argument to default under certain condition
Inspired by this and this question (and how I handle this in practice), what is the best way to default a function value when a certain condition is met?
For example, if a function is defined as:
...
2
votes
1answer
86 views
Plot[] breaks behavior of custom data handling function - Recursion
I am working on a utility to analyze a set of data. I want to process the data with a sliding window, in such a way that there is an output associated with each sample of data.
To start, I have a ...
5
votes
1answer
236 views
What is the difference between prefix/postfix notations and map?
I am new to Mathematica and just experimenting with the different programming constructs. I have been looking at Map and how to evaluate a function for a list of ...
2
votes
0answers
60 views
From notebook,how can I change variable value with in .m file dynamically?
I wrote a function named Testing.
...
1
vote
1answer
94 views
How can I calculate a limit with a free variable?
For example, when I evaluate
Limit[(1 + x^n + (x^2/2)^n)^(1/n), n -> Infinity]
Mathematica does not output any result. When I evaluate
...
0
votes
0answers
91 views
Strange result from integrate
I am working on the following problem. However, the first task takes too long, although the answer 0 is correct. In the second task, to reduce the calculation time, ...
3
votes
0answers
118 views
Help on how to write a function to be used with NMinimize
I need some help to write a proper function to be used as a parameter on NMinimize. Here is the code of the function to be minimized (Please correct, optimize and rewrite the code if you want to - I ...
0
votes
0answers
84 views
MiniMaxApproximation [closed]
I'm new to Mathematica and I'm trying to obtain a minimax rational function approximation to a certain expression. In particular, I'm using
...
7
votes
3answers
221 views
FullSimplify does not work on this expression with no unknowns
I can't reproduce this simple example from Habrat, 2010 ("Mathematica : a Problem-Centered Approach"). It is supposed to demonstrate the functionality of ...

