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

learn more… | top users | synonyms

1
vote
1answer
181 views

Transform list of inequalities into matrix form $A\ x \leq b$

I have a list of linear inequalities, and I want to get it into the form $A\ x \leq b$; i.e., find the matrix $A$ and the vector $b$. Is there any function in Mathematica that can that can do this?
3
votes
2answers
3k views

Define a color function using Piecewise

How can I define a ColorFunction for my ContourPlot using Piecewise? For example, after ...
0
votes
2answers
472 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 ...
2
votes
1answer
65 views

Create an accumulator array from a function

I am making some images for a project about the hough transform line detection, I am showing the slope-intercept form , the normal form and their accumulator arrays to show the peaks. I am kind of new ...
1
vote
1answer
53 views

Using the Nest function — Confusion on my output

I have the following code and output where the original function is $f(x,a) = a^2 - x^2$. ...
2
votes
0answers
63 views

How do I define a collections of commands for later use? [duplicate]

Many ask me to tackle this problem by making another function(subroutine) of the lines I want to pick out, using Block,Module,etc The problem is different here.Notice that Block and Module ...
0
votes
0answers
28 views
3
votes
1answer
74 views

plotting after solve does not display anything

I'm quite new to Mathematica language, I am trying to figure out where I am making mistakes in Plotting a specific function that depends to other variables: I want to plot ...
2
votes
0answers
53 views

Different behavior of Power between versions 9 and 10

Rather by accident I've noticed that the following trivial code produces different output in Mathematica 9 and 10: -((-1)^n) Mathematica 9: $-(-1)^n$ ...
4
votes
0answers
71 views

RealDigits and functional style

So while thinking about Replacing numbers of which you only know certain digits I have faced, again, a problem that I find hard to extract from RealDigits' output ...
0
votes
1answer
69 views

If Statement in function does not evaluate

I've written a function that should try to simulate a "triangle-wave-signal", given a few parameters. It looks like this: ...
1
vote
1answer
47 views

Want to map over both the file data and the file names of the data source files

I have a lot of experimental datafiles I would like to plot first and check, if they can be used for further analysis or not. To avoid importing every single file I used FileNames and than mapping. ...
11
votes
2answers
254 views

Vertex descendants subgraph

Keywords: vertex, ancestors, descendants, subgraph, directed graph, flow subtree So let's say we have a TreeGraph: ...
4
votes
5answers
322 views

Alternative to Sign

The Sign function works in a very straightforward manner: Sign[8] Sign[-8] Sign[0] ...
6
votes
1answer
142 views

Unexpected behavior from Indexed (threading and messages)

I was going to include Indexed in this answer, thinking that it operated much as a List-only ...
19
votes
1answer
261 views

What is the difference between defining a function and specifying the type of argument, versus applying a test to that argument?

Say I want to create a function that evaluates differently based on what type of argument is given. I've found two ways of doing this, ...
1
vote
2answers
77 views

Problems using a function as an argument

I made a function: f[x_]:=x^2+1 and when i use it on, for example f[5], i get the answer 26. . But when i use it on: PollardRho[a_, f_] := Module[ {}, Return[f[a]] ] And when i write ...
2
votes
2answers
2k views

How could I define a function as the solution of equations in Mathematica?

I have posed a specific question yesterday but it may be too trivial to answer. I think the question could be asked in a more general way so it is easier to answer. Then I could solve the original ...
0
votes
1answer
45 views

Using the Solve function [closed]

I am new to using Mathematica and am attempting to find the roots of a function using the Solve[] function. I can replace $f[x]$ within Solve[] with the actual function and it will work that way, but ...
3
votes
2answers
105 views

How do I run 1-855 data points( imported from excel sheet) into a formula to obtain value for each data point?

I am very new to Mathematica and I just couldn't figure out the solution for the following problem. I have two columns in an Excel file. I have imported the 1st column as ...
0
votes
1answer
51 views

Oddity with ToExpression [duplicate]

Is this a bug? ToExpression["3231.432"] 3231.43 I would have expected the following: 3231.432 I am using Mathematica 10.2.0
4
votes
1answer
114 views

Associations complement

So I'd like to complement two associations through shared keys... not the best description, so here's an example: ...
2
votes
2answers
154 views

Revolve a non one-to-one function about the y-axis

I am attempting to revolve $f(x)=-x(x-3)(x-2)^2$ about $x=0$. What I have come up with is that I need to redefine each interval between the relative extrema as a separate function, and then treat it ...
1
vote
1answer
53 views

Define a function interactively with sum

