Community RSS Feed
http://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Mathematica sorted by activeThe Chaos Game - infinitygon and Markov-chains - part III
http://community.wolfram.com/groups/-/m/t/1047603
In case you missed the first two parts check them out before reading this post:
- [The Chaos Game - Sierpinski triangles and beyond - part I][1]
- [The Chaos Game - part II][2]
Today on the menu is to go from triangles, squares, pentagon, and hexagons all the way to a regular polygon with infinite vertices: the infinitygon, commonly known as a circle. So let's do the jumping again, but this time to a random point on a circle:
ClearAll[CreateSequence,CreateSequenceImage]
CreateSequence[steps_]:=RandomReal[{0,2Pi},steps]
CreateSequenceImage[m_,\[Alpha]_]:=Module[{seq,circlepoints,pts,plotdata,colors},
seq=CreateSequence[m];
seq=Transpose[{Cos[seq],Sin[seq]}];
pts=Rest@FoldList[(1-\[Alpha])#1+\[Alpha] #2&,seq];
Rasterize[Graphics[{FaceForm[],EdgeForm[Black],Circle[{0,0},1],PointSize[0.001],Point@pts,Text[NumberForm[\[Alpha],{\[Infinity],2}],{0,1.05}]},ImageSize->300,PlotRange->1.1],"Image",RasterSize->300]
]
here alpha is the step-factor, as before. Let's vary alpha from 0.1 to 0.9:
ImageAssemble[Partition[CreateSequenceImage[30000, #] & /@ Range[0.1, 0.9, 0.1], 3]]
![enter image description here][3]
For small alpha it just tends to go the center, and for large alpha we go towards the rim, while the center remains inaccessible.
Probability density function
----------------------------
Let's have a look at PDF of the radial position of the points to see how they are distributed for a range of alpha:
ClearAll[CreateSequence,CreateSequenceHistogram]
CreateSequence[steps_]:=RandomReal[{0,2Pi},steps]
CreateSequenceHistogram[m_,\[Alpha]_,\[Delta]_:0.01]:=Module[{seq,circlepoints,pts,plotdata,colors},
seq=CreateSequence[m];
seq=Transpose[{Cos[seq],Sin[seq]}];
pts=Rest@FoldList[(1-\[Alpha])#1+\[Alpha] #2&,seq];
Histogram[Norm/@pts,{0,1,\[Delta]},"PDF",Frame->True,PlotLabel->\[Alpha],ImageSize->300,PlotRange->{{0,1},{0,4.5}}]
]
Grid[Partition[CreateSequenceHistogram[10^6,#]&/@Range[0.1,0.8,0.1],UpTo[3]]]
![enter image description here][4]
Especially the cases around 0.7 look interesting because of its unexpected shape, let's make high-resolution PDF for that alpha:
CreateSequenceHistogram[10^7, 0.7, 0.001]
![enter image description here][5]
So we can calculate this more quickly? Well, let's first look at how a single jump works:
Clear[GetOverView,GetPlot\[Theta]r,GetCDFFunc,GetPDFFunc,r]
GetOverView[b_,\[Alpha]_]:=Graphics[{Circle[],Red,Point[{b,0}],Black,Circle[{(1-\[Alpha])b,0},\[Alpha]]}]
GetPlot\[Theta]r[b_,\[Alpha]_]:=Plot[Sqrt[\[Alpha]^2+(1-\[Alpha])^2 b^2+2\[Alpha] Cos[\[Theta]](1-\[Alpha])b],{\[Theta],0,2Pi},PlotRange->{0,1},AxesLabel->{"\[Theta]","r"},Ticks->{Range[0,2Pi,Pi/2]}]
GetCDFFunc[b_, \[Alpha]_] := \[Piecewise] {
{0, r < Abs[b (1 - \[Alpha]) - \[Alpha]]},
{1, r > b (1 - \[Alpha]) + \[Alpha]},
{((\[Pi] -
ArcCos[(b^2 - r^2 - 2 b^2 \[Alpha] + \[Alpha]^2 +
b^2 \[Alpha]^2)/(2 b (-\[Alpha] + \[Alpha]^2))])/\[Pi]), \!\(
TagBox["True",
"PiecewiseDefault",
AutoDelete->False,
DeletionWarning->True]\)}
}
GetPDFFunc[b_,\[Alpha]_]:=D[GetCDFFunc[b,\[Alpha]],r]
GetPDFFunc[b_, \[Alpha]_] := \[Piecewise] {
{0, r - Abs[b (1 - \[Alpha]) - \[Alpha]] <
0 || -b + r - \[Alpha] + b \[Alpha] > 0},
{-(r/(b \[Pi] (-\[Alpha] + \[Alpha]^2) Sqrt[
1 - (b^2 - r^2 - 2 b^2 \[Alpha] + \[Alpha]^2 +
b^2 \[Alpha]^2)^2/(
4 b^2 (-\[Alpha] + \[Alpha]^2)^2)])), \!\(
TagBox["True",
"PiecewiseDefault",
AutoDelete->False,
DeletionWarning->True]\)}
}
GetPlotCDF[b_,\[Alpha]_]:=Plot[GetCDFFunc[b,\[Alpha]],{r,0,1},AxesLabel->{"r","CDF(r)"},PlotRangePadding->None]
GetPlotPDF[b_,\[Alpha]_]:=Plot[GetPDFFunc[b,\[Alpha]],{r,0,1},AxesLabel->{"r","PDF(r)"},PlotRangePadding->None]
Manipulate[GraphicsGrid[Partition[{GetOverView[b,\[Alpha]],GetPlot\[Theta]r[b,\[Alpha]],GetPlotCDF[b,\[Alpha]],GetPlotPDF[b,\[Alpha]]},2],Spacings->Scaled[.5],ImageSize->600],{{b,0.78},0,1},{{\[Alpha],0.5},0,1}]
![enter image description here][6]
the red point shown above can jump to any position of the inner circle. Top right shows the radius (from the center) as a function of theta for that circle. Bottom left shows the CDF of the possible radial positions, and bottom right the PDF of the possible radial positions. For the shown example you can see it will end up somewhere with a radius between 0.2 and 0.9, and most likely at those edges as the PDF is very large there.
Starting from an initial flat PDF of equal probability as a function of radius we can iterate that PDF to get the next PDF if we 'jump those probabilities':
ClearAll[GetMatrix,DoPDFFind]
GetMatrix[binranges_,\[Alpha]_]:=Module[{midbins,func},
midbins=MovingAverage[binranges,2];
Transpose[Table[
func=GetCDFFunc[Subscript[midbins, [[i]]],\[Alpha]];
Differences[Table[func,{r,binranges}]]
,
{i,Length[midbins]}
]]
]
DoPDFFind[\[Alpha]_,bins_Integer,n_:25]:=Module[{binwidth,initprob,prob,binranges,tmp,mat,plotdata},
binwidth=1/bins;
initprob=1/bins;
prob=N[ConstantArray[initprob,bins]];
binranges=N[Range[0,1,binwidth]];
mat=Re[GetMatrix[binranges,\[Alpha]]];
tmp=bins Nest[mat.#&,prob,n];
plotdata={MovingAverage[binranges,2],tmp}\[Transpose];
plotdata=Mean/@Partition[plotdata,2];
ListLinePlot[plotdata,PlotRange->{{0,1},{0,All}},PlotStyle->Directive[Red,Thick]]
]
Now we check if the PDF matches:
\[Alpha]=0.7;
Show[{CreateSequenceHistogram[10^7,\[Alpha],0.001],DoPDFFind[\[Alpha],500]},ImageSize->500,AxesLabel->{"r","PDF(r)"},PlotLabel->Row[{"\[Alpha]=",\[Alpha]}],Frame->True]
![enter image description here][7]
We can actually see the convergence:
ClearAll[DoPDFFindAll]
DoPDFFindAll[\[Alpha]_,bins_Integer,n_:25]:=Module[{binwidth,initprob,prob,binranges,tmp,mat},
binwidth=1/bins;
initprob=1/bins;
prob=N[ConstantArray[initprob,bins]];
binranges=N[Range[0,1,binwidth]];
mat=GetMatrix[binranges,\[Alpha]];
mat=Re[mat];
tmp=bins NestList[mat.#&,prob,n];
tmp={MovingAverage[binranges,2],#}\[Transpose]&/@tmp;
tmp=(Mean/@Partition[#,2])&/@tmp;
ListLinePlot[tmp,PlotRange->{{0,1},{0,All}},Frame->True,PlotLegends->Automatic,ImageSize->600]
]
DoPDFFindAll[0.7,500,5]
![enter image description here][8]
As you can see, it quickly converges to its final form. What we've done here is called a Markov chain, and this entire procedure could've been simplified by using the **DiscreteMarkovProcess** function in the Wolfram Language:
bins=500;
binwidth=1/bins;
initprob=1/bins;
prob=N[ConstantArray[initprob,bins]];
binranges=N[Range[0,1,binwidth]];
mat=GetMatrix[binranges,0.7];
dmp=DiscreteMarkovProcess[prob,Transpose@mat];
sd=StationaryDistribution[dmp];
sdpdf=PDF[sd,x];
plotdata=Table[{x/bins,bins Chop[sdpdf]},{x,1,bins}];
ListPlot[plotdata,Joined->True,Frame->True,ImageSize->500,PlotRange->{0,4.5}]
giving the same result:
![enter image description here][9]
That is it for now...
[1]: http://community.wolfram.com/groups/-/m/t/1025180
[2]: http://community.wolfram.com/groups/-/m/t/1039030
[3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ChaosGame1.png&userId=73716
[4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ChaosGame2.png&userId=73716
[5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ChaosGame3.png&userId=73716
[6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ChaosGame4.png&userId=73716
[7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=10684ChaosGame5.png&userId=73716
[8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ChaosGame6.png&userId=73716
[9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ChaosGame8.png&userId=73716Sander Huisman2017-03-29T22:52:21ZDifferential equation
http://community.wolfram.com/groups/-/m/t/1047079
Hi, i have to solve this equation but i dont know how to use "WhenEvent" command:
P'[t]= r (1-P[t]/K) P[t] - H[t]
P[0]=P0
I have:
r = 1;
K = 10^6;
H0 = 4 x 10^5;
p1 = 5 x 10^5;
p2 = 8 x 10 ^ 5;
P0 = 3 x 10^5;
0 <= t <= 20
The question is: H[t] = 0 if 0 <=P[t] <= p2
But, when P[t]= p2, then H[t] = H0, until P[t]= p1, when (again) H[t] = 0
If P[t] = p2, again H[t] = H0 and so on
I know to use NDSolve to solve a differential equation, but I dont know how to use "WhenEvent"
ThanksJose Luis Lara2017-03-29T18:01:35ZGenerate all sequences of n integer that range from 1 to n
http://community.wolfram.com/groups/-/m/t/1047023
Hi everyone,
I am searching for a way to generate all sequences of *n* integers that range from 1 to *n*. In other words, for example with *n* = 2, something like
{{1,1},{1,2},{2,1},{2,2}}
Does anyone know an easy way to build such a function depending only on *n*?
Thanks!
ClémentClément Justin2017-03-29T15:59:10ZGet right PDF output from Slide Show using "Water" Stylesheet?
http://community.wolfram.com/groups/-/m/t/1046546
I am using the "Water" stylesheet for a slide show that has some problems when printing the slides as PDF, etc. When using e.g. ItemNumbered cells the item numbers get cropped at the left edge.
Does anybody knwo which style settings to adjust to keep the full cell visible?
To clarify the issue take the following minimal slide example (StyleSheet "Water")
![enter image description here][2]
Switching to Printout environment gives:
![enter image description here][3]
Note how the item numbers are cut off at the left page edge. How can I change that?
----------
This is also cross-posted here: http://mathematica.stackexchange.com/questions/141186
[1]: http://mathematica.stackexchange.com/questions/141186/modify-slide-show-printout-settings
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=working.png&userId=87900
[3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=printoutjpg.jpg&userId=87900Markus Roellig2017-03-29T08:22:12ZShare a notebook publicly on the Wolfram Cloud, then editing it?
http://community.wolfram.com/groups/-/m/t/1046163
I'm trying to get a good workflow for sharing my notebooks.
I noticed that if I "save to wolfram cloud", then "share publicly" it from Web, then edit it in Mathematica again, then sharing gets turned off.
My current work-around is to save a copy of file locally, then save to cloud, then share it, and do this every time I have changes. Is there a better workflow?Yaroslav Bulatov2017-03-28T18:39:43ZTextRecognize options and Tesseract page mode options.
http://community.wolfram.com/groups/-/m/t/125919
I saw that Mathematica uses Tesseract as OCR function (you can check in /Applications/Mathematica.app/SystemFiles/Converters/Tesseract/tessdata)
I recent discovery that Tesseract has some nice options that assumes some text orientations called page mode. You can see these options here [url=http://mathematica.stackexchange.com/questions/18683/applying-textrecognize-on-alpha-numerical-table/31851#31851]in this SE answer[/url].
Can I control it with some Mathematica undocumented options?
If not, it would be nice to have this connection in future Mathematica version.Rodrigo Murta2013-09-17T23:04:35ZAvoid error in Suggestions bar (Mathematica 11.1)?
http://community.wolfram.com/groups/-/m/t/1034002
I have just updated Mathematica to version 11.1 (Windows 10 Home 64-bit) and the suggestions bar is not working properly. I receive this error message when I use one of the options of one arrow of the suggestions bar:
![Error using the suggestions bar][1]
INTERNAL SELF-TEST ERROR: EventTracker|c|521
Click here to find out if this problem is known, and to help improve
the Wolfram System by reporting it to Wolfram Research.
The error happens after installing the software and running it, with the default configurations.
Does anyone know what is the problem?
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Errorsuggestionsbar.PNG&userId=410040
[2]: https://www.wolfram.com/support/error-report/?Version=11.1.0&SystemID=Windows-x86-64&LicenseID=L4968-1451&location=EventTracker-c-521Rodrigo Sambade Saá2017-03-17T23:52:17ZCombination tones and the nonlinearity of the ear
http://community.wolfram.com/groups/-/m/t/1042836
Some time ago I published a blog post about combination tones and the nonlinearity of the human ear.
* [Combination tones: Demonstrating the nonlinearity of the human ear](http://szhorvat.net/pelican/combination-tones.html)
Per request, I will show here how to play with this topic in Mathematica.
A combination tone (also called Tartini tone after the violinist Giuseppe Tartini who famously described them) is a phenomenon where playing two tones of different frequencies at the same time causes a third tone (or several others) to be heard as well. As you will see below, this is a physical effect: the combination tone appears due to nonlinear transmission in the middle ear.
## Preliminaries
Before starting, let's set up the `Play` function to output at higher than default quality:
SetOptions[Play, SampleDepth -> 16, SampleRate -> 22050]
You can go to a full 44100 Hz, but then `Play` will be slower. Using a lower sampling rate risks audible aliasing effects.
We will play the two tones on separate stereo channels (`Play[{left, right}, ...]`). This is so that they only mix in our ears, and not in your audio playback electronics. I want to convince you that the effect is due to the ear's nonlinearity, and not that of your speakers or amplifier. So please listen to the samples with loudspeakers (not headphones), so both of your ears can hear both channels at the same time.
Since this is a nonlinear effect, it will be audible only if the volume is high enough. Turn up the volume a bit, or better: lean closer to (or away from) your speakers to control the volume level near your ears.
I also advise you not to use the interface of `Audio` objects for stereo playback during these experiments. Unfortunately, Mathematica 11.0 and 11.1 have a bug (at least on OS X) where sounds are mixed down to mono before playback. This affects only playback, not processing. The interface presented by the older `Sound` objects doesn't have this problem.
## The experiment
Let's start by playing a 1000 Hz and a 1500 Hz tone together:
Play[{Sin[1000 2Pi t], Sin[1500 2Pi t]}, {t, 0, 3}]
If you listen carefully, you may be able to hear a lower pitch tone at $1500-1000 = 500 \;\mathrm{Hz}$. The effect is fairly subtle, and many people have trouble hearing this. It may be easier to hear if you compare it to an actual 500 Hz tone, `Play[Sin[500 2Pi t], {t, 0, 3}]`.
There is a less often used, but much better way to demonstrate the effect. Since the most prominent combination tone tends to be the difference of the two frequencies, $f_c = |f_1 - f_2|$, we can use a steady tone and a lower falling tone. Their difference will be increasing. It is much easier to notice that there is a third tone present when its pitch is clearly changing in another direction than that of the base tones we are actually playing.
How do we create a tone with a changing frequency? The phase of a wave, $\varphi(t)$, is the integral of its angular frequency, $\omega(t) = 2\pi f(t)$. To get a tone whose pitch falls by 100 Hz per second, starting at 1300 Hz, we need to use the following phase:
Integrate[1300 - 100 t, t]
(* 1300 t - 50 t^2 *)
So let's try it:
snd = Play[{Sin[1500 2 Pi t], Sin[(1300 t - 50 t^2) 2 Pi]}, {t, 0, 3}]
We play a steady and a falling tone But I can clearly hear a rising tone as well. If we play only one channel at a time, the rising tone is no longer audible. Try it: `AudioChannelSeparate[snd]`.
## The explanation
Where does the combination tone come from, and how is it related to nonlinear transmission? Let's think about what happens if we pass the sum of two sine waves of different frequencies through a non-linear amplifier, described by the function $a(u)$. (This is admittedly a much simplified model of what happens—a nonlinear oscillator would be more accurate. But it's simple and it explains the phenomenon.) The Taylor expansion of a non-linear $a(u)$ will also contain higher order terms:
$$a(u) = c_1 u + c_2 u^2 + c_3 u^3 + \cdots$$
The linear term, $u$, doesn't change the signal. What about the square term, $u^2$? Mathematica makes it easy to do the calculation:
(Sin[w1 t] + Sin[w2 t])^2 // TrigReduce
(* 1/2 (2 - Cos[2 t w1] - Cos[2 t w2] + 2 Cos[t w1 - t w2] - 2 Cos[t w1 + t w2]) *)
Notice that the sum (`w1+w2`) and the difference (`w1-w2`) of the frequencies appeared too (in addition to the harmonics `2 w1` and `2 w2` ). This explains why the most prominent combination tone we are hearing is the difference tone.
What about the third order term?
(Sin[w1] + Sin[w2])^3 // TrigReduce
(* 1/4 (9 Sin[w1] - Sin[3 w1] - 3 Sin[w1 - 2 w2] +
3 Sin[2 w1 - w2] + 9 Sin[w2] - Sin[3 w2] - 3 Sin[2 w1 + w2] -
3 Sin[w1 + 2 w2]) *)
Now we have `2 w1+w2`, `2 w1-w2`, `w1-2 w2` and `w1+2 w2`.
Generally, the $k$th order term will introduce $n \omega_1 + m \omega_2$ integer linear combinations, where $n,m \in \mathbb{Z}$ and $|n|,|m| < k$.
Where does the nonlinearity come from? We play the two sounds on different stereo channels (ideally on loudspeakers which are in contained in separate housings), to rule out any effects coming from the electronics. Transmission through the air is fairly linear, so that can be ruled out too. What remains is our ear.
The higher order a term, the less loud the corresponding combination tones are. However, human loudness perception logarithmic, so these do not necessarily sound so much quieter so as not to be audible. Can we hear the third order tones?
If I play the last example for a bit longer than in our original experiment,
Play[{Sin[1500 2 Pi t], Sin[(1300 t - 50 t^2) 2 Pi]}, {t, 0, 5}]
towards the end and of the samepl I hear a much more sharply falling tone as well. This happens to be the `2 w2-w1` third-order combination tone. We notice it towards the end only because due to our logarithmic perception of the pitch, it will appear to fall with an accelerating rate as it approaches zero. This makes it stand out.
This becomes clear from a `LogPlot` of the changing pitches:
a = 1300 - 100 t; (* falling pitch *)
b = 1500; (* steady pitch *)
sqc = RGBColor[0., 0.780007, 0.550005];
cuc = RGBColor[1., 0.659993, 0.069994];
tmax = 5;
pl = Legended[
Show[
LogPlot[{a, b} // Abs // Evaluate, {t, 0, tmax}, PlotStyle -> Directive[Thick, Black], GridLines -> Automatic],
LogPlot[{a + b, a - b, 2 a, 2 b} // Abs // Evaluate, {t, 0, tmax}, PlotStyle -> sqc],
LogPlot[{2 a - b, 2 b - a, 2 a + b, 2 b + a, 3 a, 3 b} // Abs // Evaluate, {t, 0, tmax}, PlotStyle -> cuc, PlotRange -> All],
PlotRange -> Log@{50, 6000}, Frame -> True, Axes -> False,
FrameLabel -> (Style[#, FontSize -> 14] &) /@ {"time (s)", "frequency (Hz)"}, AspectRatio -> 1/2, ImageSize -> 500,
BaseStyle -> {FontFamily -> "Open Sans"},
PlotRangePadding -> {Automatic, 0}
],
LineLegend[{Black, sqc, cuc}, {"base", "from \!\(\*FormBox[SuperscriptBox[\(x\), \(2\)],TraditionalForm]\)",
"from \!\(\*FormBox[SuperscriptBox[\(x\), \(3\)],TraditionalForm]\)"}]
]
![enter image description here][1]
----
We can also pass the sum of the two tones through a non-linear function of our own design, and look at the spectrogram to see all combination tones:
amp[u_] := Log[u + 1]
This "amplifier function" contains all higher order terms with coefficients that are comparable in magnitude:
amp[u] + O[u]^6
$$u-\frac{u^2}{2}+\frac{u^3}{3}-\frac{u^4}{4}+\frac{u^5}{5}+O\left(u^6\right)$$
The spectrogram can be plotted as follows:
Spectrogram[
Play[amp[0.25 (Sin[1500 2 Pi t] + Sin[(1300 t - 50 t^2) 2 Pi])], {t, 0, 6}],
PlotRange -> {All, {0, 5000}},
ColorFunction -> "Rainbow",
FrameLabel -> {"time", "frequency"}
]
![enter image description here][2]
----
I hope you enjoyed this post. You can read a bit more about the background of combination tones, and listen to an additional experiment [in the original blog post](http://szhorvat.net/pelican/combination-tones.html).
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=combi-tones.png&userId=38370
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Untitled-2.png&userId=38370Szabolcs Horvát2017-03-26T14:35:29ZSaving data directly in notebooks
http://community.wolfram.com/groups/-/m/t/1039591
Do you ever wish you could save data directly into a notebook instead of having to export it? I sometimes do things like
mydata = {1,2,3, ...};
just to be able to use this data next time I open the notebook. This could be data I pasted from the web, or something that just took several minutes to generate.
But saving it like this is inconvenient, and often takes up a lot of space.
Today I published a blog post about a better method that I have been using recently. I thought people here may be interested:
* [Save data directly in Mathematica notebooks](http://szhorvat.net/pelican/save-data-in-notebooks.html)
The idea is to use first `Compress` the data, then use `Interpretation` to create a compact display for it. Here's a small function that packages all of this up:
ClearAll[SaveToCell]
SaveToCell::usage =
"SaveToCell[variable] creates an input cell that reassigns the current value of variable.\n" <>
"SaveToCell[variables, display] shows 'display' on the right-hand-side of the assignment.";
SetAttributes[SaveToCell, HoldFirst]
SaveToCell[var_, name : Except[_?OptionQ] : "data", opt : OptionsPattern[]] :=
With[{data = Compress[var],
panel = ToBoxes@Tooltip[Panel[name, FrameMargins -> Small], DateString[]]},
CellPrint@Cell[
BoxData@RowBox[{
MakeBoxes[var],
"=",
InterpretationBox[panel, Uncompress[data]],
";"
}],
"Input",
(* prevent deletion by Cell > Delete All Output: *)
GeneratedCell -> False
(* CellLabel is special: last occrrence takes precedence, so it comes before opt: *)
CellLabel -> "(saved)",
opt,
CellLabelAutoDelete -> False
]
]
If you have your data in the variable `var`, simply run `SaveToCell[var]`, which will create an input cell that re-assign the value of `var`. It looks like this:
![enter image description here][1]
We can also customize the display:
var = Range[1000];
SaveToCell[var, Short[var]]
![enter image description here][2]
Hovering the display will show the date when the data was saved.
`SaveToCell` also takes arbitrary `Cell` options, and passes them down to the generated cell. Something strange I observed while writing this function is that with some options, such as `CellLabel`, [it is not the first but the last occurrence of the option that takes precedence][3]. Does anyone know why?
We can use this functionality to change the cell style, add a different label, or to protect the cell against accidental deletion: `SaveToCell[var, Deletable -> False]`.
I have been using this little function for a while, and I hope that others will find it useful too.
Do be careful though: notebooks are not designed for storing large data. I would avoid storing data as large as several tens of megabytes within notebooks.
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=in1.png&userId=38370
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=in3.png&userId=38370
[3]: http://mathematica.stackexchange.com/q/140989/12Szabolcs Horvát2017-03-25T21:56:48ZMathematica 11.0.1 now available for the Raspberry Pi
http://community.wolfram.com/groups/-/m/t/1028536
Hi all,
Mathematica 11.0.1 is now available for the Raspberry Pi on Raspbian. If you already have Mathematica installed on your Raspberry Pi, you can update with the following:
sudo apt-get update && sudo apt-get upgrade wolfram-engine
If you don't already have Mathematica installed you can run the following commands to install it:
sudo apt-get update && sudo apt-get install wolfram-engine
New features for the Raspberry Pi include :
- Neural Network features including constructing custom nets : http://reference.wolfram.com/language/guide/NeuralNetworks.html
- Audio processing features including out of core streaming of large sounds as well as advanced audio processing : http://reference.wolfram.com/language/guide/AudioProcessing.html
- Travel based path plan functions including path finding from one city to another : http://reference.wolfram.com/language/guide/LocationsPathsAndRouting.html
- Channel based communication for sending and receiving messages : http://reference.wolfram.com/language/guide/Channel-BasedCommunication.html
- Powerful and easy scripting through WolframScript : http://reference.wolfram.com/language/ref/program/wolframscript.html
- And many more : http://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn11.html
Additionally, with the new release of WolframScript on the Raspberry Pi, you can install WolframScript standalone and run it without a local kernel against the cloud using the `-cloud` option. This means you can use the Wolfram Language through WolframScript on the Raspberry Pi without having wolfram-engine installed by running it against the cloud. See the documentation page for WolframScript for more details.Ian Johnson2017-03-09T21:02:49Z