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

learn more… | top users | synonyms

0
votes
1answer
38 views

Permanently fixing a variable in the function

I need to define a function let's say f[x_, y_] := x^2 + y^2 such that I need to fix one variable (let's take y = a) and to ...
0
votes
2answers
49 views

Supply a function as an argument to another, and find its minimum

I would like to minimize a function, which is supplied as an argument to another function, and report back the estimates of the values of the variables that result in its minimum. In specific, I would ...
0
votes
0answers
18 views

handling the logistics function [on hold]

I have the problem, I have to handle the logistics function at two points. That is my initial and final cordenas cordenas. But do not know how to apply that formula. As would be the formula for this ...
6
votes
1answer
147 views

Prevent Export from overwriting files

Export["filepath1",Expression1] works for me, but if filepath1 already exists, it will be overwritten. I'd like ...
1
vote
1answer
121 views

General function taking general number of arguments

The following is an edit of this post, for which a working solution was provided by John McGee. I have a different function and am not sure how to adapt the solution for it: I want to construct a ...
0
votes
2answers
57 views

Function that creates a table from two lists

I have two lists shown below: list1 = {(0,0,0,0),(0,0,0,1),(0,0,1,0),...,(1,1,1,1)} list2 = {1,5,5,5,...,5} How can I construct a function that outputs a table similar to this: $$\begin{array}{c|c} ...
0
votes
1answer
88 views

Help with functions in Mathematica

Still learning how to do things in Mathematica. I want to make a function that has many parts. Doing this in something such as Java, which I am familiar with, would be simple. In Mathematica I have ...
6
votes
1answer
165 views

How trustworthy is NMaximize?

Suppose I solve a constrained optimisation problem using NMaximize. How confident can I be of the accuracy of the result? For concreteness, suppose that F,G are ...
0
votes
2answers
47 views

Fitting data in form $f = f_0 + c A^x$

The Fit[] function in Mathematica can fit data in form of $f = f_0+c_1x+c_2x^2+...$ ($f_0$ and $c_i$ are unknown constants), is there a function can fit date in ...
5
votes
2answers
141 views

What does IndexBy do and how exactly does it work?

I just saw the function IndexBy in the autocomplete suggestions and I was curious to know exactly how it works. Unfortunately, there's no trace of it in the ...
0
votes
0answers
48 views

Peak to Peak evaluation [closed]