I have to define a function which has 1e4 terms added up together. f(x1, x2) = (sum i, j, k, l from 1 to 10) (C(i) * C(j) * C(k) * C(l) * exp( (alpha(i)+alpha(j)) * x1 + (alpha(k)+alpha(l)) * x2 )...
4
votes
1answer
228 views

Computing the Caputo fractional derivative of a polynomial

In fractional calculus, the Caputo derivative of a monomial has the following form: $$\operatorname{\mathit D}_t^\alpha\,t^\beta = \frac{\Gamma(\beta+1)}{\Gamma(\beta-\alpha+1)}t^{\beta-\alpha}$$ I ...
0
votes
1answer
47 views

How is the DistributionFitTest[data, dist] function actually using the dist parameter?

The first "Applications" example given for the DistributionFitTest of the Wolfram Language & System Documentation Center is: Analyze whether a dataset is drawn from a normal distribution: <...
2
votes
1answer
54 views

Simple plot but the origin is not clear [closed]

I am having problem with the simple plot below. Plot[1/(1-x), {x, 0, 1}] I got the result: As you can see the origin (0,0) is not clear. The value of the function at x = 0 is one but it is not ...
1
vote
1answer
48 views

Having trouble taking derivative of a function and assigning it to a new function [closed]

I am trying to take the derivative of a function and assign it to a different function name, but I am getting an error message (I think). Here is my Mathematica input: ...
11
votes
6answers
446 views
6
votes
1answer
149 views
12
votes
1answer
892 views

Why is this 2D plot so slow?

I first do a 3D Plot of four surfaces (eigenvalues of a $4\times4$ matrix) over $kx,kz$ (setting $ky=0$ all along). And then I try to give a 2D plot along three connected particular lines in $kx,kz$-...
4
votes
1answer
106 views

Do Any of the filter functions perform a LOESS or LOWESS filter?

From the Data Transforms and Smoothing guide there is a link to the Linear and Nonlinear Filters guide. Do any of these filter functions perform a LOESS or LOWESS filter on set of paired data? ...
7
votes
2answers
293 views

Why doesn't this pattern work?

I want the in-built function Count to count the elements in a list which are greater than a value. Example: ...
1
vote
1answer
85 views

Double arguments and place of the underscore

Could someone explain me of this bit of code below is correct: Is it possible to define a function with a second bracket, see below, i.e. f[x_][y_]? And what does ...
1
vote
1answer
58 views
19
votes
5answers
498 views

Partitioning a list when the cumulative sum exceeds 1

I have a long list of say 1 million Uniform(0,1) random numbers, such as: dat = {0.71, 0.685, 0.16, 0.82, 0.73, 0.44, 0.89, 0.02, 0.47, 0.65} I want to ...
1
vote
1answer
76 views

How do I write a function inside a ArgMin

I want to solve this ArgMin[NIntegrate[(Tanh[x] - Erf[x/a])^2, {x, -5, 5}], a] and it does not work, what is the correct way to do this? ...
1
vote
2answers
51 views

using Map to apply 2 lists to the LCM function - help [duplicate]

I have 2 lists of numbers and I want to quickly compute the array of answers to the LCM function for the 2 lists and a 3rd static number. I tried the following ...
2
votes
1answer
133 views

Find a family of curves

I have a diagram with seven curves (each with a different parameter). My goal is to find a function for the family of curves (i.e. a single function not just for the seven parameters, but for all ...
1
vote
0answers
90 views

Using functions in Solve [closed]

i wanted to calculate the real roots of a function. To my knowledge the function i defined has no real roots, so i expected an emptyset, but instead i got some Root[...#..] answers by Mathematica. ...
0
votes
0answers
52 views

Personal Reminder with Speak capability repeats multiple times

I am trying to create a personal reminder for myself using the Speak function in Mathematica hoping that the computer speaks the task only once at the designated time. However, I have found that the ...
5
votes
3answers
184 views

How to tell Mathematica to get the real-only inverse function?

The problem I have is that Mathematica seems to play better with complex numbers so that the result of N[InverseFunction[Function[x,x^3]][-1]] is ...
2
votes
2answers
66 views

Multiple functions with shared arguments in Manipulate

I am trying to define multiple functions with the same set of parameters and then put them in a Manipulate to simulate their behavior. Ideally it should be something like that: ...
6
votes
2answers
141 views

Getting an explicit representation of the function returned from Interpolation [duplicate]

I am using Interpolation to get an InterpolatingFunction that fits a set of points. For example, ...
0
votes
1answer
50 views

How to apply a user-defined function to a list [closed]

I'm using Wolfram | Alpha Pro; I have a function f[n] = 351n^(-0.7); How do I apply it to each element of a list like {2, 9, 22}? f/@{2, 9, 22} just results in ...
0
votes
1answer
99 views

Interpolate the discrete list into continuous function

I have a data whose list plot shows up following graph I would like to interpolate the missing data and make the function continuous but for particular x-coordinate there is multiple values of $y$ ...
1
vote
0answers
31 views

Function with many lines that takes image as parameter not returning same result as if I run the same lines of code

Running the exact same lines of code in a function produces just a return of the original image without any points identified, whereas when I run the exact body of the function line by line it works ...
0
votes
2answers
66 views

How to find the value of a variable using solution of Simultaneous equations? [closed]

I have to find the value of p where p=a1*x+b2*y; using the solution of the equation ...
1
vote
0answers
91 views

Need help interpreting a small block of code [closed]

I have recently "inherited" some Mathematica scripts which I need to interpret to write in some other languages (Maple and C++). I have never used Mathematica before so I have been learning on the job....