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

learn more… | top users | synonyms

12
votes
0answers
145 views

Default behaviour of Hash[expr] and hashing in different versions of Mathematica

In different versions of Mathematica, Wolfram silently changed the behaviour of Hash when the algorithm is not specified explicitly ...
10
votes
3answers
482 views

Why does Hash return different values in Version 7?

This function does not work correctly for me. The generated Gravatars do not match the ones actually produced by using the corresponding address. The problem was traced to differing output from the ...
3
votes
2answers
35 views

understanding a mathematica equation

I have found the equation below written with Mathematica, I looked at the Mathematica online guide but it is still difficult to understand the equation. Can someone write this (or part of it) in ...
-1
votes
0answers
30 views

Swing of the pendulum - question update

I would like to visualize a swing of the pendulum. I want to write a function springmass[z, nzigzag], which will draw the spring (line) and the swinging weight ...
6
votes
4answers
2k views

Replacing functions

Given an expression expresion in terms of a function f and given another function g, how ...
1
vote
2answers
109 views

Expressions containing globally undefined symbols inside a function where they are defined

Consider the following code. f[a_,b_]:=x; Clear[a,b]; x=a+b; f[1,2] It returns a+b. However, from a certain viewpoint, one ...
-3
votes
0answers
21 views

physics - swing of the pendulum [duplicate]

I should visualize a swing of the pendulum. I should write a function springmass[z, nzigzag], which visualize the spring (line) and the swinging weight (rectangle) ...
1
vote
1answer
43 views

How to reduce trigonometric expressions under special conditions

For the following problems I used "FullSimplify" and "TrigReduce" but I manage to reduce more ...
2
votes
1answer
93 views

Missing zero in the CoefficientList

The following list has a length only 10 (not 11) CoefficientList[Series[ArcTan[x]/(1-x^2),{x,0,10}],x] {0, 1, 0, 2/3, 0, 13/15, 0, 76/105, 0, 263/315} It should ...
6
votes
5answers
7k views

Calling Correct Function for Plotting DiracDelta

I am wondering what is the correct function in Mathematica to plot the true impulse function, better known as the DiracDelta[] function. When using this inside of a ...
5
votes
3answers
95 views

Encapsulated plot function misbehaves

To insure a collection of plots has identical appearance, the plot command is encapsulated in a function. The results are undesirable. The fiducial plot is ...
3
votes
5answers
169 views

Converting multi variable expression into a function

So I have this rather complicated looking expression ...
1
vote
1answer
88 views

Defining Solutions to FindRoot a functions of parameters-Part II

Here's a similar question as the the preceding question with the same title, but this time with vectors, which I need to use. I followed the suggestion in the answer the the previous question, but it ...
-2
votes
0answers
17 views

How many workers each company have? [on hold]

If total there are 90 workers between 2 companies and one company have 16 more workers then the other. How many each company have?
9
votes
5answers
3k views

How to plot periodic function's graphic?

How to plot periodic function's graphic? For example, $f(t) = t$ when $-5<t<5$ and $f(t+10) = f(t)$. ...
14
votes
1answer
188 views

Major slowdown when using a ColorFunction with more than one named scheme

Problem remains in 10.1 Earlier Kuba noted a major slowdown with code Simon Woods posted. Here is a simplified example. First a color function using two different named gradient schemes: ...
3
votes
2answers
419 views

Using Functions as Arguments to Function

I am trying to make a function like Norm but defined like so: MyNorm[{x_,y_,z_}]=Sqrt[x^2+y^2+z^2]. Mathematica assumes that x, ...
0
votes
0answers
50 views

Which method to use for finding maximum without actually computing optimization function explicitly?

I am new to Mathematica and I am currently working on an optimization problem. The optimization function that I have easy to calculate for some assignment of variable but it is very difficult to ...
3
votes
1answer
156 views

I want to construct a function than the output is “Sequence”

For example if the input is x and x<10 the output is Sequence[x,0],if x>10 the output is Sequence[0,x] but obviously ...
17
votes
2answers
456 views

Using several anonymous functions mixed together

This works: list // BarChart[#[[2]], ChartLabels -> DateString @@@ #[[1]], ChartStyle -> "Pastel"] & This doesn't: ...
2
votes
1answer
87 views

How can I run a summation numerous times?

I have been working on code for finding the Allan plot of generated white noise, however, I cannot figure out a way to automate it for a different range of numbers. My code is as follows: ...
2
votes
0answers
25 views

Marginal distribution with weight

Given a multi-variate distribution $P(\mathbf{x},\mathbf{y})$, I would like to obtain the marginal distribution $$P_m(\mathbf{x})=\sum\int_{\mathbf{y}}P(\mathbf{x},\mathbf{y})W(\mathbf{y})$$ In my ...
13
votes
1answer
272 views

What are SparseArray Properties? How and when should they be used?

A strange undocumented form of SparseArray is increasingly used in answers on this site: ...
2
votes
3answers
708 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. ...
4
votes
1answer
71 views

