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

learn more… | top users | synonyms

1
vote
4answers
127 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
59 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
59 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
49 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
72 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 ...
24
votes
2answers
388 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 ...
1
vote
1answer
105 views
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
107 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
49 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 ...
2
votes
2answers
81 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
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 ...
6
votes
1answer
86 views

How does `LongestCommonSubsequence` work?

When I recently came across this posting about LongestCommonSubsequence I was curious about how the function worked. ...
9
votes
2answers
88 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
72 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
72 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$. ...
-2
votes
0answers
118 views

What does “# & /@” do? [closed]

This code plots a crystal lattice. a and b are the primitive vectors and tauA and tauB are the locations of atoms A and atoms B. So far there's two things I don't understand: What does the "@@" in ...
7
votes
1answer
115 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
75 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
71 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
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
61 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
77 views
8
votes
1answer
207 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
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: ...
1
vote
2answers
192 views

distance between two curves

I try to compute the distance between two curves. I use the EuclideanDistance to do that. Here my code: ...
0
votes
1answer
76 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 ...
0
votes
1answer
62 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
115 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
197 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 ...
3
votes
3answers
185 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
96 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
52 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. ...
2
votes
2answers
68 views

changing a symbol into a function variable

Struggled for a while on this problem and hopefully you can help... I have a mathematical expression that currently has a symbol where I used to have a function variable. How do I make the symbol ...
0
votes
0answers
26 views

How does Plot evaluate its argument? [duplicate]

I have a list of about twenty InterpolatingFunctions that I'd like to plot. They are interpolations from experimental data (frequency spectra between 100 and 5000 ...
1
vote
1answer
97 views

Plotting a complex function [duplicate]

What does it mean if this message appears: {Im[(1-E^Times[<<3>>] f)/(1-Power[<<2>>] f)]-0,Im[(1-E^Times[<<3>>] f)/(1-Power[<<2>>] f)]-0} must be a list of equalities or ...
5
votes
5answers
285 views

Series expansion in terms of Hermite polynomials

I am trying to expand a polynomial in terms of orthogonal polynomials (in my case, Hermite). Maple has a nice built-in function for this, ChangeBasis. Is there a ...
8
votes
4answers
197 views

Transform a list of functions to a composition

How do I apply a list of functions in a nested way? Example: functionList = {f1,f2,f3} RequiredCommand[functionList,Pi] such that the required command returns ...
2
votes
1answer
69 views

Obtaining a function from the function

Assume that; ...
0
votes
0answers
60 views

FindMaximum inconsistency

The code below seems to work for n<11. But for n=11, and above, it outputs newa then just outputs "beep" sound. WhyTheBeep says "The kernel Local has quit ...
-1
votes
1answer
87 views

Should Read[] not close its Stream? [closed]

I read a record from a file. Read[file,Record]; It reads and opens a stream. Should Read not close its stream after ...
2
votes
3answers
115 views

Alternative to using global variables in functions?

Often times I find myself using unevaluated variables (i.e. they show up blue) as dummy variables in whatever I'm returning such that I can evaluate them as needed later on. A simple example is as ...
12
votes
3answers
221 views

Accessing list elements by name

First, a bit of a long introduction to my problem: I only have a few weeks of Mathematica experience. I am creating a mathematica application that calculates some material properties of steel based ...
2
votes
0answers
97 views

Is there documentation on the comparative performance of Mathematica functions?

Recently I have been solving some Project Euler problems. I find there are always several ways to do the same thing. For example, one could join two lists like this: ...
11
votes
1answer
193 views

Is there a summary of answers Head[] can give?

Sometimes you need to check for the type of an expression. You use Head[data] to get answers. Some data: ...
0
votes
1answer
62 views

how to generate functions with changing array size?

I want to write a function in Mathematica which has two inputs 'n' and 'd', and the output should be (in Latex notation) $$F(n,d) = \sum_{i[1],...,i[n] =0; i[1]+...+i[n]\leq d}^{d} C[i[1],...,i[n]] ...
1
vote
1answer
95 views

Define a color function using Piecewise

How can I define a ColorFunction for my ContourPlot using Piecewise? For example after ...
8
votes
5answers
264 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 ...

1 2 3 4 5 7