New answers tagged

0

Never mind, I figured it out, converting the argument to String and using StringReplace and RegularExpression inside a Module to toggle the dagger symbol. Example code: ToManipString[a_] := ToString[FullForm[ToBoxes[a]]]; BackToExpres[a_] := ReleaseHold[MakeExpression[ToExpression[a], StandardForm]]; Dag[a_] := Module[{}, newstr = ...


1

Just another way (but not desired presentation style): grid = {{131, 673, 234, 103, 18}, {201, 96, 342, 965, 150}, {630, 803, 746, 422, 111}, {537, 699, 497, 121, 956}, {805, 732, 524, 37, 331}}; dim = Dimensions[grid]; vw = Catenate@ MapIndexed[ (#2[[2]] - 1) 5 + #2[[1]] -> #1 &, grid, {2}]; s = GridGraph[dim, VertexLabels -> "Name", ...


6

I wanted to be able to extract the path from your recursive memoized function, but I couldn't make it happen. But here is a function to find the minimum path from the upper left to the bottom right corners of an array of numbers, minimalpathsum[grid_] := Module[{dims, vertcoords, graph, weights, path, indices}, dims = Dimensions@grid; vertcoords = ...


2

With a slight modification of your MinPath function so that it takes a matrix as input ClearAll[MinPathF, nextF] MinPathF[mat_][i_, j_] := MinPathF[mat][i, j] = mat[[i, j]] + Piecewise[{{Min[MinPathF[mat][i + 1, j], MinPathF[mat][i, j + 1]], i < Length[mat] && j < Length[mat[[i]]]}, {MinPathF[mat][i + 1, j], i < ...


8

Why not use Szabolcs's MaTeX package to create your display equations? It has the benefit that you can copy and paste directly from a LaTeX document. << MaTeX` SetOptions[ MaTeX, {"Preamble" -> {"\\usepackage{cancel}"}, FontSize -> 18}]; MaTeX["\\cancel{2x}"] MaTeX["\\cancel{1234567890}"]


11

Here is a semi-manual way of doing the kind of decoration you're asking for, based on Overlay: strikeThrough[obj_, {width_, height_}] := Overlay[{obj, Graphics[Line[{{0, 0}, {width, height}}], PlotRange -> {{0, width}, {0, height}}, ImageSize -> {width, height}]}] strikeThrough[123456, {45, 12}] The first argument of strikeThrough ...


1

To get the "display form" placement of the summation limits, you have to use the low-level option LimitsPositioning -> False. Since this is inconvenient to enter manually, I defined a keyboard shortcut EscsumEsc to do this for you. I used a TemplateBox to define the shortcut, so that it creates a construct similar to what the existing shortcut EscsumtEsc ...


3

Perhaps f = #/. Power[a_,b_]:>(Inactive[Times]@@ConstantArray[a,b])& f[x^2+2 y^5] (* x*x+2 (y*y*y*y*y) *)


16

You want to use an UnderBrace. Highlight the g....g then type Ctrl-4 to get under it, then type Esc u{ Esc, then highlight the underbracket and hit Ctrl-4 again, gives this To get better, you might want to use Szabolcs's MaTeX package, in which case you will get an image of the rendered TeX, <<MaTeX` MaTeX@Underscript["g...g", Underscript[︸, ...


0

This can be achieved by matching a few layout options between the two charts. Namely, ImageSize, ImageMargins, ImagePadding, PlotRange, and PlotRangePadding. Scaled and Automatic can be used to simplify selection. With f[p_, q_, phi_, x_] := (If[p > 0, Sin[2 Pi p^2 x]/(2 Pi p^2 x), 1] Cos[2 Pi p^2 q x + phi/2])^2 alignment = Sequence[ImageSize ...


1

Just going to throw this in to the mix. When I saw this question, it immediately seemed perfect for Jens's function, which I modified and used previously, and in fact I have it defined in my init.m because I use it with such regularity. I have modified the original function to respect the individual aspect ratios of the constituent plots, and the ...


7

I think it may perhaps be easier just to combine plots and modify (e.g. suppress unnecessary frame ticks). I post this as a motivating answer rather than definitive answer. li is a modified version of OP function: li[p_, q_, phi_, {l_, u_}] := DensityPlot[(If[p > 0, Sin[2 Pi p^2 x]/(2 Pi p^2 x), 1] Cos[ 2 Pi p^2 q x + phi/2])^2, {x, -30, 30}, {y, ...


3

This is a partial solution, using Epilog and Inset. It has an alignment problem, especially after we resize the picture by hand inside the Manipulate box. Also, without resizing the whole, playing with the parameters may give an alignment problem after a while. How to fix this ? LumIntensity[x_, p_, q_] := (If[p > 0, Sin[2Pi p^2 x]/(2Pi p^2 x), ...



Top 50 recent answers are included