How to create fast functions based on units?

Using units is a good means for rapidly developing code, since it provides some error control. Hovewer, using Mathamatica functions containing units appears to be copmutationally inefficient. ...
0
votes
0answers
18 views

Need help with a hyperbola/parabola equation solving for an assignment [migrated]

Hi so i was given my Math C assignment today and the moment i looked at question 1 i knew i had no idea what to do. This is the graph i was given (http://imgur.com/nRXOlJy). I was asked to provide an ...
0
votes
0answers
27 views

How to refine the approximate solution of an implicit function? [closed]

I have an equation of the form exp(A(C-x))-1-exp(x-B(C-x)^(2/3))=0 Here A,B and C are constants, x is the unknown, I want to find, but approximate value of x is known. so, the problem is how to get ...
0
votes
0answers
40 views

Polynomial interpolation using Neville's Algorithm

Is there an interpolating function in Mathematica which uses Neville's algorithm? I have written a C++ program to do interpolation using Neville's algorithm and I am getting a small difference ...
9
votes
0answers
158 views

More Ticks::ticks errors in AbsoluteOptions in v10

Bug introduced in 7.0 or earlier and persisting through 10.1 or later While the specific bug affecting Plot described in AbsoluteOptions prints error messages in ...
10
votes
0answers
132 views

Is FullGraphics an abandoned function? Is there an alternative?

FullGraphics hasn't worked entirely for a long time and the situation appears to be getting worse instead of better. In Mathematica 10.0 and 10.1 a simple usage ...
0
votes
1answer
71 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 ...
0
votes
0answers
34 views

Attributes of statistics functions

Do statistics functions have some kind of attribute which ignore non-number (Indeterminate, ComplexInfinity, calculation "errors") elements of a list?
16
votes
2answers
1k views

Scan vs. Map vs. Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
8
votes
1answer
204 views

Prevent Export from overwriting files

Export["filepath1",Expression1] works for me, but if filepath1 already exists, it will be overwritten. I'd like ...
51
votes
4answers
3k views

Using a PatternTest versus a Condition for pattern matching

My last question to the site resulted in several answers that involve using pattern matching in Mathematica, a feature I wasn't very familiar with at the time. I am currently reading Mathematica ...
118
votes
7answers
5k views

What are the use cases for different scoping constructs?

Mathematica includes three functions that I know of which can be used to effectively (if not actually) define a variable and give it a value within a local scope: ...
32
votes
5answers
1k views

Why is there no PositionFunction in Mathematica?

Too often I have seen the programs of inexperienced users greatly slowed by using Position in an iterative fashion, when far faster would have been to compute a ...
19
votes
1answer
438 views

Shorter syntax for Fold and FoldList?

I find it tedious to write out the following: a = {1, 2, 3, 4}; Fold[f, First @ a, Rest @ a] f[f[f[1, 2], 3], 4] It ...
16
votes
1answer
226 views

In 10.1.0 BenchmarkPlot doesn't work?

In Mathematica 10.1.0 BenchmarkPlot from the GeneralUtilities package doesn't work; copying Taliesin Beynon's initial use of the function on this site: ...
2
votes
3answers
124 views

truncated square wave input

I'm investigating the response of some dynamic system on Mathematica and I want to generate a tailored square input like the one in the following picture: Does anyone know how to generate such input ...
2
votes
1answer
70 views

Computing large nested values

Is it possible to compute a value for n=10^9; Nest[# + Log[#] &, 2., n] for large n? $10^9$ seems to be the max for me - ...
0
votes
2answers
59 views

Continuity of function-example

I'd like to examine the continuity of the following function: f[x_] := Limit[(n^x - n^(-x) ) / (n^x + n^(-x) ), n -> Infinity] I know that this function isn't ...
0
votes
3answers
79 views

beginner's question: change a parameter while get variable answers [duplicate]

I'm new to Mathematica from R, since R is not quite good at dealing with the following problem. Say, i want to solve the function a x - 10 = 0. Each time I change the value of a, say, from 1 to 10 by ...
0
votes
0answers
47 views

Errors when changing variables

I have the following function : K[r_, h_] = -(D[h[r], {r, 2}] + D[h[r], r]/r + D[h[r], r]^3/r)/(2 (1 + D[h[r], r]^2)^(3/2)) In order to adimension it, I am ...
12
votes
0answers
162 views

Performance problems in new Sequence functions

The new-in-10.1 Sequence* family of functions should provide newly optimized methods for handling sequence problems. Happily in some cases they do! For example ...
1
vote
2answers
89 views

Get the sum with cases

I have the following list: list = {{1, 2}, {2}, {3, 4, 1}, {5, 4}, {3, 3}, {a, b, c}, {e, f}, {g}, {}, {Sin[a], Cos[b]}}; I should use ...
5
votes
1answer
71 views

Handy dates conversion

I feel like something very basic is missing me, $dateformat = {"Year", "Month", "Day", "Hour"}; date = DateString[$dateformat] DateString["Date"] ...