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

learn more… | top users | synonyms

5
votes
2answers
519 views

Evaluating an If condition to yield True/False

I would like to decide whether an option passed to my custom function has the value Automatic or something else. This is my attempt: ...
2
votes
1answer
1k views

Function output from DSolve

I want to get a function as output form DSolve. For Example : sol = DSolve[{Q''[t] + 40 Q'[t] + 625 Q[t] == 100*Cos[10*t], Q[0] == 0, Q'[0] == 0}, Q[t], t] I ...
18
votes
1answer
287 views

What does “EquationalLogic`FindCounterexample[]” do?

I found the undocumented EquationalLogic`FindCounterexample[] by browsing the lists of available symbols, but I have no clue about its purpose. The name is ...
7
votes
2answers
1k views

Finding all partitions of a set

I'm looking for straightforward way to find all the partitions of a set. IntegerPartitions seems to provide a useful start. But then things get a bit complicated. ...
13
votes
6answers
374 views

Comparing the last output of a nested function with all the previous ones

my main question is how I can compare the last output of a nested function with all the previous ones and stop iterating when I find a repeating value. (I have 2 other questions but I think they are ...
4
votes
3answers
2k views

Why won't Mathematica Integrate my function?

My code: ...
1
vote
2answers
196 views

Expectation over a list with nested-mapped expressions

I need expected values of a list where the random variable to take expectations over should be an input into expressions defined earlier. I suspect Set[] and SetDelayed[] tripped me. (Or Map and ...
3
votes
2answers
469 views

How can I assign a Fit result to a function?

I have this code ...
2
votes
3answers
235 views

How to Compute Aggregate Best and Worst Cases for a Large Number of Estimates?

I need to aggregate multiple estimations, but I haven't been able to find a built-in function in Mathematica that aggregates multiple probablity estimations (I am specially interested in estimations ...
17
votes
5answers
6k views

How to find the domain and range of a function with Mathematica?

I'm studying calculus and in some exercises I am asked to find the domain and range of a function. Does Mathematica have already a built-in function for this? I can imagine some ways of doing so, ...
0
votes
2answers
126 views

About minimizing calculations when using ComposeList

I have a lot of functions to use in a iterative way, and I need some of the calculation results. For example: ...
6
votes
5answers
259 views

How to nest my own “times” function to get powers

I have a "times" function. I'd like to create a power function using it. It should look like this for an 6th power: ...
3
votes
2answers
327 views

What is the command to find function invariant?

What is the command to find function invariant? http://demonstrations.wolfram.com/AFunctionInvariantUnderAGroupOfTransformations/ what is algorithm it use to calculate this? Edit there is a book ...
2
votes
2answers
147 views

Custom function not returning any output

I'm trying to write a custom function but it isn't returning any output. Here's my code so far: ...
7
votes
2answers
2k views

How to create a rectangle wave (duty cycle $\ne$ 50 %)?

I'm trying to use phase-shifted SquareWave[] functions to create a rectangle wave: ...
2
votes
2answers
437 views

decompose a number (less than 255) in a sum of powers of 2

Is there a built in function that would take a number and decompose it into a sum of powers of 2? The numbers will be non negative less than 256. For what it's worth I'm trying to understand a paper ...
5
votes
1answer
126 views

How to make the Show function work in this case?

I can't get this to work, the Show function shows only the first plot. Why this happens and how to solve it? Show[Plot[x^2, {x, 2, 10}], Plot[1 - x, {x, 1, -10}]] ...
2
votes
2answers
463 views

Conditions for Piecewise[ ] Command

I am trying to plot a function in which is piecewise defined. I found the Fourier coefficients of this, and my question is how to define even & ...
6
votes
1answer
517 views

Evaluate continued fraction

Mathematica has the ContinuedFraction[] function to give the continued fraction expansion of a rational (or approximation of a real) number. I'm interested in the ...
7
votes
2answers
194 views

Why does Solve and Sum give different answers when according to Table it is the same sequence?

I have been thinking about a piece of code today, but I don't understand why I get different outputs from two in my mind similar Mathematical sums. First I observe that the Table command for this: ...
2
votes
3answers
495 views

Output of plots from within Do[ ] Command

I am wondering why the following does not plot the way it's written and exactly how does the Do[] function operate? I think I could be using it incorrectly. ...
8
votes
1answer
782 views

(Non-Convex) Polygon Union and Intersection Functions [duplicate]

Possible Duplicate: Intersecting graphics Back in 2009 I posted a question in comp.soft-sys.math.mathematica looking for a function which generates the union of two (not necessarily convex) ...
2
votes
3answers
167 views

Using Nest inside NestList

I need results like this: {Cos[Cos[x]], Sin[Cos[Cos[x]]],Cos[Cos[Sin[Cos[Cos[x]]]]], Sin[Cos[Cos[Sin[Cos[Cos[x]]]]]], ... } I've tried to use ...
13
votes
3answers
288 views

How to keep some of the results of the NestList

I'm using some iterative arithmetics to calculate wave propagation with the help of NestList. I have to use a small step size for iteration to guarantee the accuracy, which lead to too much data (e.g, ...
10
votes
1answer
209 views

How to pass composite function list to SortBy?

In order to sort alphanumeric-as-string data of the form {"T3", "T14", "T1", "E2"}, so that "T14" comes after ...
2
votes
3answers
205 views

Ways to change an explicit function into a pure function

I'm trying to use FixedPoint to solve a transcendental equations, but the first argument of the FixedPoint should be a pure ...
5
votes
1answer
124 views

RankedMax and Max do not behave identically

I have spent three hours debugging some code and at the end I think I found a bug. Otherwise I cannot explain what I am seeing: When I want to use RankedMax on ...
1
vote
3answers
2k views

How to write values of function to file?

For example, say I wanted to plot Sin(x) like this: Plot[Sin[x],{x,0,2 Pi}] But instead of plotting to a graph, I want to now tabulate the values of Sin[x] to a ...
6
votes
4answers
300 views

Why does my function defined with constraints on patterns not work? [duplicate]

Possible Duplicate: Why doesn't PatternTest work with Composition? My function is something like this, ...
6
votes
5answers
294 views

Is it possible to insert arguments into functions when they're used like Function@ or //Function?

Is it possible to insert arguments into functions when they're used like Function@ or //Function? Sometimes I need to do this, but then I have to return to the standard function usage: Function[] ...
11
votes
2answers
929 views

Converting ConditionalExpression to Piecewise

I have Solve[] return a list like ...
7
votes
0answers
181 views

What Method options does FindInstance accept?

While answering Trouble getting FindInstance to return multiple results for certain constraints it became clear that for this problem FindInstance would be better ...
-3
votes
1answer
694 views

How to find the maximum value and the argument of a function of three variables y dividing into grids?

I am dealing with a non-linear function of three variables, namely R0k, R1 and alpha. To find its maximum value, I divided the three variables into grids and maximized the function by plotting the ...
8
votes
2answers
686 views

What is the Mathematica equivalent for the Excel function tinv()?

TINV() returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom. For example ...
12
votes
3answers
507 views

How to make the suggestion box appear?

When you type a function in Matlab, quickly a suggestion box comes up showing functions similar to the one you're typing. I thought that Mathematica didn't have this but one day, I typed half of a ...
6
votes
2answers
266 views

How to choose variables from a list for a function and then use the solution in a subsequent function?

I am trying to calculate heating degree days and cooling degree days and output that information to a table. I am using mathematica's curated data to do this. In text this is what I would like to ...
9
votes
1answer
312 views

Defining Tags in Reap

I am trying to use Sow/Reap to replace Append in my code. The problem is that I need to ...
5
votes
1answer
712 views

Nesting multiple functions of multiple variables

I was wondering how one would go about nesting multiple functions of, say, two variables. The problem comes from trying to implement the Chirikov standard map without using "for" cycles. I found a ...
8
votes
1answer
701 views

How can you use and convert Gauss-Krüger-Coordinates in Mathematica?

I am given geographic data in the form of Gauss-Krüger-Coordinates and would like to calculate distances with them and convert them to longitude/latitude coordinates in another system for plotting ...
7
votes
1answer
345 views

LogLikelihood function from the Time Series package is apparently missing

The Time Series package for Mathematica comes with a function called LogLikelihood. It is discussed and used extensively in the documentation (pdf). So does ...
3
votes
5answers
526 views

How to use summation to get the value of a binary number?

How to use summation to get the value of a binary number? I want to do this: $(x_{n}x_{n-1}...x_{0})=\sum_{i=0}^{n}x_{i}\cdot b^{i} $ But it seems that I can only do something like this: ...
21
votes
2answers
1k views

Implementing continuous phase/Arg function

In MATLAB there's a function called phase that is just like our Listable friend Arg, but ...
-1
votes
1answer
399 views

inverse function not working — but providing values for some arguments, a symbol otherwise?

Could you help me with what Mathematica is doing here, in the last lines? (The rest is here for context.) I removed the output to let you simply run this. Thanks. ...
5
votes
1answer
230 views

Can we know the background code associated with basic mathematica functions

I wanted to know how computers calculate basic functions like Sqrt so first I checked how humans do it I found that they use something called "Newton's method" that ...
9
votes
1answer
2k views

Using RegionFunction on multiple plots

I realize that the Plot function can plot multiple functions of x at the same time, using { }. I also know that the ...
21
votes
3answers
1k views

How to load a package without naming conflicts?

This question applies to any package, but I encountered this problem while working with graphs. There are symbols in the Combinatorica package (such as ...
10
votes
4answers
996 views

How do I plot Thomae's function in Mathematica?

I wanted to plot this function $$f(x) =\begin{cases} 1 & \text{if } x= 0 \\ \tfrac1{q} & \text{if } x = \tfrac{p}{q}\\ 0 & \text{if } x \in \mathbb{R}-\mathbb{Q} ...
13
votes
3answers
471 views

Is it possible to get the order of inputs when “overloading” an orderless function?

When working with symbolic matrix operations or other objects which don't have commutative multiplication, it would be nice to not have to constantly switch out times for ...
10
votes
2answers
103 views

Functions in a different context are replaced with infix forms of their namesake in System`

So, in an attempt to help out Fabian with his question, I did what I often do, and created a new symbol in the Pillsy` package that I could play with. Since it was ...
21
votes
3answers
450 views

Is there a bug in Pick?

I wanted to use the Pick function with a condition. But there seems to be an issue here. Take a look at this: ...