Tagged Questions

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

learn more… | top users | synonyms

23
votes
1answer
224 views

What does Internal`InheritedBlock do?

What does the function Internal`InheritedBlock do? How is it different from the regular Block?
0
votes
1answer
62 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
111 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 ...
29
votes
5answers
931 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 ...
3
votes
2answers
664 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
83 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
832 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
114 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
77 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 ...
9
votes
1answer
165 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
149 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 ...
31
votes
2answers
972 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
331 views
9
votes
1answer
221 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
154 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
2answers
339 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
112 views

How does `LongestCommonSubsequence` work?

When I recently came across this posting about LongestCommonSubsequence I was curious about how the function worked. ...
15
votes
2answers
240 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
128 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
292 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$. ...
13
votes
1answer
261 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
1answer
205 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
134 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
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
95 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., ...
2
votes
1answer
871 views
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 ...
3
votes
2answers
133 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: ...
2
votes
2answers
593 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
267 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
109 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 ...
1
vote
1answer
1k 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
476 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 ...
5
votes
5answers
1k 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
280 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
805 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 ...
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 ...
1
vote
1answer
726 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
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 ...
10
votes
5answers
349 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
122 views

Obtaining a function from the function

Assume that; ...
1
vote
1answer
173 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 ...
0
votes
1answer
102 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 ...
3
votes
3answers
197 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 ...
18
votes
4answers
629 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
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: ...
12
votes
1answer
255 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
65 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]] ...
3
votes
2answers
1k views

Define a color function using Piecewise

How can I define a ColorFunction for my ContourPlot using Piecewise? For example after ...