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

learn more… | top users | synonyms

1
vote
0answers
152 views

Speeding Up Image Processing Functions

I am working with stacks of 1024x1024 timelapse microscopy images that I am performing a series of image processing functions on to help segment each image. These functions include ...
4
votes
1answer
83 views

How do I constrain variables to a user-defined domain in ArgMax?

I am trying to ArgMax a function over x, but x is only defined between ...
3
votes
2answers
363 views

Is there a function for nearest power of 2 in Mathematica like nextpow2 in MATLAB?

I am looking for something like nextpow2 in MATLAB like this: P = nextpow2(A) returns the exponents for the smallest powers of two that satisfy $2^P \geq\left|A\right|$.
3
votes
1answer
153 views

why Level does not sort output according to their levels

Consider this example: Level[a + f[x, y^n], {0, Infinity}] (*{a, x, y, n, y^n, f[x, y^n], a + f[x, y^n]}*) Why the output is sorted in this way. why not ...
2
votes
1answer
68 views

About Compile Function

I have a function that take p as a parameter, p is a 2X3X3 list, ( a 2X3X3 list can like { {{2,3},{1,2.},{1,1.}}, {{2,3.},{1,2},{1,1}}, {{2,3},{1,2},{1,1}} } ) the function just as: ...
1
vote
1answer
171 views

Computational complexity of symbolic determinant

I'm using the Det function in Mathematica to compute the determinant of an $n\times n$ matrix $A$ with entries of the form $a+bt$ with $a,b$ integers and $t$ a variable, and I would like to know what ...
0
votes
0answers
81 views

Problems with NMinimize

I have written some functions that take a matrix and find its minimum inner product with a specific set of vectors ...
3
votes
1answer
82 views
7
votes
1answer
253 views

Is there a list of Octave functions mapped to the related Mathematica one? [closed]

I am just wondering if there is a list of the related Mathematica functions that correspond to Octave functions. For example. ones(n) maps to ...
0
votes
0answers
63 views

Trouble outputting Plot

I am trying to solve a system of ODEs and plot them with Manipulate but I keep getting blank outputs. Below is my code: ...
4
votes
0answers
91 views

Make Mathematica show function template's arguments in different lines (i.e. in column) by default?

I feel a bit uncomfortable with Mathematica 10's layout. I mean, I'm impressed how powerful functional programming can be and so on, but it's me or those programs are often just a bunch of nested ...
1
vote
1answer
151 views

Convolving data set with gaussian profile

I have a spectrum looking like List, and I want to convole it with a gaussian of the form PDF[NormalDistribution[μ, σ], x] (where σ also depends on x). The raw ...
6
votes
1answer
176 views

Why is AllTrue much slower than VectorQ?

This seems to be a theme with V10, a new function dedicated to a specific task doesn't live up to expectation performance-wise. Mr. Wizard has already uncovered 2 such functions here and here. So how ...
2
votes
3answers
126 views

Speeding Up Replacing of Labels in Large Matrix?

I am Mathematica novice and am trying to find a fast way to replace labels in some rather large matrices (512x512 or 1024x1024) that have resulted from segmenting images with WatershedComponents or ...
0
votes
2answers
97 views

Collapsing summation

I am trying to write a command to collapse the sum of terms into an expression with summation. Something like ...
19
votes
3answers
672 views

DeleteDuplicatesBy is not performing as I'd hoped. Am I missing something?

Déjà vu: a new-in-v10 function should provide a better solution to an old problem, but my enthusiasm is curbed when I run timings. This time the function is ...
0
votes
1answer
137 views

Plot3D unable to understand input function

I'm attempting to plot the Wigner Function of the Morse Oscillator defined as ...
0
votes
0answers
53 views

deleteduplicates Delete elements of a list [duplicate]

I have a math problem about Mathematica, I am looking help from you. I hope that you could help me. The Math Problem: list= { {0,0,1},{1,0,0},{0,1,0} ,{1,2,3}}; ...
1
vote
1answer
91 views

Using Map in a function definition

I want to calculate the hessian of a matrix. So each element gets replaced by a 2 by 2 matrix. ...
0
votes
0answers
51 views

Is it possible to calculate with declarations only?

simple Example: maximize $u(x), x$ solution would show constraints: $\frac{\partial u(x)}{\partial x} = 0$ $\frac{\partial^2 u(x)}{\partial x} < 0$ etc... or do I always have to explicitly ...
-1
votes
2answers
73 views

How to fix the “Module” function, for implicit funcitons? [closed]

I wanted to make a function which gives the frequencies of a number in a specific list, when I came accros this problem. This is what I tried: ...
34
votes
2answers
788 views

Why is the new PositionIndex horribly slow?

This issue has largely been mitigated in 10.0.1. New timings for the final test below are: ...
13
votes
2answers
228 views

Why doesn't a Composition[] hold its arguments and what can be done about it?

Now that Composition (also RightComposition) has shorthand syntax I am more inclined to use it, however what I feel should be ...
0
votes
0answers
83 views

How to be faster at making a frequency list of increasing steps

I want to find propabilities of having a sequence in a list, by using frequencies. The case is that you will bet on an increase when the last event had an increased and bet on derease when the last ...
0
votes
0answers
93 views

Timing: how make a program to work faster using built in functions and tables

I want to improve my code to make it working faster even for very large numbers. ...
13
votes
6answers
897 views

Will Version 9 functions all work in Version 10?

