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

learn more… | top users | synonyms

6
votes
1answer
111 views

How does `LongestCommonSubsequence` work?

When I recently came across this posting about LongestCommonSubsequence I was curious about how the function worked. ...
14
votes
2answers
226 views

What are Root objects with multiple polynomials?

In Mathematica 9 a new flavor of Root object with multiple polynomials was introduced. For example, ...
10
votes
1answer
126 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 ...
13
votes
1answer
250 views
2
votes
1answer
131 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
320 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
60 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
93 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., ...
11
votes
1answer
1k 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 ...
2
votes
2answers
554 views

distance between two curves

I try to compute the distance between two curves. I use the EuclideanDistance to do that. Here my code: ...
3
votes
2answers
447 views
3
votes
2answers
129 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
250 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
381 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
166 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
108 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
867 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
vote
3answers
449 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
472 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 ...
0
votes
1answer
243 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
740 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 ...
2
votes
2answers
112 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 ...
8
votes
1answer
445 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 ...
4
votes
3answers
858 views

How to prove an expression by method of mathematical induction?

I want to prove the expression $$1^2 + 2^2 + 3^2 + \cdots + n^2 = \dfrac{n(n+1)(2n+1)}{6}$$ by method of mathematical induction with Mathematica, but I do not know how to start. How do I tell ...
0
votes
0answers
27 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 ...
5
votes
5answers
1k 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 ...
1
vote
1answer
690 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 ...
12
votes
1answer
249 views

What's a good style for inheriting Options[] of built-in function?

Options[myPlot] = Options[Plot]; myPlot[args___] := ... When defining a "wrapper" function like the above, I'd like it to inherit the ...
2
votes
1answer
120 views
0
votes
1answer
101 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
2answers
230 views

Position function not always retuning an answer even with no apparent problems

I'm having some problems with Position. Sometimes it will give an empty list instead of the actual position of the element I am looking for when that element is ...
3
votes
3answers
191 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 ...
16
votes
3answers
2k views

Plotting piecewise function with distinct colors in each section

I have a piecewise function that I would like to plot but I was wondering if it is possible that each part of the function that is plotted when its corresponding condition is true be plotted with a ...
12
votes
1answer
249 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: ...
2
votes
0answers
123 views

Is there documentation on the comparative performance of Mathematica functions? [duplicate]

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: ...
0
votes
1answer
63 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]] ...
9
votes
2answers
262 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
2answers
281 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 ...
6
votes
3answers
294 views

Permanent minors

The function Minors yields the minors of a matrix. Is there a function that yields the permanent minors of a matrix?
0
votes
1answer
163 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: ...
3
votes
2answers
315 views

What is the command to find function invariant?

What is the command to find function invariant? http://demonstrations.wolfram.com/AFunctionInvariantUnderAGroupOfTransformations/ what is algorithm it use to calculate this? Edit there is a book ...
0
votes
0answers
35 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
169 views

How to use ScientificForm in computation

Lets say I want to add 2 values : ...
1
vote
0answers
52 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 ...
2
votes
1answer
442 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 ...
1
vote
2answers
102 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 ...
8
votes
3answers
334 views

Radon function result's repeatability

I want to get a Hough transform of some edged image. When I compare the same transformation on the same image I got different results. ...
3
votes
4answers
617 views

Extract function arguments

Is there a way to extract the arguments of a function? Consider the following example: I have this sum ...
5
votes
2answers
417 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 ...