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

learn more… | top users | synonyms

25
votes
2answers
567 views

Why is Query so much slower than Part?

Time for another of these(1),(2) as yet another new-in-10 function appears to have poor performance compared to older alternatives. This time: Query appears to be ...
4
votes
3answers
1k views

ArcTan[z] and ArcTan[x,y], Restriction and Conversion

In Mathematica there are two different forms for the arctangent (inverse tangent), namely ArcTan[x,y] which gives the arc tangent of $y/x$, taking into account ...
4
votes
1answer
104 views

How to apply RootLocusPlot correctly

I have to analyze the complex regions of variable c which is define obtained with InverseLaplace help in the form ...
0
votes
1answer
34 views

How can I apply a matrix 2*2 to binary digits? [closed]

I want to apply a matrix 2*2 to a binary digits. For example, D and E are two matrices that they apply to a 1 and 0. D --> 1 & E --> 0 binary digits: (1011) --> D.E.D.D
9
votes
2answers
195 views

Probable Bug in HighlightMesh with 2D Convex Hulls created via ConvexHullMesh

Bug introduced in 10.0 and fixed in 10.2 One nice way to view the new and exciting Mesh objects introduced in Version 10 is by utilizing the function ...
1
vote
1answer
51 views

Using Get function to return a specific expression

I am trying to use Getto import data saved as a .nb document. The problem is Getevaluates all expressions but only returns the ...
3
votes
2answers
2k 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 ...
10
votes
1answer
496 views

GeoDirection and GeoDistance Memory Leaks: How to Recover the Memory?

Bug introduced in 7.0 and fixed in 9.0.0 The functions GeoDirection and GeoDistance have memory leaks. To see this, run the example functions below and watch as the Physical Memory Available in ...
-1
votes
4answers
97 views

Converting an expression to function [duplicate]

I have the following problem. I current can automatically create the variable positionPayload, for instance: ...
11
votes
1answer
116 views

Using Rules inside SequenceCases degrades Performance

Consider the following: SequenceCases[Range[10^4], {a_?PrimeQ, b_, c_?PrimeQ}]; // AbsoluteTiming {0.0058148, Null} If we now try to use a rule to transform ...
2
votes
1answer
126 views

An error disappears?

I needed to define a table of functions. And I did it like this: ...
1
vote
1answer
67 views

I keep writing functions like this one: subtract[{a_, b_}] := Subtract[a, b] [duplicate]

(Edited to provide an example) Recently I have found myself writing silly functions like the following, which is just a new arity of Subtract in which the arguments are inside a list. ...
2
votes
1answer
112 views

Dirichlet convolution of two lists [closed]

The Dirichlet convolution of two arithmetic functions f,g is defined by $f\ast g(n) = \sum\limits_{d|n} f(d)\ast g(n/d)$ How can I get the Dirichlet convolution of two lists? For example: Input: ...
2
votes
1answer
122 views

Can I make a function which depends on several arguments which are not independent?

Here's a simple example Suppose have the permanent relation that z is proportional to xy^2, for real numbers s. z = s x y^2 Now, we are interested in ...
0
votes
1answer
55 views

Create a sum with the Do function and modules

I should define a function which sums up from k=0 to 100, with x=1; using the ...
23
votes
2answers
20k views

How to express trigonometric equation in terms of of given trigonometric function?

How can I express a trigonometric equation / identity in terms of a given trigonometric function? using following trigonometric identities ...
0
votes
1answer
57 views

Reverse of Apply on built-in functions [closed]

