« first day (2489 days earlier)      last day (2012 days later) » 

3:16 AM
@b3m2a1 I am using vuepress as my online doc. Highlight not support Mathematica. :D
But in fact we can render all the code into a picture, just like what C.E. did in wordpress
And for a better reading experience, we can just render Input|Output Cell. For example, Iconize obviously can't be highlighted by code, and expression can still be Copy as Input Form
Then we can write a comment or auxiliary code in the Program Cell
 
3:33 AM
@GalAster I saw it on one of your sites actually. It should also be easy enough to add Mathematica highlighting. I added it to my own static site builder and it was a really simple edit using @halirutan's work.
I'm hoping I can use the Vue back-end stuff in place of bootstrap and jQuery and my own static generator stuff. More customizable that way.
 
That's great, but Rendered Cell is still necessary in some cases. Maybe we can define Code Cell as the code that needs to be rendered.
 
@GalAster I've got a whole system in place for cooking a notebook down to Markdown. My thought it to use that architecture as the first step.
I've used the converter enough places to feel decent about its robustness.
Although some of the formatted math is a pain in the ass.
 
vuepress highlight use Prism: prismjs.com
Written in @vuepress/markdown/lib/highlight.js: const code = prism.highlight(str, prism.languages[lang], lang)
 
Should be possible to either customize or post process to use prettify though.
Or use a lang-none and add the highlighting to the template in some preprocessing stage.
 
4:35 AM
Is it possible to control the layout of Output?
 
4:52 AM
Unfortunately not easily. You can use things like this though: mathematica.stackexchange.com/a/174724/38205 and set $Post
 
 
6 hours later…
11:06 AM
I also was inspired by halirutan's work to render code. My contribution is mostly piecing together: 1) how to render code, 2) highlighting, which I got from the Wolfram blog, 3) tooltip, from tutorial, and 4) how to copy code to clipboard, which I found online. Anyone who wishes can use the CSS/JavaScript that I use, it is available here: github.com/cekdahl/wl-wordpress-xmlrpc-client/tree/master/…
In fact, I think it would be nice if others would use the same style. Consistency is good from a user experience point of view.
I have gotten some feedback from an early adopter of the WordPress package, and he has managed to install it on his blog but I will probably make some changes to simplify it.
Anyway, he told me that RStudio also has a WordPress integration, and that this is an example of an R notebook that has been posted in that way to WordPress:
https://kulturarvscluster.kb.dk/arkiver/87
Good to know that other languages also have this feature.
 
 
3 hours later…
2:02 PM
Did you know that SparseArray[data, 10] and SparseArray[data, {10}] are not equivalent?
 
2:32 PM
I've never gotten Undefined as a solution from DSolve before:
pde = d*cp*D[T[t, z], t] == k*D[T[t, z], {z, 2}] + Q;
Block[{cp, d, Q, k, h, Tamb, a},
 {cp, d, Q, k, h, Tamb, a} = {1, 1, 1, 1, 1, 1, 0};
 sol = DSolve[{pde, T[0, z] == Tamb, (D[T[t, z], z] /. z -> 0) == 0,
    (-k*D[T[t, z], z] /. z -> a) == h*(T[t, a] - Tamb)},
   T[t, z], {t, z}]
 ]

(*  {{T[t, z] -> Undefined}}  *)
 
 
2 hours later…
4:03 PM
@Szabolcs Not sure what you mean:
data = Table[{2^i} -> 1, {i, 3}];
a1 = SparseArray[data, 10];
a2 = SparseArray[data, {10}];

a1 == a2
(*  True  *)

a1 === a2
(*  True  *)
 
4:17 PM
@MichaelE2 you have boundary conditions both on same end of the bar. Since your "a" is zero. i.e. (D[T[t, z], z] /. z -> 0) == 0 and (-k*D[T[t, z], z] /. z -> a) both refer to the left end of the bar. If you change "a" to something other than 0, say 5, then M do not give undefined. But it does not solve it.
 
4:45 PM
@MichaelE2 what if data ={} or data={{1,2}} -> {3} ?
Then the behaviour is quite different.
 
@Nasser Yep. My comment was not to ask why it is undefined. I just didn't know DSolve could return Undefined as an answer.
@Szabolcs I see. Thanks. For data = {} I get the same things, but for the second example, the depth of SparseArray[data, 10] is inferred from data. I rather think for the second example, SparseArray[data, {10}] should give an error or warning. It certainly does interesting things on data = {{3, 2}, {5, 1}, {7, 6}} -> {3, 5, 7}.
@Nasser BTW, I was randomly plugging simple values into the parameters for a site Q&A to see if DSolve would solve a less general problem. I plugged in 0 for a not really paying attention to what values would be meaningful.
 
5:10 PM
@MichaelE2 can't try now (using a phone) but SparseArray[{}, 5, 0] reported an error for me, which was surprising. I thought it would give a lenght 5 1d array
 
@MichaelE2 I also never seen undefined from DSolve. May be it got confused since two boundary conditions are given for same location. I do not know. Might be worth reporting it.
 
@Szabolcs SparseArray[{}, 5, 0] works for me (V11.3, Macos).
@Nasser I didn't think it was an unreasonable result, but I guess it would be nice if there were a message about conflicting/redundant BCs.
 
@MichaelE2 yes, that is good idea. A warning message would have been better, it will be more user friendly also.
 
 
1 hour later…
6:41 PM
@MichaelE2 Sorry, I was not at the computer and gave the you wrong code. It is SparseArray[{} -> {}, 5] that does not work. SparseArray[{} -> {}, {5}] works fine.
 
7:19 PM
I am encountering crashes when I try to load a LibraryLink library compiled with a newer WolframLibraryVersion (e.g. 4) in an earlier version of Mathematica (one that supports only 3). I am on macOS.
Did anyone else see this, and did you manage to figure out why it crashes?
Of course that library will not work in older versions, but it should not crash. That is the whole point of having a WolframLibraryVersion.
I cannot reproduce the issue with the very simple demo library that ships with Mathematica, so it is something more involved.
 
@Szabolcs OP should be able to edit the question. He is not blocked or anything.
 
7:36 PM
I am looking for suggestions for a good name for a function that extracts the upper/lower triangular part of a matrix into a vector. What would you call such a function?
 
@Szabolcs I get the same. My guess is that SparseArray[pos -> val, n]creates an nby n by...by n array, of depth d-1, where d = ArrayDepth[pos]. Since ArrayDepth[{}] is 1, SparseArray[{} -> {}, 5] cannot be constructed as a 0-depth array. -- There's no documentation AFAIK, just a couple of non-pathological examples.
 

« first day (2489 days earlier)      last day (2012 days later) »