Skip to main content

Posts

installation - How can I install packages distributed as .paclet files?

I downloaded a Mathematica package. It came as a file with the .paclet extension. How can I install or uninstall it? Answer This answer is for people who are not interested in package development, and just need to install a Mathematica package which they obtained as a .paclet file. Note: Before using the functions in this guide, it may be necessary to evaluate Needs["PacletManager`"] . Specifically, this is needed when your notebooks's default context is set to "Unique to This Notebook". Installing Packages distributed as paclets can be installed using the PacletInstall function. Evaluate this function with its argument the full path to the downloaded .paclet file. For example, if SomePackage-1.0.0.paclet was downloaded into the ~/Downloads directory, then evaluate PacletInstall["~/Downloads/SomePackage-1.0.0.paclet"] You may use Insert → File Path... to easily insert the path to this file. Getting information .paclet files are typically name...

How to make a graph be a grid layout exactly?

I have a such graph graph = Graph[{1 2, 1 6, 2 3, 2 7, 3 4, 3 17, 4 5, 4 9, 5 10, 6 7, 7 17, 7 12, 17 9, 17 13, 9 10, 9 14, 11 12, 11 16, 12 13, 12 8, 13 14, 13 18, 14 24, 14 19, 24 20, 16 8, 16 21, 8 18, 8 22, 18 19, 18 23, 19 20, 19 15, 20 25, 21 22, 21 26, 22 23, 22 27, 23 15, 23 28, 15 29, 25 30, 26 27, 27 28, 28 29, 29 30}] I hope to make it GridEmbedding exactly,which mean all vertex in a regular rectangle shape.Of course if we use VertexCoordinates to specify every position for those vertices,but that will be little troublesome.If I specify a layout of "GridEmbedding" directly,the result always will be depressed like {PlanarGraph[graph, GraphLayout -> "GridEmbedding"], Graph[graph, GraphLayout -> "GridEmbedding"]} I even think this is a bug behavior behind method "GridEmbedding" .Ok,let's reluctant to sepcify the "Dimension" (Sometimes we don't k...

calculus and analysis - Are greek symbols causing different evaluation?

I've updated today to Mathematica 9.0.1.0 from version 8 and found something that absolutely confuses me. Let us define a piecewise function: gr[x_, v1_, v2_, v3_, v4_, v5_] = Piecewise[{{g, v1 {gs, v1+v2+v3+v4 and try integrating it with obvious assumptions: Integrate[gr[x, a, b, c, d, e], {x, 0, END}, Assumptions -> {0 This takes around 60 seconds and obviously results in 2 b g + e gs (although it seems it was a lot faster in Mathematica 8, though it's not the point here). Now, if we do the very same integration, but with different symbols: Integrate[gr[x, τ, δ, Δ, τs, δs], {x, 0, TR}, Assumptions -> {0 All of a sudden this doesn't evaluate in 60 seconds, running till it pages all the memory available and crashing afterwads. Can anyone explain this?

packages - How to remove a paclet downloaded from Wolfram Research Server?

How can I remove a paclet that was automatically downloaded when I used a function for the first time (i.e. NetChain )? I believe the download was faulty, preventing me from using any of the functions from that paclet (e.g. ElementwiseLayer, etc.). That's why I want to redownload it. If I understand correctly, paclets are downloaded from the Wolfram Research Server when an uncommon function such as NetChain or Sound are used for the first time (indicated by a blue progress bar under the cell). Answer Use PacletFind to find the installed versions, of the paclet, for exmaple: paclets = PacletFind["*MX*"] (*{Paclet[MXNetLink,11.1.0, ]}*) Then evaluated PacletUninstall to remove said paclet. For example PacletUninstall[ paclets[[1]] ] I recommend using Part to select the paclet. If you copy/paste, you'll need to be careful to select the visible expression along with its interpretation. It's a little to easy to select just the displayed Paclet["foo", ]...

performance tuning - How to speed up band matrix-matrix multiplication?

I have a band matrix $HistoryLength = 0; n = 10000; b = 300; k = 300; a = SparseArray[Flatten[#, 1] &@Table[{i, Mod[i + j, n, 1]}, {i, n}, {j, -b, b}] -> RandomComplex[{-1 - I, 1 + I}, n (2 b + 1)]]; and a dense matrix u = RandomComplex[{-1 - I, 1 + I}, {n, k}]; I want to multiply them as fast as possible v = a.u; // AbsoluteTiming {6.748518, Null} Visual representation of this multiplication: draw = ArrayPlot[#[[;; ;; 30, ;; ;; 30]], ImageSize -> {Automatic, 200}] &; Row@{draw[v], " = ", draw[a].draw[u]} This problem usually comes up when you want to multiply a Hamiltonian by a set of wavefunctions (in a certain basis). Why I expect a possibility of speeding up? When you multiply dense matrices you can use algorithms like Strassen algorithm and use the processor cache to operate with small blocks. The matrix a have a dense band. This knowledge can increase performance in contradiction to the sparse matrix of a general form.