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

learn more… | top users | synonyms

0
votes
1answer
45 views

Problem with Apply [duplicate]

I have am trying to obtain the average of the distance from the mean radius for each shot in a group of shots at a target. I am having problems with the very last line. The output of the last line ...
11
votes
1answer
176 views

Why is this evaluation halved when adding units?

Why does this strange behavior occur when dealing with units and quantities? ...
4
votes
0answers
79 views

Why does FromDigits transpose its argument (sometimes)?

FromDigits /@ Transpose@{{1, 2}, {3, 4}, {5, 6}} == FromDigits @ {{1, 2}, {3, 4}, {5, 6}} (* True *) The only "strange" syntax I've found in the docs is ...
1
vote
3answers
138 views

An argument pattern that my function can treat as Times[constant, variable]

I want to define a function of two variables, func[f_, g_], such that when it sees a general constant multiplying one of the variables, say ...
1
vote
0answers
58 views

Why can't I use OmegaPrime to find the Limit of Prime[n]? [duplicate]

I've looked at these links already; What are the limits of the Prime-functions? What is so special about Prime? which gave an answer for earlier versions of Mathematica. Yet when I try to input ...
6
votes
2answers
378 views

Position function not always returning an answer even with no apparent problems

I'm having some problems with Position. Sometimes it will give an empty list instead of the actual position of the element I am looking for when that element is ...
1
vote
2answers
514 views

How can I separate two parts of power of Exponential functions?

How can I separate two parts of power of exponential functions in Mathematica? I have an expression similar to this one: a*b*Exp[u+v]+c*Exp[u] I want to set ...
4
votes
3answers
171 views

Convert `FullForm` to XML Structure and back

How might I create a function that converts between FullForm and a XML structuce? Ultimately I'm ideally looking to use CSS and JS to edited the XML structure. ...
7
votes
1answer
134 views

How would one return from a place of a pure function's body using Return?

From previous answers, replies and discussions it is known, while not formally documented (even in the most recent Wolfram Language Documentation Center), that Return can be used in a two-argument ...
1
vote
0answers
93 views

what is the means of (0 -> 1) of series expansion [closed]

I use mathematica 8 to take a taylor expansion.In the Output, the expression (0->1) appears in the second term and all higher order term, and this expression is multiplied with other coefficient and ...
16
votes
1answer
196 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: ...
7
votes
1answer
141 views

What kind of creature is h[c] for definition h[c_][x_] := (* function of x and c *)