Having developed a substantial code base in Mathematica 9, leads me to ask these important questions prior to downloading and installing Mathematica 10. Will any Mathematica functions from the ...
1
vote
2answers
94 views

FindRoot: getting number of iteration [closed]

I'm using FindRoot to solve a nonlinear system. I'd like to see what FindRoot is doing while computation, something like the display option for Matlab fsolve. At the end of the day, I want the number ...
1
vote
1answer
76 views

Bug in NDSolve (Mathematica 9.0.1)? [duplicate]

The following code performs many times the same identical operation, but the time it takes increases systematically. This seems to be a problem of Mathematica 9.0.1 and above. Mathematica 9.0.0 does ...
0
votes
1answer
79 views

Nminimize fails claiming not a number value, even with _?NumericQ [closed]

I have the following function to minimize for a > 0 ...
2
votes
1answer
108 views

Define PolyLog so that positive reals evaluate on upper edge of branch cut

Generalizing the previous question: Define Log so that negative reals evaluate on lower edge of branch For real positive values $x>1$, Mathematica's polylogarithm function ...
0
votes
1answer
57 views

Combining functions - is this a case for Piecewise?

I have a function $Eb1$ which was the subject of a question I asked recently - you can see it here on stack exchange. Now, in that example it's specified between a boundary $r_n$ and $r_o$ where $r_o ...
0
votes
1answer
70 views

How to track row swap in Gaussian elimination?

How do I track which rows were swapped in the Gaussian elimination using RowReduce? I am doing metabolic control analysis on a mathematical of the energy metabolism I have in Mathematica. I need to ...
8
votes
3answers
652 views

Why are functions called first-class objects in Mathematica?

I've heard lots of people say a function is a first-class object in Mathematica. "Everything is an expression, including function." "There is no distinction between functions and data." Having read ...
8
votes
8answers
960 views

Finding maximum or minimum of implicit functions

is there any built in function that can be used to find maximum or minimum of implicit functions? For example, if we have the equation $$x^2 + y^2 = (2 x^2 + 2 y^2 - x)^2,$$ then we can visualize the ...
2
votes
0answers
100 views

Which functions automatically generate new functions?

In his video http://www.wolfram.com/broadcast/video.php?channel=362&video=1643, Wolfram gives the following example: the output from ...
2
votes
2answers
82 views

Funny behavior of Ellipsoid function

From its description I thought that the normalizations of the directions d_i of the semi-axes did not matter when using the ...
0
votes
1answer
84 views

Laplacian in D Dimensions

Is it possible to compute $\Delta F=\nabla^2 F$ for $F=F(x^1,x^2,…,x^D)$ with $D$ finite? I seem to be only able to specify spherical coorindates, for example, if I want to leave standard ...
0
votes
1answer
72 views

Cannot solve equation

I just started using mathematica and I'm facing a problem that I just can't solve. I want to solve the following equation: Code: ...
1
vote
1answer
100 views

How can I define a function that takes a list of reals?

I'm trying to define a function f which takes a list of reals. My purpose is to build a function which I can give a list of reals, integers or strings and have it ...
0
votes
2answers
100 views

Defining a function as a sum of several Gaussians

I have a function that is a summation of several Gaussians. Working with a 1D Gaussian here, there are 3 variables for each Gaussian: A, ...
0
votes
0answers
120 views

Problem With NDsolve trying to simulate n-body-gravity problem

Im Trying to model a cloud of point masses that act according to gravity, what im strugeling with is the exclusion of cases where euclidian distance = 0, If I try to do it with an If statement in my ...
2
votes
3answers
332 views

Tracking iterations of a function

I'm learning MMA with Wagner's book. On page 41, he uses this to display the iterative steps of a FindRoot. However, I can't seem to replicate this (code at end), perhaps due to the difference in MMA ...
4
votes
2answers
88 views

Function pattern to support listed and non-listed arguments [duplicate]

I often want to write functions that take as an argument either a) a rule or b) a list of rules. As an example, when using Replace with just one rule, it does not ...
6
votes
1answer
275 views

What is wrong about Abs[x]-a? Is it a bug?

Why is the Out[74] not {1 - a, {x -> -1}}? ...
0
votes
3answers
92 views

Create polynomials from Series

This question actually doesn't have quite a lot to do with the Series function, but I don't know how to describe my problem. So here's the thing. I'm trying to ...
0
votes
1answer
67 views

Integrating function can't be epressed? [closed]

Hi I have a function in a form of $$\frac{a}{x}exp(\frac{b}{\sqrt{3}-x})$$ The code is Integrate[a/x*E^(b/(3^0.5 - x)), {x, 1, 3^0.5}] But it can't work ...
2
votes
1answer
133 views

Define function that counts recursive fibonacci

If I write count=0; fib[0]:=(count=count+1; 0); fib[1]:=(count=count+1; 1); fib[n_] := (count = count+1; fib[n-2] + fib[n-1]); Then I can ...
1
vote
2answers
128 views

Define the square of a function [closed]

Is there any good way to define the square of a function in M9? Usually one can write e.g. f[z_] = 3*Sin[z] etc etc. But is it possible to define ...
3
votes
4answers
448 views

How to completely delete the head of a function expression

Is there any way to completely remove the head of an expression function? For example, how would I remove the head Cos from ...
1
vote
0answers
86 views

Expression for evaluating multiple functions?

I am constructing 3D data points for a plot and corresponding to specific conditions "manually". I define the values of five parameters [these I always have to define myself]. From those, I evaluate ...