So if I have can use Apply and Or in combination: Or @@ {a, b, c, d} Out: a || b || c || d One could also use Or[a, b, c, ...
6
votes
2answers
63 views

How to count the number of values in a discrete function?

I have a discrete function of an integer variable $n$ defined like this : ...
2
votes
2answers
80 views

Options for a function I define that can be passed to functions I call in the definition

I know, this is very close to Functions with Options and/or Function with custom Options and modified Options for built-in Symbols, but I don't get it. My function looks like this one: ...
18
votes
1answer
250 views

Default behaviour of Hash[expr] and hashing in different versions of Mathematica

In different versions of Mathematica, Wolfram silently changed the behaviour of Hash when the algorithm is not specified explicitly ...
4
votes
1answer
86 views

Substitute a function's definition for its name

I'm having trouble with a function which is supposed to work on another function. Simplified version: ...
14
votes
1answer
271 views

What Method options does FindInstance accept?

While answering Trouble getting FindInstance to return multiple results for certain constraints it became clear that for this problem FindInstance would be better ...
0
votes
2answers
52 views

Function to list Collatz sequence doesn`t work [duplicate]

I am new to Mathematica and was trying to make a function that lists the Collatz sequence stating with a given number, but I can´t get it to work. Here is my function: ...
6
votes
2answers
782 views

Evaluating an If condition to yield True/False

I would like to decide whether an option passed to my custom function has the value Automatic or something else. This is my attempt: ...
8
votes
3answers
416 views

Radon function result's repeatability

Bug introduced in 9.0.0 and fixed in 9.0.1 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. ...
0
votes
1answer
57 views

Implementing Antilogarithm[b, x] and Cologarithm[b, x]

Mathematica functions for antilogarithm[b, x] and cologarithm[b, x] don't appear to exist, but I think they could be ...
2
votes
3answers
356 views

How can I apply calculus to functions obtained from NDSolve?

Originally, I asked the question below, but the real underlying issue is as follows: When we solve an ODE numerically, I get the answer like this: ...
1
vote
1answer
138 views

Horizontally compress a picture with varying compression ratio

I have a function c[x] whose domain and range are both [0,1]. And I have a picture with width W, height ...
11
votes
0answers
101 views

HistogramList is much Slower in 10.2 vs 10.1

While I was running a code I wrote using version 10.1, I noticed that in version 10.2 the running time of the same code was more than twice as long. After some digging, I figured out the culprit is ...
0
votes
2answers
42 views
14
votes
1answer
227 views

Compability between Graphics coordinates and shifted projections in GeoGraphics

Bug status V. 10.0.0 - V. 10.2 I'd expect GeoGraphics to handle positions of points since they are provided with ...
3
votes
1answer
322 views

NestList with a list inside?

I'm new to Mathematica, and was looking for more efficient ways to implement the Do loop below. a, ...
8
votes
2answers
240 views

Make Sinc'[0] return 0 instead of Indeterminate

I want Sinc'[0] to return 0, but instead it returns Indeterminate. I've tried Unprotect[Sinc] Unprotect[Derivative] Derivative[1][Sinc][0] ^= 0 But it doesn't ...
2
votes
2answers
92 views

Function with lazy and non-lazy arguments

Consider the function Z[entropy_, beta_] := Sum[E^(entropy[[i, 2]] - beta entropy[[i, 1]]) , {i, 1, Length[entropy]}] where entropy is a list of pairs (e.g. ...
1
vote
0answers
21 views

Use functions to call a named object [duplicate]

Now I have several interpolation functions called x30, x50, z30, z50...... I wish to write a function to call these function by inputing x or z and numbers automatically, and assign a argument x to ...
0
votes
1answer
100 views

Functions as objects [duplicate]

I have a very long program I'm trying to stuff express as a single function. (I'll include it at the bottom of my post.) My long-term goal is to trim out the file handling portion of this function, ...
28
votes
2answers
883 views

Strange ::usage behavior in v9

Bug fixed in 9.0.1 Something has gone wrong with usage in Mathematica 9. Would someone tell me how to fix it? I define a function ...
32
votes
2answers
1k views

Variable naming changes everything

Bug fixed in 10.0.0 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 ...
2
votes
1answer
89 views

How to get numerical results from HeavisideTheta?

I have defined a table tab = {7.52521, 17.0083, 22.5678, 11.8707, 8.27799} and a function ...
15
votes
2answers
161 views

How to create a dynamic expanding DisplayForm's styled like the ones in v10?

The display forms for objects like ClassifierFunction are nice clickable boxes I like this, and now I'm trying to create my a custom version of this for my ...
2
votes
2answers
73 views

Analytic differential of an inverse transcendental function

I have the following function: $$ y(x)=\frac{Ax}{Bx^{1/4}\sinh{(\frac{Bx^{1/4}}{2})}}\left(\cosh{(\frac{Bx^{1/4}}{2})}-1 \right), $$ where $A=112.941$ and $B=18.6588$. I want to find the differential ...
0
votes
1answer
51 views

Module using for creating a table [closed]

I want to have a 4 tables with using of module. Unfortunately I don't know why doesn't it work ...
3
votes
1answer
134 views

How can you get the area of a region from an image?

Suppose we have a square of side "L" m, How can I calculate the hatched area, if the corners of the square are centers of circles. It can be generalized to any region? edit: This is the result I ...
2
votes
2answers
341 views

Opposite of Alternatives

I was looking at this question (here) and I tried to find any thing gives the opposite of Alternatives. In other words, some pattern matching function that gives ...
11
votes
4answers
378 views

Is there a concise form of Which or similar conditional?

Suppose that I want to write a function fun that takes an Integer num as input, and returns ...
2
votes
1answer
48 views

Appending Delayed Evaluation

I have a function that need to be summed over all parameters given in a separate list. f[x_,y_,z_,n_,i_]:= (*Some function*); list={{n1,i1},{n2,i2},...}; I need ...
6
votes
2answers
174 views

Round vs. Floor vs. Ceiling for non-integers non-orders-of-magnitude

I understand that Round give the nearest even integer for cases where the number is between two integers, i.e. Round[2.5] = 2 ...
0
votes
3answers
79 views

Confusing “Part::pspec” and “Part::partw” following call to ParametricPlot3D

The problem I'm having is that the function definition given below continually gives me baffling error messages. I'm trying to turn a list of 3D points into a function that approximates a curve by ...
0
votes
1answer
59 views

Applying corresponding elements of a list to a list of functions

I found this post which applying a function to a list of functions and arguments. I thought I could change my code with a table to something more elegant. I am not wedded to the ...