Questions about the use of built-in Mathematica functions, including pure functions.
8
votes
1answer
49 views
What does Internal`InheritedBlock do?
What does the function Internal`InheritedBlock do? How is it different from the regular Block?
21
votes
4answers
353 views
Why is there no PositionFunction in Mathematica?
Too often I have seen the programs of inexperienced users greatly slowed by using Position in an iterative fashion, when far faster would have been to compute a ...
0
votes
0answers
6 views
Does Euler totient function gives exactly one value(answer) or LEAST calculated value(answer is NOT below this value)? [migrated]
I was studying RSA when came across Euler totient function. The definition states that- it gives the number of positive values less than n which are relatively prime to n.
I thought I had it, untill I ...
0
votes
1answer
30 views
Have the kernel load a user-defined function by default [duplicate]
I wrote a very simple function that I would like to act as if it were one of the default functions that came with Mathematica, so that you don't have to load or import any package before you make use ...
6
votes
1answer
62 views
create function that behaves like continuedFraction [duplicate]
I'm just starting to learn Mathematica and I got stuck at this question. This a noob question but please help.
I need to define a function named continuedFraction that takes user input of type list ...
8
votes
5answers
297 views
Building a continued fraction
I've completed a problem that involves approximating $e$ by a continued fraction:
$$\frac{N_1}{D_1+\frac{N_2}{D_2+\frac{N_3}{\ddots+\frac{N_k}{D_k}}}}$$
with the $N_i$ being the list ...
2
votes
2answers
74 views
Function returning Null along with other unexpected expressions
When I use some function, at the end along with the output I get some NULLs returned that I don't understand the reason for and are highly undesirable.
For example, when I define the reversal of list ...
1
vote
0answers
45 views
Does Graphics`Mesh`SimplePolygonQ[] work for you?
Graphics`Mesh`SimplePolygonQ is an undocumented function. I'm using Mathematica 7, and when I try:
...
2
votes
4answers
149 views
How can I create a list of functions?
Can anyone tell me, how to create a list of functions? I've tried the following code, but it doesn't work.
...
0
votes
1answer
60 views
What does Binomial return for non-integer arguments?
Mathematica returns values for non-integer arguments passed to Binomial.
What is the definition of Binomial for such continuous ...
2
votes
1answer
61 views
Flat function with repeated sequence
There are functions like Join[ ] that accept a variable number of arguments. Join is a flat function, as the order of arguments ...
14
votes
4answers
463 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)} ...
7
votes
1answer
53 views
Creating a NearestFunction that returns an index
I use Nearest repeatedly for large data sets. For example
pts = RandomReal[{-1, 1}, {1000, 3}];
Nearest[pts, {0, 0, 0}]
I ...
3
votes
0answers
78 views
Mathlink and multithreading
In order to make my computations faster I have developed a C/C++ application calling Mathematica kernel and performing many operations using Mathematica functions for equation solving.
Now I want to ...
2
votes
1answer
116 views
24
votes
2answers
415 views
Variable naming changes everything
I am having a rather unusual problem I do not understand with Mathematica where renaming one of the variables of my function causes the function to stop "working". Here is the example of the code ...
3
votes
2answers
88 views
Cannot call custom function loaded from script using C/C++ MathLink
I am using MathLink with C/C++ on a Unix system in order to call a Mathematica (version 9) function and get the result.
The function I need to call is a personal function of mine ...
0
votes
1answer
71 views
Taking derivative of Euler relation [closed]
I have defined the following function, which is the Euler relation for $\cos\,x$.
f[x_] := 1/2*(Exp[I*k*x] + Exp[-I*k*x ] )
I want to take the derivative with ...
8
votes
1answer
110 views
Apply a Function Pairwise
I'm new to Mathematica
I'd like to apply Mean pairwise to a list to achieve the following.
...
1
vote
1answer
50 views
How to send a function definition to MathLink from C/C++?
In this tutorial some MathLink concepts are introduced. At page 33 in the last lines the author is talking about sending to MathLink a function definition like ...
4
votes
1answer
205 views
Using DistributionFitTest on custom distributions in Mathematica 8
I originally posted this question on Stack Overflow, but I didn't get any answers, and I'm hoping to have better luck here.
I'm trying to compute the goodness-of-fit of a bi-modal Gaussian ...
6
votes
1answer
89 views
How does `LongestCommonSubsequence` work?
When I recently came across this posting about LongestCommonSubsequence I was curious about how the function worked.
...
0
votes
0answers
14 views
Dumb question, how do I find the image of this function? [migrated]
The function is $Y=2$, the domain is just 2? And the image of it?
I don't think I quiet understand what the image of a function means, the domain is all values that it can assume, correct?
Could you ...
9
votes
2answers
92 views
What are Root objects with multiple polynomials?
In Mathematica 9 a new flavor of Root object with multiple polynomials was introduced. For example,
...
5
votes
1answer
74 views
How do I expand StirlingS2[n, 10] in terms of elementary functions?
I know that it is possible to expand StirlingS2[n, 10] in terms of elementary functions of n. I tried ...
0
votes
0answers
4 views
What does “-2E-07x” means? [migrated]
I'm a programmer who had always been lacking some mathematical skills, yes it's a shame, I know.
I'm making this little software for a biologist friend, and at some point I need to pull out a graph ...
1
vote
1answer
75 views
Finding n-th term of a sequence of functions
Lets say, I have the following series of functions,
$f_1=a+1$
$f_2=a^2+2a+1$
$f_3=a^3+3a^2+3a+1$
Assume that $f_4, f_5,$ and $f_6$ are also known. However $f_n$ is not known as a function of $n$.
...
6
votes
3answers
561 views
How do I plot Thomae's function in Mathematica?
I wanted to plot this function
$$f(x) =\begin{cases}
1 & \text{if } x= 0 \\
\tfrac1{q} & \text{if } x = \tfrac{p}{q}\\
0 & \text{if } x \in \mathbb{R}-\mathbb{Q}
...
7
votes
1answer
121 views
How do I get a general form for n-th derivative of a function? [duplicate]
I tried the following but it basically returns unevaluated:
...
1
vote
0answers
76 views
Notebook UI: Autocompletion - Display function arguments when typing?
Is there a setting to display the required arguments of a function when typing as Visual Studio, Matlab, etc. does?
2
votes
1answer
73 views
Cannot run Mathematica C-interfacing examples 'factor'
I am trying to run a Mathematica example concerning Mathematica interfacing issues with C programs. In particular I am trying to call a Mathematica function from C.
Example ...
2
votes
3answers
141 views
Use elements of Array inside function definition
I'm trying to define a function which modifies and sums over the elements of an array. Here is a very simplified version.
myF[kmax_] = Sum[v[[k]]/k, {k, 1, kmax}]
...
0
votes
1answer
48 views
Don't pollute outside context when solving equation from the outside
This code works fine only if a is not defined in the outside context:
...
1
vote
2answers
62 views
Calling blank arguments using enclosing functions
Is there a way to call a function and have that function use an argument defined in an enclosing function?
e.g.,
...
8
votes
1answer
217 views
Write C/C++ programs calling Mathematica functions
I need to write a C/C++ program and call some functions in Mathematica especially those like Solve or NDSolve. The problem is ...
1
vote
1answer
82 views
Mathematica plots a discontinuity in piecewise function that does not exist [duplicate]
I have the following function defined:
...
1
vote
2answers
200 views
distance between two curves
I try to compute the distance between two curves. I use the EuclideanDistance to do that.
Here my code:
...
2
votes
2answers
211 views
3
votes
2answers
56 views
Generating a list of pure variables
I want to pass a list of pure variables to a function, in which the ordering of the variables matters. For instance, if I want a palindrome, my function might be:
...
0
votes
1answer
78 views
Can Mathematica check if two expressions give the same output for integer input?
Let me give the background for this question. I'm using WebAssign to assign homework problems, and WebAssign has a built-in mechanism which can grade problems using Mathematica commands. For ...
2
votes
5answers
295 views
How to leave function unevaluated programmatically?
Is it possible to write a function in such manner, that it can be either evaluated or left unevaluated?
This is a general question. Sample below is just a sample. No need to find solution for this ...
4
votes
1answer
145 views
Create string from character code
Is it possible to convert a charcode/keycode to a string?
I want to do this to create variables in a generated equation.
0
votes
1answer
63 views
Can I force a function to quit and return some value after a certain amount of time has passed during its evaluation?
Imagine I provide some random input to function like FindInstance[], and I observe that, despite the existence of good solutions, the function will, with some ...
0
votes
1answer
116 views
How do I define the domain of a function?
I have a function of two variables, f[x_, y_], and I would like to restrict the domain to values of x and ...
-1
votes
3answers
198 views
Sqrt — how to get negative branch?
One of the many attractions of Mathematica is that integers are generally treated as exact symbolic entities, and not just as numbers. I was just playing with Sqrt, and was puzzled by what appeared to ...
7
votes
2answers
325 views
Function Interpolation with Automatic / Algorithmic Values Mesh
I have an underlying function f(x,y,z) that is computationally intensive, but is smooth and continuous. I'm needing to find the function values along a line in xyz. Currently, I'm calculating f at ...
3
votes
3answers
192 views
How to sum over a List
list = {11.5575, 11.397, 5.52734, 4.0878, 2.54815, 1.86652, 2.55028,
2.14952, 1.6242, 1.34117}
I have a list of numbers. How do I make a function that creates a ...
0
votes
1answer
71 views
Using undefined function in an expression
I want to use undefined functions in expressions to be simplified. For example.
I want mathematica to simplify this input
$(f^{\prime\prime}(t),g^{\prime\prime}(t))\cdot (-g^\prime(t),f^\prime(t)) $
...
1
vote
1answer
99 views
3D plot of two 2D functions
I would like to plot two 2d functions in a 3d coordinate system. Examples are z = x^2 and z = y^2. Each function has one ...
-1
votes
0answers
56 views
Why is NonlinearModelFit calling the model function with symbolic arguments?
I have a model to fit which is made of numerical functions and so it can give a value for any numerical value of the arguments, but creates an error when called with symbols. ...




