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

learn more… | top users | synonyms

1
vote
0answers
27 views
0
votes
2answers
55 views

Replace variables and redefine a function

I would like to redefine a function f(x)=1+2x^2 to a new function g(y)=1+2y by using the replacement ...
6
votes
4answers
97 views

Minimizing a function with a constant $l > 0$

I'm VERY new to Mathematica and would like some help with minimizing a function. $$f(x) = \frac{1}{2} \sqrt{\frac{\left(l^4+x^4\right)^2}{l^4 x^2}}$$ I want to find which $x-value$ (probably ...
6
votes
3answers
152 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 ...
1
vote
2answers
102 views

Josephus problem

See the Josephus Problem. My code takes in two numbers; one is the number of participants, and the other is supposed to be the number of players skipped between executions. ...
0
votes
0answers
75 views

Froze Mathematica and now it's buggy [on hold]

Today I was trying to generate some fractals, and I had the bright idea to generate an over 10000px by 10000px image. When I went to save it, mathematica froze up and my computer told me I was running ...
0
votes
0answers
49 views

Need to utilize FindFit with specified x variable values [on hold]

I have a function that I need to fit multiple (5) input values for, but I only have the function defined for 12 specific variable x values due to the need to ...
0
votes
0answers
35 views

Derivation: How do I derivate this [migrated]

How do I deveriate the following expression? The problem I have is the n in d^n. This expression is part of a bigger task of mine : Show via complete induktion that is true for all n from ...
1
vote
2answers
54 views

Incomplete Integration in Area

Area[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - p^2}] is able to perform only the integral over r, leaving the integral ...
0
votes
0answers
52 views

Function that adds up every element in an array [on hold]

I'm trying to write a function that adds up every element in an array up to a specific index. I've tried the following: ...
0
votes
1answer
53 views

How to fill a Marshal buffer with whitespace using NETLink

Further to Todd Gayley's answer on string handling in a DLL function, I have the following code: ...
0
votes
0answers
36 views

Plot function failure, and understanding how mathematica selects recursion points for correction

I think it is best to start out by directing everyone to this link. The discussion concerns why the Plot function fails to accurately generate a simple sine wave for given parameters. The answer given ...
0
votes
1answer
39 views

Aborting from a Dialog box

I'm trying to abort a While cycle, with a dialog box. I've tried the following: ...
11
votes
2answers
776 views

Growth of functions

Does somebody know if Mathematica can be used to calculate the growth of functions, that is in Big O, Theta, and Omega and find proper $n_{0}$ and $c_{1}$, $c_{2}$ respectively?
3
votes
1answer
134 views

Function that returns the second argument of Reap

I'm trying to create a function that returns only the second argument of Reap. Here's my naive guess of how it would go : Reap2[x_]:= Flatten[Reap[x][[2]],1] ...
4
votes
0answers
54 views

Can one generate the default output of Hash[expr] (from Mathematica <= 9) in Mathematica 10

