@seismatica Because Plus has the Listable attribute. Try Plus[1, {1, 2, 3}] for example. Now if the list is empty it threads over the nothing. The result is the empty set.
Is there a name for this nothing? I know what you're talking about but Plus[1, {Null}] and Plus[1, {Null, Null, Null}] still preserves the 1, but the 1 is totally destroyed here.
ok I got that example, but wouldn't Plus[1, List[Sequence[]]] the same as Plus[1,List[]], and then why would that evaluate to List[], and destroying the 1 in the process?
@seismatica It is really just because Plus tries to add the 1 to all elements in the list. This behavior come with the AttributeListable. When there no element in the list where you can add the one to, it vanishes.
What is the algebraic difference between arithmetic operations, that prevents entities with different units from being summed or subtracted, but allows them to be multiplied or divided?
This looks more like a question for Physics, but lengths and areas, for example, are in the domain of pure mat...
I always thought Listable meant one can apply the function to each element of the same position in each list. I'm not as comfortable with the fact that if there's no corresponding element in one list, the whole thing just vanishes.
For example when I tried {1, 2, 3} + {4, 5} with Listable on, I got this error "Objects of unequal length in {1,2,3}+{4,5} cannot be combined.".
Then wouldn't f[a,{}] be f[a,Sequence[]], which will evaluate to f[a], instead of just {}?
I guess I just don't understand this part: "When there no element in the list where you can add the one to, it vanishes." That seems a peculiar behavior to me.
I'll feel more confident they'll fix it if I can get a guaranteed repro. Now it seems guaranteed to do it if I've been in a notebook for a while, but not sure what the minimal repro is from a fresh start.
Dealing with Wikipedia API has always been a more pleasant experience for me than the Facebook API. I'll be going back to game stuff after this, but yesterday I suddenly had a strong desire to see if this result will match my intuition.
Apparently they are basically crippling the Facebook API soon. You won't even be able to download your friend list without them giving explicit, separate permission to your app.
@blochwave very tasteful. Next up, "would you have survived MH17?". By the way I'm having unexpected trouble getting your 2-d problem to compile correctly. Need to look over it carefully and haven't had the time so far.
Also why is this in ExampleData? We demand TitanicData!
Hm.. I'd have expected a smoother curve. But then again who knows if there was a large group of professional swimmers on board who all just graduated from high school on board :P.
@Taliesin Could you consider an operator form for TakeWhile and LengthWhile? Is there a reason not to do this? (One reason could be that Take doesn't have an operator form, and probably can't, as it is already defined for single arguments.)
@Nasser. Needless to say, but I can't reproduce your problem :-) What happens if you kill and restart your kernel? If that doesn't work, it would be really scary.
@m_goldberg ofcourse if I restart the kernel it will fix it, I have not tried it, because I want to keep the session as is while looking at this problem. This causes me so much headache.
I can see if I can reproduce it, but before, I'd like to see what is going on. The kernel seems to be holding on to old computation I did before
@Nasser. Immediately after starting a new session the V10 kernel seems to be in an unstable state. I have developed the habit of killing and starting a new one at session start. This has eliminated much grief.
@Rojo ah well that is a relief, I value your input a lot :). I am sorry if you had tough days. I have made no answer about the *By functions, just the one about DeleteDuplicatesBy. Thanks for the reply :)
@Nasser Have you tried this in V9? I'm not so sure it's a new bug. The second derivative was troublesome in V9 as well. Not this particular trouble, but it could be related.
Lesson learned over my 21 months of participation in Mathematica.SE: There is nobody less prepared to take up Mathematica than an experienced C programmer, except maybe an experienced C++ programmer.
When a cell is larger than 1000 lines, the front end search fail to find something I am looking for in that cell, and jumps to the next cell to find it. This is too crazy. Now I can't have a cell that is large and still use search.
I'll put the notebook on-line so you can see for yourself. just need a minute
Ok, here it is, can someone please try this. The notebook is in this folder 12000.org/tmp/072014 (one .nb file) after you download it and open it, simply search for semi colon ; you will see it will not find any in the second large cell. It will only find the ; in the first small cell. Is this a known bug also?
There are lots of ; in the second cell, for example lines ode[[796]] and around it, they all have ; at the end, but search does not find them because the cell is large.
@Nasser If you do something like y''[x] = 5, then a definition is added to Derivative. You can see this by evaluating Debug`$ExamineCode = True and then ??Derivative. As @acl says, you must clear this definition from Derivative.
@WReach thanks. Yes, I just found it just now also. I fixed it. I think this is what was causing the y'' to be defined as =. I copied all these from old file and had to correct many things, I overlooked this one.
There was 2 other ones also. All fixed. I think this resolves this issue with y''. The search bug is still there when cell is large. Will report to WRI
Again, I just assumed that doing Clear["Global`*"] will clear any definitions I made. Even if I did y''=something by error. But I guess I was wrong.
@acl or anyone what would be an efficient way to read a large number of files and get the last line from each file (each file has large but unequal number of rows and columns). I do not need anything other than the last line.