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

learn more… | top users | synonyms

1
vote
1answer
44 views

Newton's Method Glitch

I wonder if you can help me with my program - it involves using Newton's Method but my main issue is getting a defined function to return a given value. Essentially, I want to get my function ...
-3
votes
0answers
36 views

how to write a fortran subroutine in Mathematica and then how to call it in main body of program

I want to convert the same subroutine in Mathematica and then want to call it in main body. Please guide
0
votes
0answers
46 views

Restrict range of Functions

I have a function f[x,y,...,z] and I want to restrict its range to positive numbers only, f>0. f[x,y,...,z] is multivalued for some x,y,...,z and I cannot plot it for these values. How can I restrict ...
0
votes
1answer
55 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. ...
0
votes
0answers
49 views

Invariant curves of complex functions [on hold]

How to draw automatically the invariant curves of a complex function in the complex plane? And on the Riemann sphere?
7
votes
1answer
130 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., ...
2
votes
0answers
62 views

Optimization of recursive functions by using the //. operator

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) : ...
13
votes
1answer
345 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 ...
1
vote
1answer
78 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 ...
-2
votes
0answers
39 views

Define function of two variable like a vector [closed]

I have very repetitive exercises to do and I need to control very fast the result. In order to do this, I need to define some different functions ... First of all, I need to define this ...
2
votes
1answer
54 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
215 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
169 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
65 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
77 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 ...
0
votes
1answer
61 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: ...
19
votes
1answer
195 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: ...
3
votes
0answers
54 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 ...
2
votes
1answer
77 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 ...
0
votes
0answers
35 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 ...
2
votes
2answers
71 views

Replace All using a list

I have a more complicated case however a basic example is; ...
4
votes
2answers
207 views

Generate the Fibonacci sequence with Accumulate

Is there a way to generate the Fibonacci sequence with the Accumulate function?
-2
votes
1answer
74 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 ...
2
votes
1answer
44 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 ...
2
votes
1answer
153 views

Fitting one set of data with two function

I have a set of data (42 points): ...
7
votes
3answers
187 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 ...
0
votes
2answers
69 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 ...
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
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 ...
2
votes
1answer
126 views

An error disappears?

I needed to define a table of functions. And I did it like this: ...
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 ...
-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: ...
3
votes
3answers
188 views
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. ...
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, ...
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
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 : ...
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: ...
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: ...
0
votes
2answers
51 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
56 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
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

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
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. ...
14
votes
0answers
149 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
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, ...
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 ...