Mathematica 10 silently changed the behavior of Hash when the algorithm is not specified explicitly using an option. Is there any way (such as an undocumented ...
5
votes
0answers
74 views

More Ticks::ticks errors in AbsoluteOptions in v10

Bug introduced in 10.0.0 While the specific bug affecting Plot described in AbsoluteOptions prints error messages in V10 has been fixed in 10.0.2 there remain ...
1
vote
1answer
74 views

Manipulate - Evaluating Value of Function

I would like to visualize the properties of a threshold, which is a value of a function. Unfortunately, the value is expressed as scientific value (an approximation with 3-5 decimals would be fine) ...
1
vote
3answers
97 views

Can I find constants in a function?

Let's say, I have a function with a constant, e.g. $y(x)=x+c$, and a condition $y(0) = 5$. I want to type in something like Solve[{y[x]=x+c, y[0] =5}, {c}] and get ...
14
votes
2answers
227 views

A bug in Commonest in version 10

Bug introduced in 10.0.0 and fixed in 10.0.2 m_goldberg demonstrated that in Mathematica 10 Commonest does not behave as the documentation indicates that it ...
0
votes
1answer
47 views

About choosing the specific number for a function

If I have many numbers in here {{A,B},{C,D},{E,F}.....} And I want choose the B,D,F,....(the second number) to run a function y=f(x), where x=B,D,F.... Then I need to check if y=f(B) is equal to A or ...
-1
votes
0answers
36 views

Watching recursion

I enter: Clear[f]; f[n_] = n f[n - 1]; f[1] And get the response: $RecursionLimit::reclim: Recursion depth of 1024 exceeded. >> Now, I think what happens is ...
0
votes
3answers
72 views

choose any number e that is relatively prime to n

I try to write a command that means choose any number e that is relatively prime to n, like e^n [Congruent] 1 (mod n), but it didn't give me a value of e. e^n [Congruent] 1 (mod n)
2
votes
1answer
70 views

FinancialDerivative function call without parameter fails in Mathematica 10

fixed in 10.0.2 When I type FinancialDerivative[] in Mathematica 10. There is error listed as follows. Anybody know how to solve it? Thanks.
4
votes
2answers
97 views

Difference between Evaluation>>Quit Kernel and Quit[]

What is the difference between Evaluation >> QuitKernel and Quit[]? Both seem to quit the kernel (and clearing all ...
4
votes
3answers
136 views

What is shorthand way of Reap list that may be empty because of zero Sow

Sometimes because of conditionals, you cannot guarantee that Sow will be called at least once. Reap[Sow[1]][[2,1]] results in ...
0
votes
0answers
71 views

How to conveniently stop a programme without aborting the computation

I have a programme that will have to run for a few days. However, I would like the user to have the option of stopping the computation of the code, without aborting it, when he desires, without ...
0
votes
0answers
40 views

Regarding Cycles and Lists of Functions

So, I'm trying to determine the Normal Matrix of a Least Squares Aproximation; I have a basis constituted by 8 functions f1,f2...f8; I have 9 points which constitute Datax = {x1,x2...x9} Now, I ...
0
votes
2answers
57 views

Binding trigonometric terms

I have many terms like A = Cos[Pi/18 + 2 x] + Cos[Pi/18 - 2 x] and I want to convert A to ...
1
vote
3answers
59 views

Defining a function using a preceding expression

How can I automatically define a function inside my Mathematica code using a result (expression) that preceded the point of definition. For example: ...
1
vote
1answer
99 views

Quantize a real-valued function?

I'm wondering if there's a built-in way in Mathematica to take a function whose output values are continuous, and quantize it to produce a step function. For example, I have the function ...
10
votes
2answers
162 views

How do I override options with my own defaults?

I'm calling a function f from within a function g and would like to pass any valid options for ...
14
votes
2answers
211 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: ...
1
vote
0answers
36 views

How to package a function for export?

I often post code for functions on Stack-Exchange, and then later find that they are unexecutable - that people can't use them because I mistakenly omitted some private functions or values that are ...
0
votes
1answer
48 views

Defining a function with algebraic parameters

I am trying to define and use a function to represent the eigenstates of a Quantum Harmonic Oscillator, which have the general form: $$\psi_{n}(x) = \frac{1}{\sqrt{2^{n} n!}}\left(\frac{m \omega}{2 ...
2
votes
2answers
56 views

Define function over expression

Suppose I have the following expression system = x + y + z And I would like to define a function that contains this function, without explicitly typing the right ...
8
votes
1answer
129 views

How to sort the functions in a Package?

Once a Package like abc` has been installed, we can use "?abc`*" to scan all the functions defined in this Package. Now I ...
0
votes
3answers
71 views

Defining a function which displays odd numbers? [closed]

Define a function that takes as input an integer n and returns as output the product of the first n odd numbers., i.e., 1 · 3 · 5 · · · 2n − 1. Evaluate your function at 1, 2, 3 and make sure you get ...
6
votes
3answers
176 views

How to define a nested function like this?

For example, I want to calculate the limit of $\frac{1}{1+\frac{2}{1+\frac{3}{1+\ldots}}}$. So I want to define: $f(1)=1$ $f(2)=\frac{1}{1+2}$ $f(3)=\frac{1}{1+\frac{2}{1+3}}$ Then I calculate ...
0
votes
2answers
673 views

How to find volume of an egg [closed]

I am a first time user of mathematica. I've been trying to figure out how to find the volume of a) f(x)=(ax^3 + bx^2 + cx + d)sqrt(1-x^2). I have been scouring the internet for a solution on how to ...
15
votes
7answers
542 views

Enumerating tuples from a larger space such that all pairs of values are present at least once

I am trying to write a function that will accept a list of N lists and returns a list of N-tuples that represent all pairs of values from the original N lists at least once. To illustrate with an ...
3
votes
0answers
55 views

Lists for built-in functions that can work without brackets

I just noticed that Exit and Quit can work without brackets i.e. a single Exit or ...
1
vote
1answer
63 views

FinancialData Input

What does the function FinancialData require as input for natural gas: http://finance.yahoo.com/q?s=NGG15.NYM Is it easier to export the natural gas data to ...
11
votes
4answers
515 views

Generating Random Real numbers with certain numbers not included

I'm writing a program that i need 1000 real number between -3 and 6. the code that I used for generating and saving them was l = RandomReal[{-3, 6}, 1000] But I ...
0
votes
0answers
38 views

RegionPlot fails when given function with internally redefined variables

I've just upgraded to v10, and have noticed that some of my trusty old notebooks which used RegionPlot now fail to run. I've boiled down the problem I'm having to ...
0
votes
0answers
31 views

Improving RationalInterpolation Result

The following code produces a {4,4} rational interpolation approximation accurate to 10^-6 or better over the range ...
2
votes
1answer
236 views

How to make a function from body with variable number of arguments?

Suppose I have an UNKNOWN function, which generates formulas with given number of x[i]. ...
1
vote
1answer
43 views

Composition of Multivariable function

I am trying to compose functions of xleft, maybe like xleft[xleft[f]] or even higher order. And here is my function: ...
0
votes
1answer
74 views

Diffentiating a function f with respect to x [duplicate]

I have a tabe y={10,20,30,40...} and x={62,63,64,65...} y is a function f and this function needs to be interpolated. How do I defferentiate the function f with respect to x?
0
votes
1answer
40 views

Taking function output as shown, and processing it regardless of its history

I am making some symbolical calculations for my quantum chemistry class. I am supposed to build a wave function composed of multiple other functions, each of which is also composite of some lower ...