Hi Luc,
Maybe StringMatchQ[“teste”, “t*”] can be used in place of StringStartsWithQ ?
How would this works?
DropWhile is easy to implement as Drop[#, LengthWhile[#, …]]&. Generally I’m against having too many basic functions, as Mathematica already has plenty. But in this case I agree that DropWhile[] would be very nice to have. Since we already have TakeWhile and LengthWhile, DropWhile would be a very natural addition, and I’m sure many people have looked for in the docs just because they new about the other *While functions.
This is not a suggestion for a new function, but for some new functionality: a hook into object destruction.
It’s possible to extend Mathematica using C through MathLink or LibraryLink. Sometimes it’s necessary to have some data structure on the C side and make it accessible in Mathematica. In this case it is necessary to have an explicit function for destroying these data structures on the other side, just like in low level languages that don’t have automatic memory management or garbage collection. This is somewhat inconvenient.
Examples are TetGenDelete (from TetGenLink) and ReleaseJavaObject/ReleaseNETObject (from JLink/NETLink). Java does have garbage collection but the moment Java objects are made accessible from Mathematica it can’t work automatically and it becomes necessary to destroy objects explicitly.
The best idiom I know for handling this situation is JavaBlock. (One can implement something similar for any library that has its own data structures.) It’s much nicer to use than explicit free functions, but it’s still not awfully convenient.
I wish Mathematica has a hook for expression destruction to make it possible for the free functions to be called automatically. I’m not sure how this would work, or if it’s even feasible, but it would be very useful. The fact that even the JLink developers decided on using JavaBlock instead of adding this hook into the kernel makes me suspect that it is not at all a trivial matter.
I would like a built-in function which verifies is a degree sequence is graphical, i.e. the same as Combinatorica`GraphicQ without the $RecursionLimit problems that Combinatorica function has. This functionality must already be present in the kernel in some form for use by DegreeGraphDistribution, but it is not publicly accessible.
Improve the support for keyboard input! CurrentValue should be able to read more than just the modifier keys. The current support for only KeyDown events makes it very hard to make keyboard based controls for games. Sharing games with CDF is one of the best ways to get new people interested in Mathematica. I spent the first several years of teaching myself how to program by making two-player keyboard input games. Friends in my high school classes loved playing them. My school didn’t offer any programming classes, and when I started an after school club for programming all people wanted to do was learn how to make games.
Mathematica is the only language I’ve ever used to make a result to show to someone else that doesn’t support this functionality. Don’t get me wrong. I love that I’ll be able to read input from a DIY mass spectrometer in WL, but if you write your code on a keyboard, you need to fully support getting input from it. I don’t have any data, but every second of my life tells me that for every student that wants to build a home weather station, we could gain ten users from students sharing games they make with their classmates.
Yesterday, I saw one of my friends from internships and the college programming team was making a game with Elm to practice reactive functional programming. I thought, “Hey, I’m making a Spacewar clone in Mathematica right now. I can probably sell him on Dynamic as opposed to Elm’s lift and get him to install the CDF player, but I can’t make a natural feeling input scheme for the Spacewar clone!”
I say this needs to be fixed or Elm or whatever the latest open-source startup language with a non-mainstream idea and a small library will eat Mathematica’s lunch. I’ve got a boat to catch. I’ll get caught up in a week. Here’s the start of the Spacewar code if you want to try to make turning controls that don’t jitter.
t0 = AbsoluteTime[]; dt = 0; {width, height} = {600,
400}; stars = {White, PointSize@Tiny,
Point@Transpose@{RandomReal[#, #3],
RandomReal[#2, #3]}} & @@ {width, height, 30}; ship1 := {White,
Line[4 {{{0, -3}, {1, -1}, {1, 1}, {0, 3}, {-1,
1}, {-1, -1}, {0, -3}}, {{1, -1}, {2, -2}, {2, -3}, {1/
2, -2}}, {{-1, -1}, {-2, -2}, {-2, -3}, {-(1/2), -2}},
If[CurrentValue[
"ShiftKey"], {{1/
2, -2}, {0, -4}, {-(1/2), -2}}, {}]}]}; {position1, velocity1,
angle1} = {2./3 {width, height}, {0, 0}, 0}; EventHandler[
Dynamic[(dt = # - t0; t0 = #) &@AbsoluteTime[];
If[CurrentValue["ShiftKey"],
velocity1 += 20 {-Sin@angle1, Cos@angle1} dt];
velocity1 += (10^5 Normalize@#/(Norm@#)^2 dt &)[{width, height}/2 -
position1];
Graphics[{stars, {White,
Translate[Line[{#, -#}], {width, height}/2] & /@
RandomReal[{-10, 10}, {2, 2}]},
Translate[Rotate[ship1, angle1, {0, 0}],
position1 = {Mod[#, width], Mod[#2, height]} & @@ (position1 +
velocity1 dt)]}, PlotRange -> {{0, width}, {0, height}},
ImageSize -> {width, height},
Background -> Black]], {"LeftArrowKeyDown" :> (angle1 += 10 dt),
"RightArrowKeyDown" :> (angle1 -= 10 dt)}]
A convex hull function that works in dimensions>= 2 and doesn’t always triangulate (e.g., the same functionality as qhull)
Export of unmeshed BSplineSurface and graphics primitives such as Sphere to a CAD file format such as Rhino’s .3dm
Some very basic integration between CDF Manipulate controls e.g. Buttons and the hosting html page.
Export of 3D primitives and their boolean combinations to STEP and SAT would be nice. These are universal agnostic formats for transfer between CAD environments.
I agree completely with the prior comment about improving ease of use with Graphics. I know this isn’t a single function (as the thread indicates), but I use Mathematica mainly to write interactive demonstrations and documents for my classes, and I find great difficulty in getting graphics to look the way I want without a surprisingly large amount of work, compared with the relative efficiency of much of the rest of the system. Also, on more than one occasion, the program has crashed while I have been adding text boxes to graphics, etc.
I’d like a function analagous to Array that creates subscripted variables rather than indexed variables.
DataArray and DataStore functions as described by Wolfrm back in 2011-2012 please.
Sliders with a logarithmic scale.
Make Solve and other similar functions “MatrixForm”, and perhaps even “*Form” where it makes sense, aware so that people who cannot resist the compulsion to desktop publish their inputs only to then post asking why they then cannot get useful and correct answers out of Solve and other similar functions. If the function gets a *Form input then just strip off the *Form and see if it can the produce a correct answer. This should be a very small programming task.
In[1]:= Solve[MatrixForm[{{1, 2}, {3, 4}}].MatrixForm[{x, y}] == MatrixForm[{7, 9}]]
Out[1]= {{\!\(\*TagBox[RowBox[{"(", "", GridBox[{{"1", "2"},{"3", "4"}},GridBoxAlignment->{"Columns" -> {{Center}},
"ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}},GridBoxSpacings->{"Columns"->{Offset[0.27999999999999997`],
{Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {Offset[0.2], {Offset[0.4]}, Offset[0.2]},
"RowsIndexed" -> {}}], "", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]\).\!\(\*TagBox[RowBox[{"(", "",
TagBox[GridBox[{{"x"},{"y"}}, GridBoxAlignment->{"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> {Offset[0.27999999999999997`], {Offset[0.5599999999999999]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {Offset[0.2], {Offset[0.4]}, Offset[0.2]},
"RowsIndexed" -> {}}],Column], "", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]\) -> \!\(\*TagBox[RowBox[{"(", "",
TagBox[GridBox[{{"7"},{"9"}}, GridBoxAlignment->{"Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}},
"RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> {Offset[0.27999999999999997`], {Offset[0.5599999999999999]},
Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> {Offset[0.2], {Offset[0.4]}, Offset[0.2]},
"RowsIndexed" -> {}}],Column], "", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]\)}}
In[2]:= Solve[{{1, 2}, {3, 4}}.{x, y} == {7, 9}]
Out[2]= {{x -> -5, y -> 6}}
There is no need to complicate the task by keeping track of whether *Form has been removed and try to restore that after the calculation, the user can easily add a //*Form to the end of their calculation if they wish. All that is needed is to list every function in Mathematica that would be broken if they are given a *Form and strip that before they begin. This would only try to begin to fill one gap between desktop publishing and the rest of Mathematica.
Parallel as an option to some functions?
After posting this, I remembered that there are the ParallelTry, Paralellize functions. However, I wonder if some functions might have internal parts that could be paralellized, but for which Parallelize[_] might not work.
I don’t know if this is true, but I imagine there are cases in which some functions may be parallelized. For example,
FindClusters[__, TryParallel->True]
or
NDSolve`FiniteDifferenceDerivativeADerivative[__,TryParallel->True]
would launch kernels if possible and speed up computation.
I also wonder if TryGPU might be an option for some functions as well?
S M Blinder, I saw this attempt at LogSlider. It only produces one-way behavior though (dragging the slider changes the value, but changing the value doesn’t move the slider). Here is a simple start for LogSlider that produces the two-way behavior we’d expect. I’ll put it as a stub for “Slider (computing)” on Wikicode tomorrow, so it can be collaboratively expanded.
LogSlider[Dynamic[x_], max_] :=
Slider[Dynamic[Log[max, x], (x = max^#) &]]
{LogSlider[Dynamic@x, 10^6], Dynamic@x}
Unit were a welcome addition to mathematica, but a pain to use.
Please add a “Units Palette” as part of the standard distribution.
<s>Completely agree with the delaunay triangulation and convex hull; it is VERY slow compared to other packages. Rendering it useless for practical things!</s> huge improvements since version 10.
<s>OrderingBy: Like the entire family: Sort/SortBy, Gather/GatherBy, Split/SplitBy</s> not so useful indeed…
AxesScaling: An option for ALL the plotting-functions (Plot,ListPlot,ContourPlot, DensityPlot, ParametricPlot et cetera and their 3D variants) that specifies the Axes to be Linear/Log/Date/Custom: AxesScaling → {“Linear”,“Log”,“Log”} would result in a 3D plot with lin-log-log scales. Now you have to do everything manually by renaming ticks and rescaling coordinates (total mess).
<s>Please fix the logarithmic ticks: if it spans many orders of magnitude it will do 10^0,10^2, 10^4 et cetera. That is not too bad; the worst is is that it creates 8 subticks between them! They really have no meaning then!</s> fixed since version 10.
Local unit recognition; over the internet is just too slow. Just put it as a paclet like many components, so it is updatable.
I think that OrderingBy is not necessary. It it were to be analogous to SortBy then OrderingBy[list, f] would give exactly the same output as Ordering[f /@ list], which can even be changed to
Ordering[f[list]]
for better performance is f[] is one of the optimized listable functions.
(Sorry about the code block, the editor mangles what I wrote otherwise.)
One improvement I would really like to see is fixing up the Graph-related functions, especially the property API. It’s rather unpredictable and there are lots of serious usability functions, which mostly come up when one would use SetProperty and related functions. I’m not going to hijack this thread by describing examples, but I’m sure people who’ve used these functions have encountered them …