To implement "Hero's Method" for approximating $\sqrt{c}$, one iterates the function (x + c/x)/2 for a given number c (e.g., ...
4
votes
0answers
92 views

Optimization of recursive functions by using the //. operator [duplicate]

In some cases, recursion in Mathematica (without storing values) is not very efficient. For example, the recursive implementation of Fibonacci numbers (version which doesn't store the values) : ...
1
vote
1answer
138 views

How to create a vertical (smooth) Histogram on the y-axis of a function graph for an uncertain x?

This is my first time posting a question in StackExchange. I have encountered a certain problem and I can't seem too find a solution. Just a word of caution, I am kind of an amateur when it comes to ...
1
vote
3answers
128 views

Complement[] changes order of elements?

Consider this example: Complement[{a, y, c, d, e}, {a, c}, {d}] (*{e, y}*) However, I was expecting the result to be: ...
7
votes
2answers
218 views

Built in function without Attributes Listable works as if it has Attributes Listable

Can Built-in function works as if it has Attributes Listable even if it doesn't have that ...
14
votes
1answer
408 views

Why is an Identity function needed?

Today I came across the function Identity[x] in Mathematica (documentation). The example given in the documentation uses it in ...
18
votes
2answers
305 views

Where is the old option TraceInternal->True?

Already at least in version 2 (I think), the function Solve calls the function Roots. At that time, I had a rather dirty trick, that still works, to verify this: ...
0
votes
1answer
130 views

Help with functions in Mathematica

I'd like 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 these "pieces", which I want to put into a ...
0
votes
1answer
121 views

Mathematica Lattice Reduce Command

I'm going through a very old copy of "Mathematica: A System for Doing Mathematics by Computer" for self practice. I'm on chapter 3, and ran into the LatticeReduce ...
2
votes
1answer
62 views

RootReduce-Part of Solve

I have given the following expression in $M$ and $z$: \begin{equation} a = \frac{-4 M^2+M (-3 z-5)+\frac{1.1875 z}{\sqrt{\frac{0.015625 z}{M+1}-1.5625} \sqrt{\frac{0.765625 ...
9
votes
2answers
234 views

Pattern and Orderless function

I'm a Mathematica beginner. I am exploring the use of patterns and (only for fun) am trying to implement a permutations function. My (dirty) code is: ...
12
votes
4answers
208 views

Distributing function arguments with function compositions. How to compute $(f + g^2)(x) = f(x) + g(x)^2$?

Suppose I have two functions f and g. To compute $f + g$ evaluated at a point $x$, I know that one can use ...
3
votes
1answer
68 views

Table generation with SetDelayed function [closed]

I would like to understand why the following two outputs differ: Let us define the following data set: ...
3
votes
2answers
96 views

Working with CDF Deployment

I've been working with FreeCDFs in Mathematica 10 and it has been going fine as long as I do not pull from a database or access local files. I recently purchased the Mathematica 10.2 Enterprise ...
7
votes
6answers
2k views

Series expansion in terms of Hermite polynomials

I am trying to expand a polynomial in terms of orthogonal polynomials (in my case, Hermite). Maple has a nice built-in function for this, ChangeBasis. Is there a ...
0
votes
1answer
70 views

Working with functionals [closed]

I am trying to work with functionals in Mathematica, this means that I want to define a function of a function. I defined my function of a function as: ...
20
votes
1answer
209 views

Strange behavior with Cases and Position with SetDelayed

I feel like I must be missing something simple and obvious here, but this has me scratching my head. This works as expected: ...
1
vote
0answers
40 views

Why does the same function defined by Set and SetDelayed look different? [duplicate]

I start with the following input: f[n_] = Sum[(1+x)^j, {j,1,n}]; g[n_] := Sum[(1+x)^j, {j,1,n}] When I try to evaluate the code above I get: ...
3
votes
0answers
61 views

Why is the evaluation of f different using rules and using arguments to it as a function? [closed]

I will provide all the code I used at the end of the question. I was trying to evaluate a function f with the following signature (which I'll give the details at ...
4
votes
2answers
233 views

Generate the Fibonacci sequence with Accumulate

Is there a way to generate the Fibonacci sequence with the Accumulate function?
1
vote
2answers
115 views

ToExpression and Fortran notation

ToExpression["9.0E-03"] interprets the string as 9*e - 3 instead of what I am expecting: ...
4
votes
2answers
136 views

DeleteMissing issues [duplicate]

Bug introduced in 10.0.0 and fixed in 10.1.0. Has anyone had problems with the DeleteMissing function in Mathematica 10.0.2? I find that it rarely works. Most of ...
0
votes
1answer
184 views

Understanding output of multivariable integration

I'm new to Mathematica and I'm trying to integrate this function: ...
2
votes
1answer
85 views

creating a stacked function that returns the multi varibles

I'm a beginner in Mathematica with little programming background but I'm determined to learn this. I'm trying to make a function that calculates two variables r2 ...
-2
votes
1answer
79 views

Why is my function returning 0 when when I try to give it arguments by replacement? [closed]

I tried running a function f with rules and calling it directly with arguments specified directly but the one with rules returns zero while the one with direct ...
10
votes
4answers
1k views

How to find the domain and range of an implicit function?

For example, we have this curve: $$x^2 + y^2 = 1$$ Is there a function in Mathematica for finding out that the ranges for $x$ and $y$ are both $[-1, 1]$? What about implicit functions of more than ...
4
votes
3answers
530 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 ...
8
votes
4answers
253 views

Is it possible to find generating functions of infinite sequences with Mathematica?

I'm trying to find the generating function of a sequence as $(0,1,0,1,0,1,\dots)$ but reading Mathematica's help on FindGeneratingFunction[] seems to tell me that ...
13
votes
2answers
5k views

Pass function or formula as function parameter

I can write either Integrate[x^2, {x,0,3}] or f[x_] = x^2 Integrate[f[x],{x,0,3}] and get the same computation. Suppose I ...
2
votes
2answers
74 views

Replace All using a list

I have a more complicated case however a basic example is; ...
1
vote
0answers
77 views

Input List of Images into a cloud deployed API function

I'm new to APIFunction and CloudDeploy, but essentially, here's my situation: I have a function (let's call it ...
3
votes
1answer
127 views

Derivative of conjugate multivariate function

I have a problem with Mathematica, taking the derivative of the conjugate of some function. I know that a similar question has been posed before here, but the solution did not work for multivariate ...
8
votes
3answers
206 views

Adding colors to graphic objects made with the new function AnglePath

The MMA 10.2 help gives many examples of AnglePath lines of code but all of them are of the same color and I am quite at a loss to devise a method to add colors ...
2
votes
1answer
182 views
8
votes
3answers
382 views

How to build a matrix from a set of vectors and other matrices using ArrayFlatten

I want to build a 6 by 3 matrix, from the following: one vector is 3 by 1, then a matrix, which is 3 by 2. These will go to the top 3 rows. Now the bottom 3 rows, I'll have 3 vectors each is 3 by 1. ...
0
votes
2answers
110 views

How does one define a function that takes vectors as arguments but also derivatives?

Summary: tldr; I just want to implement a version of the following mathematics function: $$ f(a) = c_1 e^{-(a - t_1)^2} + c_2 e^{-(a - t_2)^2} + c_3 e^{-(a - t_3)^2}$$ in mathematica, and be able ...
27
votes
2answers
599 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 ...