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

learn more… | top users | synonyms

0
votes
1answer
22 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 ...
2
votes
1answer
120 views

An error disappears?

I needed to define a table of functions. And I did it like this: ...
0
votes
0answers
36 views

Graphics3D evaluation order problem

I have the following block of code: ...
10
votes
1answer
99 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
4answers
82 views

Converting an expression to function

I have the following problem. I current can automatically create the variable positionPayload, for instance: ...
3
votes
3answers
180 views
1
vote
1answer
66 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. ...
0
votes
0answers
36 views

Once working code fails upon restarting Mathematica [on hold]

I had a code which worked flawlessly, then upon shutting down mathematica and re-starting it, the code failed with the following error message: "The function value -Abs[f[0.0228659,I/6]] is not a ...
0
votes
1answer
56 views

Reverse of Apply on built-in functions [on hold]

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, ...
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 ...
6
votes
2answers
57 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 : ...
4
votes
1answer
79 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: ...
1
vote
2answers
72 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: ...
0
votes
2answers
46 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: ...
0
votes
1answer
52 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 ...
11
votes
0answers
93 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

Defining an array of functions with multiple indices and one variable [closed]

I have a function f of one variable x and a 4 x 3 array ...
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 ...
2
votes
2answers
88 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. ...
14
votes
0answers
141 views

Undocumented fourth parameter of Collect; how long has it been there?

While tinkering with How to get a list of monomials of a polynomial without coefficients? on a whim I tried a fourth argument in Collect and found: ...
0
votes
1answer
96 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, ...
2
votes
1answer
82 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 ...
2
votes
2answers
69 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
48 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 ...
2
votes
2answers
334 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 ...
3
votes
1answer
129 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
1answer
46 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 ...
0
votes
0answers
3 views

How to correct values diverging from reality [migrated]

I have two systems measuring the same thing: the state of charge (SoC) of a battery. The range is from 0 to 100%. One system seems to be correct, and shows a higher SoC of 30%, when the other systems ...
6
votes
2answers
163 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 ...
1
vote
1answer
41 views

DownValues when using Set and SetDelayed

It is known from several questions asked in SE that one of the basic differences between Set and SetDelayed is that the former ...
-3
votes
0answers
39 views

Saving function and using it later [duplicate]

I have a function (that works fine) and I want to use it next time I open mathematica. But currently I have to open up a .txt file and copy paste everything at the beginning.
0
votes
1answer
54 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 ...
2
votes
1answer
67 views

Use Map with multiple arguments over a nested list

I noticed there are a few similar questions to mine on here, but I couldn't figure out how to accomplish this mapping. I have sets of data I want to plot, which represent intensity and frames, and I ...
0
votes
3answers
73 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 ...
2
votes
2answers
137 views

Multiply pure function with scalar

Somtimes I still get lost in the Hold, HoldAll etc. functions of Mathematica. I want to scale a simple PDF function with a previously calculated variable e.g. ...
1
vote
0answers
54 views

Union sorting after ignoring some digits

I have a list with its bellow elements: {-0.7071067811865476, -0.7071067811865475, 0.7071067811865475, 0.7071067811865476} If I use Union, but there is no change. Because the numbers are different. ...
0
votes
1answer
40 views

Mapping Linear Model Fit Over An Arbitrary Number of sets

I have multiple sets of data, and I want to apply Linear Model Fit sequentially to each set of data. For example, below tstlst contains 3 data sets. Right now I ...
1
vote
0answers
50 views

How to test for a non--zero rational function? [duplicate]

I want to test if a rational function in one variable is identically zero. I was surprised that just writing f==0 doesn't do it. I wrote the following code: ...
0
votes
1answer
63 views

Plotting the tangent of a curve [duplicate]

I'm new to Mathematica and this is probably child's play for most people, but I wanted to know how to plot the tangent of the function below at the point e=1/4 : ...
0
votes
2answers
85 views

Examining the equations of a Differential Op Amp

I want to examine the equations of a differential Operational Amplifier, specifically I want to examine how the tolerances of the resistors affect the resulting differential gain and common mode ...
4
votes
0answers
80 views

Is there an elegant way of delaying evaluation of `A==B` when calling a function that uses this pattern

Suppose I wanted to define a number of functions that accepts expressions of the form: ...
0
votes
2answers
32 views

How to get Complement function working in a For loop? [closed]

I've been working on a piece of code that will delete small components from a nested uneven matrix (n pages, n rows, 3 columns), by deleting the pages with less than ~30 rows. However, I've notice ...
4
votes
2answers
114 views

Initializing several values of a function

How do I initialize several values of a function at once? Consider the function f[0] := 1; f[1] := 2; f[2] := 3; f[n_] := f[n] = f[n-1] + f[n-2] + f[n-3]; Is ...
4
votes
1answer
70 views

Split/unmerge merged cells in notebook file

I have merged cells in a Notebook file. Is there a way to split such a merged cell group back to single cells, in each of them being one command?
0
votes
0answers
178 views

Why does my calculation of a probability take too much time?

I am calculating the value of the following function for given argument values: ...
1
vote
1answer
68 views

Apply solution rules to new functions as parameters [duplicate]

Update: I put an screenshot of how my code and problem look like at the end. Say that Mathematica solved a system of equations and got two answers {{a -> 3, b -> c, d -> 0}, {a -> -3, b -> 0, c -> ...
0
votes
0answers
19 views

Protected Tags Error [duplicate]

While trying to run this piece of code: ...
2
votes
0answers
49 views

Problem with plotting a function that calls FindRoot

I am having difficulties in plotting the solution of FindRoot to solve 4 variables. I defined a function and then tried tp plot it, but got an error message ...
2
votes
0answers
39 views

Covariance matrix estimation when number of variables is larger than number of observations

It is well known that the sample covariance matrix estimator results in a singular matrix if the variables is larger than the number of observations. One solution is to apply shrinkage estimators. ...
3
votes
1answer
82 views

Partial fraction expansion with complex numbers

$$\text{Apart}\left[\frac{1}{x^4+1}\right]$$ Does nothing. How can I get it to expand it. Sometimes it is useful.