I'm a mechanical engineer and I'm a new user of Mathematica (I'm trying to improve my knowledge about the enormous potentialities of this program); I'm actually working on a notebook that solves a ...
0
votes
2answers
72 views

Is there a function that filter positive values x = f(x), and return zero for all negative values? [closed]

I'm searching for f that will comply this definition : x = f(x) where x is natural >= 0 0 = f(x) where x is natural < 0
0
votes
0answers
44 views

How is the error function $\rm erf(z)$ evaluated for a complex argument? [closed]

The traditional error function $\rm erf(z)$ is defined over the real numbers only. When I evaluate Erf[1 + 2I], I obtain an approximate value $\approx ...
0
votes
1answer
70 views

How to create a line due to requiriements?

Considering we have three lines, and know the intersection points (How to find intersection points of lines?) How can I draw a line that will cross the intersection point of the two lines and will be ...
1
vote
3answers
306 views

How to find intersection points of lines?

Considering I have three functions f1 = -x + 1; f2 = x - 1; f3 = x + 3; How can I find the intersection points of this functions? Thanks. This didn't work ...
0
votes
0answers
61 views

What is the product of 1+1/p^2 over all primes p? [duplicate]

Can Mathematica Sum or Multiply over the set of all primes? I can get an estimate of my question in the title with: ...
4
votes
3answers
208 views

Problem about an ant walking up a hill

An ant is walking up a hill given by $f(x)$. At what point can it see a blade of grass. I've been working on this problem with Mathematica and by hand. Help with either would be fantastic. The ...
1
vote
1answer
47 views

Using Inner to calculate a log likelihood

I am trying to use the function Inner to calculate the sum of log likelihoods of a custom probability distribution 'custom' applied to a vector of data 'vData'. The custom distribution changes ...
-2
votes
2answers
77 views

Plotting self-made functions [closed]

EDITED AS SUGGESTED I have defined a function, which takes two values and returns a function n(x), like so ...
0
votes
1answer
38 views

Summation of functions

I want to define a function that is a sum of other functions. For this, I define functions of the form ...
5
votes
2answers
118 views

Using MovingMap to calculate percentage changes

MovingMap (new in version 10) applies a function to discrete data over a moving window. This is very convenient for calculating the percentage change of a series. ...
2
votes
1answer
79 views

Dirichlet convolution of two lists [closed]

The Dirichlet convolution of two arithmetic functions f,g is defined by $f*g(n) = Sum_{d|n} f(d)*g(n/d)$ How can I get the Dirichlet convolution of two lists? For example: Input: ...
0
votes
1answer
40 views

How to set a shared variable Power (a modified one)?

Unprotect[Power]; Power[0|0., 0|0.] = 1 ; Protect[Power]; Table[0^0, {i, 5}] No problem at all. ParallelTable[0^0, {i, 5}] ...
0
votes
1answer
54 views

Mathematica function to generate a different 4 digit number [closed]

I m looking for a function that permit me to generate a different 4 digit number (>0) each time (to 4^10 possibilities) corresponding to a parameter that will never be the same (like current ...
0
votes
0answers
44 views

subtlety of self-defined function and its evaluation [duplicate]

I wrote a simple code as follows f[x_,y_]:=NIntegrate[x+z,{z,0,1}]; g[x_,y_]:=NIntegrate[y+z,{z,0,1}]; VectorPlot[{f[x,y],g[x,y]},{x,0,1},{y,0,1}] then ...
3
votes
2answers
96 views

How to define a list of symbols as a list of functions?

I have a list in Mathematica for example P={1+t,1+t+t^2,1+t+t^3}; My question is, how I can define each element of this list be a function of ...
1
vote
1answer
32 views

Cannot use Part in Pure Function [duplicate]

I need to select some lists in the nested list of form of {{1,2,3},{2,3,4}}. I have used Select to complete my work. But when I tried Position, it doesn't work. For example, ...
1
vote
1answer
48 views

Mathematica defines a function as list

This might be a very silly question but i'm defining a function as: \[Chi][AR_] := ((AR^(2) - 1)/(AR^(2) + 1)); which is clearly a scalar function of AR; however ...
3
votes
1answer
86 views

Creating an autokey cipher function

Can someone help me with putting what I can say in words into code. I want to create autokey encrypt and decrypt functions (just wanting help encrypting and then can figure out decrypting). Everything ...
2
votes
0answers
62 views

Is there a documentation generator for Mathematica?

I'm looking for a way to document the functions of my packages inline, preferably inside comments. There should be a Doxygen type tool for this that takes comments and that generates html from markup ...
1
vote
1answer
52 views

Creating the Nabla operator as a operator

How can I define the nabla-operator as a an operator, acting on everything to the right of the operator! Also taking \[Del]^2 would give the second derivivates. I wish to be able to write ...
5
votes
4answers
171 views

Sort two lists at the same time, based on another

I am new to using Mathematica and I can not find a solution to what I am wanting to do. I want to take a list such as: x = {1,2,3,4,5,6,7,8} and a second list ...
2
votes
1answer
167 views

What method does `NIntegrate` uses by default?

There is a variety of algorithm for performing numerical integration (See wiki). What method does NIntegrate uses by default? I looked on the documentation page and I saw that the function ...
1
vote
1answer
172 views

Shorthand for operations?

Mathematica has a large number of built-in symbols, and I am unsure when there is a shorthand for the operation I am trying to perform. Question 1: Is there a shorthand for the function ...
0
votes
0answers
42 views

Can Mathematica return the first few terms of a sequence given the first few terms of a Dirichlet Generating Function?

For example: a=Sum[1/n^s,{n,1,6}]; Expand[a^2] returns a big mess. I want to see something like: 1/1^s + 2/2^s + 2/3^s + 3/4^s + 2/5^s + 4/6^s + ... + 1/36^s.
2
votes
0answers
20 views

Determining default value from previous arguments [duplicate]

How does one specify a default value for an argument which is dependent on the previous arguments of a function? For instance, consider the function ...
1
vote
1answer
44 views

Function does not initialise variable as changes are made in the manipulate function

My function "DefineRss[]" takes in three arguments and outputs a plane value. It sits in the first argument of the function plot3D and that in turn sits in the manipulate function The function also ...
1
vote
1answer
46 views

Minimize under constraint on an interval

I want find the minima of a (multivariable) function under a constraint which has to be fulfilled on a whole interval, let's say $$ \nabla f (\underline x) = 0 \ \\ \ c(\underline x,s)\geq0\ \forall ...
1
vote
2answers
42 views

Evaluate list of functions at a certain point

I have a list of functions (actually they are derivatives) of the type: {D[g[x,y],x],D[g[x,y],y]} I would like to evaluate all of these functions at a point, ...
4
votes
2answers
89 views

DeleteMissing issues [duplicate]

Has anyone had problems with the DeleteMissing function in Mathematica 10.0.2? I find that it rarely works. Most of the time it returns a list which still contains ...
-1
votes
1answer
63 views

My code of plotting a two-variable function is too slow [closed]

I have a code in which my complicated function to be plotted is F(x,p). I would like to graph it for 5 values of p equal to 10^7, 10^8, 10^9, 10^10 and 10^11 for x values between 0.01 and 0.99. All ...
5
votes
5answers
229 views

What is primary, function computation or function application?

What is the order of computations here? g[x_]:=x^2; f[x_]:=Sqrt[g[x]]; Map[f, Range[100]] Does this code first get $f(x)=x$ and then gives its values or for ...
0
votes
0answers
96 views

Problem with FindRoot applied to functions

I am having difficulty with the error "is not a list of numbers with dimensions..." when using FindRoot (and other numerical routines in Mathematica) to solve equations numerically when the argument ...
0
votes
1answer
43 views

How can I change variable passed to a function? [duplicate]

Sometimes I'd like to make a function, which would take an argument "by reference" instead of usual "by value". This is semantically similar to what e.g. AppendTo ...
0
votes
1answer
75 views

Finding x when sin(x) = -.758 [closed]

I'm not understanding how to find all the angles for when sin(x) is equated to a negative decimal can someone explain to me how to find it..? So far I came up with 49.288 degrees, and 229.288 degree. ...
0
votes
0answers
48 views

Applying the square root of operator on polynomial functions

I am trying to apply an "operation" on polynomial functions: apply the operator $(\frac{\partial f}{\partial x}-y\frac{\partial f}{\partial z})^2+(\frac{\partial f}{\partial y}+x\frac{\partial ...
1
vote
0answers
55 views

What's real analogue for FromDigits?

FromDigits only works for integer strings. What's its real-number analogue?
7
votes
1answer
122 views

Compability between Graphics coordinates and shifted projections in GeoGraphics

I'd expect GeoGraphics to handle positions of points since they are provided with GeoPosition wrapper. But it is not the case ...
2
votes
2answers
127 views

Permanently rounding numbers/values to a given number of significant figures

I am searching for a simple way of rounding and setting an input to a desired number of significant figures. There are a vast number of posts that discuss similar problems, but none address this ...