Consider the following 2 by 2 array:
x = {{"a b c", "1,2,3"}, {"i \"comma-heart\" you", "i \",heart\" u, too"}}
If we Export that to CSV and then Import it again we don't get the same thing back:
Import[Export["tmp.csv", d]]
Looking at tmp.csv it's clear that the Export didn't work, since the quotes are not escaped properly.
Accor...
I have been trying to put together something that allows me to extract points from a ListPlot in order to use them in further computations. My current approach is to select points with a Locator[]. This works fine for displaying points, but I cannot figure out how to extract numerical values from a construct with head Dynamic[]. Below...
How do you put additional information into a Mathematica package file, like
parameter specification
doctests/example usage?
Up to now, I only found the ::usage string and some information on how to write documentation notebooks. I am looking for an option to generate these documentation notebooks from introspecting package files.
...
Why does the following code
Graphics[Raster[{{Hue[1], Hue[1/3]}, {Hue[2/3], Hue[1/6]}}]]
not produce any output? In Mathematica < 6 RasterArray was able to handle this and produced the same output as
Graphics[Raster[{{{1, 0, 0}, {0, 1, 0}}, {{0, 0, 1}, {1, 1, 0}}}]]
...
Mathematica notebooks are, of course, plaintext files -- it seems reasonable to expect that they should play nice with a version-control system (git in my case, although I doubt the specific system matters). But the fact is that any .nb file is full of cache information, timestamps, and other assorted metadata. Scads of it.
Which mean...
How do you generate a 3x3x3 lattice in Mathematica? Is it possible to color some of the lattice points? It seems that it is possible but I cannot get it to work so far
http://reference.wolfram.com/mathematica/ref/LatticeData.html
What I mean by 3x3x3 is something like figure (c) on the right:http://physics.ucsd.edu/was-sdphul/labs/2dl/...
Possible Duplicate:
What are some good websites for programming puzzles?
Maybe it is not very thematic question in here, but I guess it will be interesting not only to me. I hope.
So, I just want to get some cool tasks to do using programming languages or just pen and sheet of paper. I guess it can lead to improving my abilit...
Any idea how I can overlay the following two functions to compare them?
ln[1]:= p1 = Plot[(E^((Pi/6)^(1/3)/x) (Pi/6)^(2/3))/((-1 + E^((Pi/6)^(1/3)/x))^2 x^2), {x, -2.2, 2.2}]
ln[2]:= p2 = Plot[(E^((Pi/6)^(1/3)/t) (Pi/6)^(2/3))/((-1 +
E^((Pi/6)^(1/3)/t))^2 t^2), {t, 0, 2.0}]
When I try Show[p1,p2] it doesn't work
...
If it would be 6^x = 1 or 6^x = 6 or 6^x = 36 it would be extremely easy, but how to solve this equation:
6^x = 5
I don't need an answer, I want to find out how to solve equations like this one, I need solution.
Thanks.
...
In Mathematica, how do you plot a horizontal line at a given number? How do you plot a vertical line at a given number?
...
How do I remove the numbers on the x-axis only not the y-axis?
Is it possible to shift the y-axis without shifting the functions? What I mean is, instead of having the y-axis at x = 0, could I have it at x = -5?
...
In principle, what I want to use the following to generate a named pattern for later use:
In[1]:= Replace[var["x"],var[name_]:>Pattern[Apply[Symbol,name],_]]
I expected to see this result. A named pattern which I can use in subsequent rules:
Out[1]= x_
But instead, I got:
Out[1]= Pattern[Symbol @@ x,_]
The documentation says tha...
Hi all, I'm currently doing some normalization along the lines of:
J = Integrate[Psi[x, 0]^2, {x, 0, a}]
sol = Solve[J == 1, A]
A /. sol
For this type of normalization, the negative square root is extraneous. My results are:
In[49]:= J = Integrate[Psi[x, 0]^2, {x, 0, a}]
Out[49]= 2 A^2
In[68]:= sol = Solve[J == 1, A]
Out[68]= {{A -...
doesn't show specified graph in Mathematica Graph Theory package 'Combinatorica'.
...
I'm sure this is an incredibly simple question but I've recently started using Mathematica so it's all new to me. How do you scale the y axis? I try the following but it won't compile.
Plot[y = {Exp[-(x^2+3x+2)]}, {x, 0, 5}, {y, 0, 1}]
...
It seems that Mathematica's handling of principal value integrals fails on some corner cases. Consider these two expressions (which should give the same result):
Integrate[UnitBox[x]/(x0 - x), {x, -Infinity, Infinity},
PrincipalValue -> True, Assumptions -> {x0 > 0}] /. x0 -> 1 // Simplify
Integrate[UnitBox[x]/(x0 - x) /. x0 -> 1, {x,...
Is there a Mathematica function like inject in Ruby? For example, if I want the product of the elements in a list, in Ruby I can write:
list.inject(1) { |prod,el| prod * el }
I found I can just use Product in Mathematica:
Apply[Product, list]
However, this isn't general enough for me (like, if I don't just want the product or sum o...
I have a large set of parameters P which take several distinct sets of values V_i and want to use ActionMenu[] to make assigning P=V_i easy, like so:
ActionMenu["Label", {"name_1" :> (P = V_1;),..}]
Now the problem is that the set of V_i's is large and not static, so instead of coding a long list {"opt_1" :> (P = V_1;),..} over and ov...
Sampling uniformly at random from an n-dimensional unit simplex is the fancy way to say that you want n random numbers such that
they are all non-negative,
they sum to one, and
every possible vector of n non-negative numbers that sum to one are equally likely.
In the n=2 case you want to sample uniformly from the segment of the line ...
This is strange:
DateList@AbsoluteTime[596523]
returns
{2078, 7, 2, 2, 42, 9.7849}
But
DateList@AbsoluteTime[596524]
returns
{1942, 5, 26, 20, 28, 39.5596}
The question: What's going on?
Note that AbsoluteTime with a numeric argument is undocumented.
(I think I now know what it's doing but figured this is useful to have as a...