« first day (1428 days earlier)      last day (3354 days later) » 

01:36
People still doing the daily Christmas code puzzles? I got caught up yesterday and saw you have to get both parts within 30 minutes of release to make the high score board. I had a pleasant moment tonight with today's puzzle. I was out on the patio, typed it into Maximize pretty directly, and it worked. Took 27 secs.
Maximize[{Max[3 a - 3 b - c, 0] Max[3 b, 0] Max[4 c - 2 d,
    0] Max[-3 a + 2 d, 0],
  a + b + c + d == 100 && a >= 0 && b >= 0 && c >= 0 && d >= 0}, {a,
  b, c, d}, Integers]
Out of curiosity, I wanted to time just brute forcing the 100 million cases. Took 110 secs.
best = 0; Do[
 If[a + b + c + d == 100,
  cur = Max[3 a - 3 b - c, 0] Max[3 b, 0] Max[4 c - 2 d,
     0] Max[-3 a + 2 d, 0]; best = Max[best, cur];], {a, 0, 100}, {b,
  0, 100}, {c, 0, 100}, {d, 0, 100}]; best
However, then just optimizing based on the summation constraint to only check the cases that sum to 100 reduced the time to less than 2 secs.
best = 0; Do[d = 100 - a - b - c;
 cur = Max[3 a - 3 b - c, 0] Max[3 b, 0] Max[4 c - 2 d,
    0] Max[-3 a + 2 d, 0];
 best = Max[best, cur];, {a, 0, 100}, {b, 0, 100 - a}, {c, 0,
  100 - a - b}]; best
So the behavior of Maximize falls somewhere between brute forcing and the first optimization a human would make. Not sure how much is due to processing optimizations like compilation vs method.
I suppose the key point from Wolfram's perspective is that it took me more than 30 seconds to think of the optimization, so Mathematica saved me time even if I was the fastest Python writer.
 
5 hours later…
07:06
Hi,everyone, I have a confusion about the following question:
where p=3
my understanding of this question is 2 and 2
 
1 hour later…
08:14
@ShutaoTANG seems like floor and ceiling so not so interesting for integer `p`. p.s:

\[LeftCeiling]3 - 1\[RightCeiling]
08:46
@Kuba Thanks:) Ceiling[2] == Floor[2] returns True
Does anyone know how to force ScientificForm to always give a digit after the decimal? I want ScientificForm[1.0, 2] to output 1.0 so that it looks better next to ScientificForm[0.82, 2]
09:48
@JasonB something like NumberFormat -> ((Row[{NumberForm[ToExpression@#1, {\[Infinity], 1}], *code to handle exceptions for exponents* }]) &)
@JasonB It was always very handy :)
10:27
@Kuba, that works for 1.0 but then it omits the exponent on 0.82 - sorry I wasn't clear, I'm looking for a labeling function for a legend, so one function that would do well for smaller and larger numbers. In the past I used a piecewise function, using NumberForm for numbers between 0.1 and 9.9 and ScientificForm for all others, but that feels clunky. I thought this was simple enough to ask here but maybe I should post it as a question.
@JasonB I suppose the answer is, you have to built it :) related: mathematica.stackexchange.com/q/27107/5478
@JasonB it is crazy that those things are not built in.
11:08
Do the answers given in this post, mathematica.stackexchange.com/questions/30604/…, work for others using version 10? Particularly, I can only get PasteRaw[] to work if the contents of the clipboard were copied from Mathematica
I want to copy a big, nicely formatted function from a post here, but when I paste it into a notebook, it comes out like this
 
2 hours later…
13:35
0
Q: Ways to obtain a BoxObject

KubaIs there any way to get BoxObject, except with EvaluationBox[] | ParentBox? So usually one need to create objects with Initialization or Buttons and use EvaluationBox[] etc. I would love to see more flexible approach e.g. how to get it from current selection. I was only able to find: BoxO...

Just wrote something related to this Q/A on the Wolfram Community
@Silvia impressive :)
@Silvia awesome!
14:00
Didn't have enough time to expand with more details :P
I have a large packaged integer array arr (of arbitrary dimensions). I also have a list of integers. I need to replace those elements of arr which appear in list with a 1. The rest should be replaced with 0. What is a fast way to do this?
I don't want to post a main site question because I already solved this: I programmed it in C. But I was wondering if there's a fast way to do it in pure Mathematica. The naive way I used amounts to 1 - Fold[# Unitize[arr - #2] &, ConstantArray[1, Length[arr]], list]. Let's assume for now that list is not too big.
14:48
@Szabolcs Would dispatch/association be faster than Fold?
(that might unpack though not sure)
@R.M. Yes and yes. I was just writing up a question but I got interrupted. The Fold version is linear in the size of list, the Lookup version would be no worse than logarithmic (I assume). So which one is faster depends on the size of list. But the Lookup/Association version I was able to come up with unpacks, and my arrays are huge.
@Szabolcs How many elements all in all has arr?
15:10
@halirutan On the order of a hundred million. I wrote up the question after all:
0
Q: Which elements of a large array are part of a set?

SzabolcsI have a large integer packed array arr. My array is multidimensional, but for simplicity let's consider 1D arrays for now. ArrayReshape takes care of the rest. I also have a set of integers (a list). The task is to replace those elements of arr which are in set with 1, and those which aren't...

15:26
@Szabolcs It seems that this version is faster
1 - Fold[Times, Unitize[arr - #] & /@ list]
It needs only 79% of the time.
(The runtime seems to get closer to your version with growing k. I just tried the example you have)
15:47
@halirutan That's what I did at first but I ran out of memory because I had to store an arr-size array for each element of list.
@Szabolcs What I find most disappointing is that although this problem is perfectly parallelizable, you cannot break the timing with Compile.
@Szabolcs Even the most simple expression, something like
Min[list - i]
inside the compile body takes longer than your final function.
@Szabolcs Oh... success. I got 0.5 seconds faster.
16:08
@Silvia overmodest, as usual ;-) BTW, some people got flak here because of use of Lena - at least in your case this would not be so critical, gender-wise :D
 
1 hour later…
17:18
@halirutan Thanks for the answer! It seems that there might not be a much faster solution. I suspected that that is a case, but I have been wrong about this many times in the past! So I thought it's still better to ask and maybe learn something new.
17:33
@SjoerdC.deVries has this resolved itself, or are you still having issues?
 
1 hour later…
18:43
@rcollyer I checked just now. The upgrade box still says 10.1, but when I click the upgrade button a download page for 10.3.1 opens for me. Downloading now.
18:54
Roads to Lyon - done in the Wolfram Language
http://community.wolfram.com/groups/-/m/t/758828

Something About The Automated Stippling Drawing
http://community.wolfram.com/groups/-/m/t/759091
...very fun reading
@SjoerdC.deVries thanks. I'll pass that along.
19:10
posted on December 16, 2015 by Håkan Wettergren

Background Today, many helicopters launch from and land on ships at sea. Some are conventional helicopters, both commercial and military, and some are drones. In Wolfram SystemModeler, we now have a system for simulating helicopter landings and launches that includes waves and ships. The models have been used for the design of mechanical parts, autopilots, [...]


« first day (1428 days earlier)      last day (3354 days later) »