Questions about the use of built-in Mathematica functions, including pure functions.
-6
votes
0answers
48 views
Restrictions on CoprimeQ[n_1, n_2] [closed]
What is the largest pair of integers capable of being checked to be coprime using CoprimeQ[n_1, n_2]? Or, rather, what are the restrictions on ...
0
votes
1answer
109 views
How could I define a function as the solution of equations in Mathematica?
I have posed a specific question yesterday but it may be too trivial to answer.
I think the question could be asked in a more general way so it is easier to answer. Then I could solve the original ...
1
vote
1answer
61 views
How can I transform parts of an Integer list to a String list
There is a sorted list of Integers.
ilist = PadRight[Sort[ RandomSample[Range[1, 99999], 3], Less], 5]
It should become string area codes like:
...
-1
votes
1answer
79 views
Why won't my function show in my plot? [closed]
I defined a function f as
f[x_] := x^3/(x^2 + 1);
and a function F as
...
1
vote
0answers
19 views
valuation to a function using a list [duplicate]
What I want to do is to evaluate a function as shown below:
LessQ[n_] := LessQ[n] = l[n] < 61
In some cases, when I am sure that on a list the ...
2
votes
1answer
68 views
making a function of fit results
I have 13*25 datasets consisting each of around 40 points.
They are all linear I can easily fit them using fit function but my problem is when I want to call them I want them to be functions. I want ...
4
votes
1answer
106 views
How to check if a given expression is an “explicit algebraic number”?
The documentation for PossibleZeroQ says:
With the setting Method...
5
votes
2answers
117 views
How to check an algebraic number for membership in a list
I need to check an algebraic number for membership in a list of algebraic numbers. The numbers can be expressed in different forms (combinations of radicals, Root ...
-1
votes
2answers
71 views
How do I generate a table of data points from a function and add random noise? [duplicate]
I am trying to generate a table of data for the function:
...
2
votes
2answers
67 views
Restarting an Animate[] animation after variable in Manipulate[] changes
I've been trying to restart an animation after variables change from Manipulate PopUpMenus. My animation takes the form:
...
1
vote
1answer
83 views
Derivative inside a function
I am trying a problem that should be simple: to create a function that contains a derivative. I need to do a more complex example, but even with the simplest I'm having trouble:
Let's consider
...
7
votes
2answers
79 views
How do I invoke the default complexity function?
Documentation on ComplexityFunction says:
With the default setting ComplexityFunction->Automatic, forms are
ranked ...
1
vote
1answer
54 views
Recursive function taking functions as arguments
I'm trying to implement Lie brackets and derivatives of nth order.
For doing this, I've stumbled upon something I don't understand. Here is an illustration: First I define the functions:
...
5
votes
1answer
98 views
Is it possible to find a limit of a sequence given by its recurrence relation?
I need to calculate a limit of a sequence given by its recurrence relation. I tried the following:
...
6
votes
3answers
157 views
How to get the correct answer when solve this equation?
I want to find the values of the parameter $m$ to the graph of the funtion $$x^4 - 2 m x^2 + m + 1$$ has three extremal points make an equilateral triangle. I tried
...
7
votes
2answers
92 views
Change some option of a function when calling it
Say I have defined some function like
f[p_] := Plot[Sin[p*x], {x, 0, 2 Pi}]
Now in most cases, I just need to specify the value of ...
2
votes
0answers
84 views
Using Element[]
Can the Element[] function only be used for the domains given in the documentation. I am trying to use it to determine if a value is contained in a previously defined list. Thanks!
-1
votes
1answer
88 views
How to define a pure function with a Module?
I was not able to use a self defined (using Module and For loops) piecewise function to fit data. It seems that the problem is that I have to define a pure function. I would like to learn how to ...
1
vote
1answer
113 views
Find a sequence of integers which give max in each step
I would like to write a program in Mathematica to look for the integer $n$ such that the following definition holds for any $1 < m < n $
$$\frac{f(n)}{f(m)}>1+\frac{\log(n/m)}{\log(n) ...
20
votes
1answer
143 views
What does Internal`InheritedBlock do?
What does the function Internal`InheritedBlock do? How is it different from the regular Block?
0
votes
0answers
8 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
34 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
66 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 ...
21
votes
4answers
510 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 ...
2
votes
2answers
83 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
47 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
197 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.
...
2
votes
1answer
73 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 ...
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 ...
7
votes
1answer
59 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
90 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 ...
28
votes
2answers
505 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 ...
2
votes
1answer
127 views
0
votes
1answer
76 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
115 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
60 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 ...
3
votes
2answers
98 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 ...
6
votes
1answer
94 views
How does `LongestCommonSubsequence` work?
When I recently came across this posting about LongestCommonSubsequence I was curious about how the function worked.
...
11
votes
2answers
106 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
83 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 ...
1
vote
1answer
101 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$.
...
8
votes
1answer
136 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
83 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
78 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 ...
0
votes
1answer
49 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
67 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.,
...
1
vote
1answer
107 views
Mathematica plots a discontinuity in piecewise function that does not exist [duplicate]
I have the following function defined:
...
9
votes
1answer
242 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 ...
3
votes
2answers
58 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:
...
1
vote
2answers
228 views
distance between two curves
I try to compute the distance between two curves. I use the EuclideanDistance to do that.
Here my code:
...



