12:42 AM
Does any know why 1+{} gives me {}?

@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.

1:05 AM
@seismatica No, `{}` is not `{Null}`!
This nothing is called an empty Sequence
@seismatica `1 + {Sequence[]}`

oh so that's what it is. thanks @halirutan!

@seismatica When you have (I don't know another word for that) a sequence of things, it's represented as `Sequence[t,h,i,n,g,s]`.

but why would 1+Sequence[] still returns 1?

@seismatica Think about it differently. What you wrote is something like `Plus[1, Sequence[2, 3]]`
Now imaging the sequence is empty. You are then left with `Plus[1]`

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?

1:15 AM
@seismatica It is really just because `Plus` tries to add the 1 to all elements in the list. This behavior come with the `Attribute` `Listable`. When there no element in the list where you can add the one to, it vanishes.
Try this:
```Unprotect[Plus];
ClearAttributes[Plus,{Listable}]```
Now, everything is like you would expect it
`1 + {}`
is not further simplified.

68

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 got the result with removing the Listable attribute, and it does work like you described.
How can I restore the attribute back to Plus?

```SetAttributes[Plus, {Listable}];
Protect[Plus]```
or restarting the kernel
@seismatica There is no way around understanding the evaluation process of Mathematica some day. The question is, are you ready yet for that.

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.".

@seismatica `Listable` applies the function one level deeper if it sees a list.

1:25 AM
I don't know why I didn't get that with 1+{}. Perhaps adding an atom into a list works differently than adding lists.

@seismatica if there are more than one list in the arguments of a function, they need to have the same dimension.
Example:
```SetAttributes[f, {Listable}];
f[a, {1, 2, 3}]
f[a, {1, 2, 3}, b]
f[a, {1, 2, 3}, b, {x, y, z}]```
it really just checks for the Head `List`:
`f[a, {1, 2, 3}, b, l[x, y, z]]`
if it is not present, then even complex expressions are handled as one object

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.

@seismatica I expressed this badly. What I mean is: Listable is like mapping the function over the list. `g /@ {}`
if a function is listable, it gets applied to each element of the list. If the list has no elements, there is nothing you can apply the function to.
If an element of a list is again a list, the function is applied to each element of this list... and so on
`f[{x, y, {z}}]`

1:41 AM
thanks halirutan! the Map analogy seems much clearer. Ima head out of a while but i'll be back to analyze your insight in more details when Im back.

@seismatica No problem. Bye

2:08 AM
v10 crashes a lot for me if I paste a string copied from an output cell after an opening quote.
Trying to get a guaranteed first try repro. But it always does it after messing around with a new notebook for a couple of minutes.

@MichaelHale Just hurry to report everything so that the guys at Wolfram can work their asses of and make v10.0.1 way more stable.

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.

@MichaelHale This is the worst. I had here that when I copy a cell from one notebook to the oder, the cellstructure was lost. Can't reproduce it.

Yeah, I'll nail it down sometime this week for sure. Focused on getting a result now though.
Just some fun code to see which of my Facebook friends get the most average "likes" per post.
It's definitely not me.
SocialMediaData reaches its capability limits pretty quickly. Having to make the API calls myself for everything past getting the list of people.

@MichaelHale If there is a topic I will not dive into in the near future.. it's very likely to be Mathematicas capabilities to connect to Facebook :-)

2:23 AM
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.

1 hour later…
3:39 AM
Oh, sweet. I didn't see that URLEncode/URLDecode are now official functions.

6 hours later…
9:12 AM
Anyone else see the latest tweet from Wolfram about the Machine Learning capabilities of Mathematica 10?!?

1 hour later…
10:38 AM
```prediction = Classify[ExampleData[{"MachineLearning", "Titanic"}, "Data"]]
prediction[{"1st", 23, "male"}, "TopProbabilities"]```

1 hour later…
12:00 PM
@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`!

@JacobAkkerboom or
```tbl = Hold@{
age,
prediction[{#, age, "male"}, "Probabilities"]["died"]
} & /@ classes;```
```ListPlot[
ReleaseHold@tbl,
{age, 1, 100}
],
Joined -> True,
PlotMarkers -> {"\[FilledSmallCircle]", 9},
PlotLegends -> classes
]```
which brings to mind this

12:26 PM
hmm `classes =
DeleteDuplicates@
ExampleData[{"MachineLearning", "Titanic"}, "Data"][[All, 1, 1]]`
(forgot to paste that)

12:49 PM
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.

3 hours later…
3:22 PM
@OleksandrR. Indeed, I didn't find it that tasteful! Don't worry about the 2D problem, I've got no further with my attempt either in the last week.
(as in, don't worry about the time it;s taking you!)
It's a lot trickier than I anticipated.
I appreciate all the help!

4:04 PM
@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.)

5 hours later…
9:01 PM
I am clearing everything, but when I write y''[x] I get some output that seems to be stuck in M buffer.
How can the above be possible?
Is my version 10 going crazy?
Is this a bug or I am imagining things?

@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
It is holding on to only y''[x] !! look

9:19 PM
@JacobAkkerboom It's all good, and I agree with all you say. I didn 't read your *By answer yet, I had some tough couple of days. I'll read it soon

@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.

I think there are 2 kernels. One is holding in to cashed data.

@halirutan Yes. New activation required every kernel upgrade

@Nasser. I would say your kernel has gone completely insane and putting it out of its misery would be a kindness as well as the only fix open to you.

ok, will restart Mathematica all togother. Actually I found that starting the kernel does not fix some problems. I think V10 is buggy release

9:25 PM
@Nasser. Very buggy. But not as bad as V9.0.0.

@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 :)

@JacobAkkerboom :)

@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.

@Pickett no I have not. Been using V10 for now. Will try it when I get some chance.

9:32 PM
@Nasser try `Derivative[2][y][x] =.`
You probably did something like `y''[x] = 5` at some point

@acl will try that as soon as I re-run the same code which caused the problem, thanks.,
@acl but does one have to do that to clear y''[x]? I thought Clear[y,x] should be enough?

I just noticed that the bug I just mentioned was reported according to a comment a year ago. They had a year to fix it and yet didn't...

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?

9:50 PM
@Nasser I tested it and it's the same for me. I would report it.

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 but I did ClearAll["Global`*"] as well? does not this supposed to clear all things? please see screen shots above.

@Nasser That only clears `Global` symbols. `System`Derivative` remains untouched.

10:11 PM
@Nasser There is a typo for `ode[[1418]]` where there is `=` instead of `==`.
That is the rogue definition on `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.

@Nasser `Clear["Global`*"]` doesn't work because what you do need to clear is `System`Derivative``
ie it's not in the `Global` context

11:07 PM
@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.