« first day (396 days earlier)      last day (4094 days later) » 

1:41 AM
Oh how I wish I had intellisense, ex: imgur.com/sNyAE8G
 
@Mr.Wizard I got one that's twice as fast and uses far less memory. Is that any good to you?
Sorry, the amount of memory it uses is half as much. That's not exactly "far less" but it is less. (I didn't know exactly how much less before because ikf tried to use more than my computer has, so I had to abort.)
ikf2[set_] := Module[{
    tmp = {set~Take~{1, # - 1}, set~Take~{#, -1}} & /@ set
    },
   tmp[[All, 2, 1]] = With[{diag = tmp[[All, 2, 1]]},
     Transpose[{s1~ConstantArray~Length[diag], diag}]
    ];
   Join[Sequence @@ Transpose[tmp], 2]
  ];
ikf2[Range[5]] // TableForm
As @Rojo would say, "disgusting". But it seems to work.
 
2:00 AM
Is it better to have two different overloaded methods or is using default args sound in mma?
 
@Mr.Wizard Wait... if your sets are not just Range then you'll need to change that Map into an Array as in yours. That actually improves the performance a little bit.
@AdamDreaver I don't think it matters. I'd consider it a stylistic preference. Main problem with optional arguments is it makes option handling more awkward.
 
Aye, I hear you, I tend to avoid them as I get more experience in whatever language I'm using
 
2:34 AM
I'm using undefined symbols, North, West, East and South, what's the correct way to test if one und symbol is equal to another. In an If statement, if I type, North==North, I get back true, but if I do North==South, it's undefined
 
@AdamDreaver triple =
SameQ, or ===
 
@Rojo Ah, much love <3
 
Same goes for inequality, != versus =!=
 
Good to know!
I feel like soon I'm going to be good at mma, I CAN'T WAIT!!!
 
:)
 
2:46 AM
@AdamDreaver "soon" is relative. If you're a genius like @Rojo here maybe it only takes 2 years. For me it was more like 4. :)
 
@OleksandrR. hehe, yah :D By "good", I mean "good enough" that I can without too much trouble solve every problem in an undergraduate course in Calculus within mathematica, i.e. complete 80% of the material in a Stewart Calculus book.
 
@OleksandrR. Don't know if to take it ironical or seriously
In any case, it's not easy to react to flattery
Thanks
 
@Rojo partly seriously :)
 
Btw, I just posted something "too big for a comment" here and I'm not sure if I should delete it after leonid sees it.
 
No, keep it! Leave you're pearls of wisdom in the wild for other's to enjoy!Q
 
2:56 AM
@AdamDreaver Ok, that's too much
 
I'm sorry :(
 
+1, I like it. I had a feeling one could productively use the built-in boolean functions for this task but I didn't act on it.
 
@OleksandrR. It needs fixing, I think it won't work with some patterns with redundant repeated elements such as subset[1]&&subset[1,2], turning it into set[1,1,2,___]
How would you join 2 lists deleting duplicates between them but not in each?
So, {1, 2, 3} and {1, 2, 2, 6} becomes {1, 2, 2, 3, 6}
Much like the integer factors of the LCM, but for general sets
One could turn the elements into primes and use LCM :P. Or tally, join, gatherby, delete, humm
 
@Rojo there was a question on this recently. I forgot all the details about it though
 
3:12 AM
@Rojo What would be the result for {1, 2, 2, 3} and {1, 2, 2, 6}?
 
@rm-rf {1, 2, 2, 3, 6}
 
So basically delete duplicates in each and then join?
 
@rm-rf Right
joinDeleting[lists___List] :=
With[{translationRules =
MapIndexed[#1~Rule~Prime@First@#2 &, Union[lists]]},
Join @@
ConstantArray @@@
FactorInteger[
LCM @@ Times @@@ Replace[{lists}, translationRules, {2}]] /.
translationRules~Reverse~ 2
]
 
0
Q: This kind of question

m0nhawkAccidentally look at the Wolfram Demonstations (yes-yes, again), I thought of a Mathematica examples with huge computation time. Would the question about showcases of such Mathematica examples is allowed?

 
This too joinDeleting2[lists___List] :=
Join @@ ConstantArray @@@ (SortBy[#, Last] & /@
GatherBy[Join @@ Tally /@ {lists}, First])[[All, -1]]
and way faster
 
3:36 AM
@Rojo Join @@ Composition[Last, Sort] /@ GatherBy[Gather[#] ~Join~ Gather[#2], First] &
 
@rm-rf Seems neater :) thanks
 
 
2 hours later…
5:39 AM
I have a list l = { i1, .. iN }, is there built in command so I can extract an element such such that if if my index is negative is goes from the end, and if my index >= n it loops back to the beginning to the list? I seem to remember reading something about such functionality.
 
@AdamDreaver Part automatically interprets negative indices as you wish. For looping, just use Mod
All in all, you could do
 
@Rojo Nice! TY
I was just fiddling with a Mod type of solution, but my code was awful
 
@AdamDreaver That isn't accurate, wait
You have to be more specific as to the head
Head is indexed by 0
You want to loop including the head?
 
No, back to the first element
But nm, I think i'm about to figure it out, if I need any more help I'll ask a better question
 
So, say l=Range[5]
l[[-1]]==5
l[[0]]=List
 
5:47 AM
yes
 
l[[6]]==1
l[[-6]]==5
?
 
yes!
sexyyyyy
 
perhaps list[[Sign@index Mod[Abs@index, Length@list, 1]]]
 
6:15 AM
If anyone can please give me a code review:
Turn[ orient_, dir_ ] :=
Module[
{ p, a = { North, East, South, West } , l = Length[a]},
p = Position[a, orient][[1]][[1]];
If[ dir === Right, ++p, --p];
If[p == 0, p = l, If[p == l + 1, p = 1]];
a[[p]]
]
Basically mimics very simple rotation for a random walker on a 2D plane
 
@AdamDreaver why not just index everything with numbers? North=0,etc. Left=-1; Right=1; then the whole operation is just modular addition
 
@Xerxes I'll try it out, thank you
 
I did this: Turn[orient_,dir_]:=Module[{d=Switch[dir,Left,-1,Right,1],olist={North,East,South,West}},Extract[olist,Mod[Position[olist,orien‌​t][[1]]+d,Length[olist],1]]]
not sure that actually turned out shorter or faster than your version; just a difference of style
 
Seeing different ways to of doing the same thing is what's important for me.
so it helps :)
 
Skiing in Austria
 
6:24 AM
actually, since there are only 8 combinations, you might be best off just explicitly defining Turn[North,Left]=West and letting Mathematica's pattern matcher handle it as a lookup table
 
@Xerxes I'll implement that as well, and see what style suits me coding style
 
Let's see what I'd do
Hey @Xerxes
Perhaps
With[{coords = {North, East, South, West}, dirs = {Right, Left}},
i : Turn[orient : Alternatives @@ coords,
dir : Alternatives @@ dirs] :=
i = With[{rotDir = If[dir === Right, RotateLeft, RotateRight]},
orient /. Thread[coords -> rotDir@coords]];
Scan[Turn @@ # &, Tuples[{coords, dirs}]]
];
 
Gonna run that code right now, brb
 
my gut feeling was that RotateLeft/Right would have some brilliantly elegant method, but boring old Position seemed easier in the end
 
@Rojo How do I turn that into a function and pass args to it?
I tried f[orient_,dir_]:=
but error
 
6:39 AM
@AdamDreaver It is already a function
The outer With confuses you, right?
It defines "Turn"
 
lol i see you
 
Do ??Turn after running that (having cleared Turn before)
 
@Rojo Wow this is really mature code, it's going to take me a little while to digest it :D ty you for taking the time make this.
 
@AdamDreaver Search the forum for "memoization" then :P
 
hehe, I bet you smoke topcoder challenges easy peazy
 
6:42 AM
@Xerxes You got to see my tribute to you in the dithering answer, so I can delete it?
 
@Rojo dithering? no, where's that
 
@Xerxes Wait
@Xerxes here, second answer
Sorry for making you read that, probably my longest answer of all
 
aww, Linux Mathematica hates sound effects :-( I just get a bunch of Java::excptn's
Has anybody ever posted a question about that?
 
Ah, no idea... Barely ever used Linux
Ok, deleting the last paragraph, before I forget forever
 
doesn't the wiki editing system remember every edit forever and ever?
 
6:48 AM
@Xerxes I think it does
If I click on Edit, I see the prevous edits
 
@Xerxes so far I think your answer is much more concise than mine and I like it, ty. Now as soon as I can understand Rojos, my preference may change :D Regardless, it's lovely to see all these different techniques.
 
@AdamDreaver Sure. Btw, the second With is useless. You may as well just do Thread[coords -> If[dir === Right, RotateLeft, RotateRight]@coords], and remove it
Clearer code too
 
Change implemented!
 
@AdamDreaver Here's a good one: With[{dirs={North,West,South,East}},Function[t,MapThread[(Turn[#1,t]=#2)&,{dirs‌​,ToExpression["Rotate"<>ToString[t]][dirs]}]]/@{Left,Right}]
 
@Xerxes Looks nice, but I'm getting an error running it
 
7:02 AM
you might need to ClearAll[Turn] first?
 
Ah yes :) I should always do that before running an example
Nope still erroring on me!
MapThread::mptd: "Object dirs‌​ at position {2, 1} in MapThread[(Turn[#1,Left]=#2)&,{dirs‌​,{West,South,East,North}}] has only 0 of required 1 dimensions."
mma v 9
 
oh, I'm getting that thing where the chat puts in extra whitespace
With[{dirs = {North, West, South, East}},
 Function[t,
   MapThread[(Turn[#1, t] = #2) &, {dirs,
     Symbol["Rotate" <> ToString[t]][dirs]}]] /@ {Left, Right}]
 
@Xerxes Thank you for this version as well. Very informative, now let me just cross reference a few parts of it with the doc and I shall grok it well and good.
I'm so grateful, you all opened my eyes to so many possibilities for getting something done in mma.
 
yeah, this place is pretty great; I've been using Mathematica for 15 years, and I've learned a bunch here
 
Wow
15 years is an epic amount of time
 
7:14 AM
haha, it doesn't feel that way, but I guess it is
 
Has wolfram offered you a job yet? :)
 
no, but I did meet him one time in boston
he told me all about alpha over dinner, back before they released it, and let me screw around with the alpha beta on his laptop
 
that is a dream come true from my little chair
awesome, congrats on a out of this world experience
I emailed wolfram as a company, and said, hire more programmers and mma experts. Mma is a product that can serve the world for ages to come if they keep working on it. Making lighter, faster, and add functionality, for both the back and front end
s/making/make it
 
seems like it would be a fun job
 
What's the diff in behavior between Extract and Part? They are behaving the same for my testcases
 
7:24 AM
Extract is sort of the inverse of Position; that is, the output of Position is exactly the input you need for Extract
Part works a bit differently
 
You could use Extract to take parts {1, 2}, {3, 7}, and {1, 1, 4} at once. Try do that with Part
 
compare:
Extract[Array[f, {3, 3}], {1, 2}]
Part[Array[f, {3, 3}], {1, 2}]
Part[Array[f, {3, 3}], Sequence @@ {1, 2}]
 
Part can be used on the lhs. With Part you can use All and Span
and when you do that, the head remains, so h[1, 2, 3][[2;;]] would give h[2, 3]
 
Thank you @Xerxes @Rojo
Well now I know why you used extract with position instead of part, because part can't take a Position.
and there's lots of good corner cases and exceptions, ok I realize how much I don't know. I'm a noob and I admit I'm a noob.
I'm powerless over my noobdem. 1st step to mma mastery :)
 
you can use Part, it's just more painful
With[{list=Range[10]},Part[list,##]&@@@Position[list,_?EvenQ]]
With[{list=Range[10]},Extract[list,Position[list,_?EvenQ]]]
should give the same results
 
7:37 AM
It does and it IS more painful, ouch!
Ok, time to go to bed and allow my memories of this fine education evening to process. Good evening all and I really want to thank you @Xerxes and @Rojo
I've all got all your goody good snippets saved in a notebook, gonna review when I wake up.
 
 
7 hours later…
2:57 PM
Hey, I have a question how i can change Graph layout? For example from Spring to Radial? The thing is I want to change Graph that was generated earlier. I can do it from notebook, but need a function...
 
3:11 PM
@crobartie
mathematica.stackexchange.com/questions/4543/what-is-the-most-convenient-way-to-change-options-for-graph-objects
 
@YvesKlett thnx! :]
 
@crobartie huh the formatting was off (frackin tablet) but that was the second hit for a "graph change" search
 
@YvesKlett SetProperty[graph, GraphLayout -> "RadialEmbedding"] works ok
 
 
1 hour later…
4:31 PM
@rm-rf, around?
 
@Rojo What's up?
 
@rm-rf Hey!
I was thinking, given that current questions suck, to use this time to get acquainted with github
I'm assuming there are simple ways to use it from workbench, right? Any pointers?
 
That gives you some git functionality for WB
 
Wonderful
 
Not sure if it interfaces with github via the API (unlikely), but you can just set the origin manually and use the push/pull/fetch features
Note that I don't actually use this plugin... (tried it a few times, but found switching perspectives, etc. cumbersome)
 
4:36 PM
How do you handle your push pulls etc?
 
mostly the commandline, but sometimes I use a gui (sourcetree for mac)
 
I look forward to the day when we can collaborate easily in some mma projects
 
Thanks, let's see
 
 
2 hours later…
6:26 PM
Do I need to have Java installed on my PC to use the image Uploader palette? I have new PC and this image Uploader is not working. But I do not really want to install Java, worried about viruses.
I am not sure if it needs Java to work. It is not working now. It comes up empty.
May be I'll email Szabolcs to ask him as he wrote it. He will know.
 
@Nasser pinging @Szabolcs will help getting attention :-)
 
thanks. I did not how to "ping" someone. Just writing @ name will "ping" them?
I am new to all this high tech stuff
 
@Nasser yes - if they have been recently in chat (dunno what that actually means).
 
I do not have iphone nor ipad
@Szabolcs I am pining you since I need to ask about your Uploader. Do I need to install Java on my PC for it to run? thanks
 
@Nasser no worries - my first chat was in October :-)
@Nasser the @xyz mechanism also works in comments etc. - you get a notification on top of the SE pages
 
6:43 PM
thanks
 
@Nasser While in chat, someone adressed thusly get also a sound notification, useful especially to mess up any kind of workflow you might be swimming in.
 
Yes, I hear the beep all the time. I leave window open on the chat and I can hear a beep when I am in the kitchen making tea
 
@Nasser there you are :-)
Have a good cuppa (if you are brewing right now)
 
@Nasser Mathematica needs Java to work, so you already have Java. To avoid viruses, just don't enable Java in the browser. Java applets are so 1997 anyway.
 
@OleksandrR. But I do not have Java? THis is a new PC, and I did not install Java. It is not even on my control-panel. May be M uses its own copy of the JRE in its own installation. But I know I did not install Java on the PC itself
 
6:53 PM
@Nasser yes, Mma comes with a JRE, which also includes a couple of files from the JDK. Actually, IMO, you're better off to install your own JRE and disable the one that's provided, since it's so out of date there may be some security implications despite not being accessible by browsers.
 
Ok, But since I do not have Java installed on the PC, do you think that is why Uplaoder is not working? It is looking for the system Java installation (not the one that comes with M) and not finding one?
 
I don't know, as I never used the uploader (I don't post that many images)
 
@Nasser Nope.
Java comes with Mathematica.
Several Mathematica functions use it.
 
@Szabolcs you were serial-editing your last answer - that was fun to watch :-)
 
Bad habits ... I probably won't do it any more now that I know that people watch!
 
6:58 PM
@Szabolcs nono, I was just thinking about a comment and it kept refreshing
 
@Nasser No, the uploader does not require anything special if you already have Mathematica installed. Let me read the backlog ... what is the problem exactly? What do you mean by "not working"?
 
@Szabolcs, it comes up, but blank. I restarted kernel many times, rebooted many times, nothing is working.
I mean, it comes up blank with just the Mathematica logo on the side. I'll make a pic now
 
@Nasser Did you restart the front end too? If you have half an hour, we'll figure it out now. I am interested in what can go wrong, and I want to fix it if I can.
 
I started the kernel. I did not understand what you mean by restarting the FE only. I also restarted M itself many times.
 
@Nasser let's continue here
 
7:05 PM
Btw, I wish you did not put a SPACE in the file name. Becuase spaces can cause problems on Unix like system. May be just SE_Uploader.nb.
Ok, will continue now
 
7:41 PM
Are the talks in berlin gonna be in english?
 
7:58 PM
 
@AdamDreaver ask @halirutan. But I think the answer is probably yes.
 
@OleksandrR. I thought rm was telling me something with the nicht!
 
8:36 PM
Hello, all you friendly Mathematica'icians. I think I am very spoiled by the response rate of Mathematica.SE... I posted a question on stats.SE, the other day, no luck. Mayb one of you can help me? Here is the link: stats.stackexchange.com/questions/50001/…
 
9:01 PM
@halirutan Are you going to need a new topic to speak about now that auto-completion is not configurable in 9.0.1?
 
9:34 PM
any one knows if one is qualified to get 9.0.1 if they have 9.0 without them having a premier service? mine expired after I got 9.0 and now when I login to my portal at WRI I do not see 9.0.1 there to download
is it worth paying $100 to get 9.0.1 if one has 9.0?
 
@Nasser I thought minor/bugfix releases would be available w/o Premier. Why not ask support?
 
Ok, thanks will send email. I assumed if I am qualified for it, it will automatically show on my portal. But it was not, so I assumed I since my premier just expired before 9.0.1 was out I am not. I did not like to bother support. But will send email.
 
Obviously the updates are rolled out with different priorities as well. Single non-premier licenses would figure at the lower end...
 
10:02 PM
@YvesKlett You are smart. Yes, you are right. I just checked my portal now since you said that and found message saying upgrade is available ! I am downloading it now. I did check 2-3 times before. Ok. case closed. thanks.
I am about to install it, but should I uninstall 9.0 first? It says that 9.0 exists and is asking me if I want to overwrite that location? this does not sound right
Will it hurt if I select folder called 9.0.1?
 
@Szabolcs You mean for the MDay in Berlin?
 
Strange also it says "this will install Mathematica 9 on your computer". This is supposed to be "9.0.1"
 
@AdamDreaver Most probably not. I'm pretty sure Leonid will talk in English but the rest not because the audience will be German people.
 
@halirutan Rojer that
 
@AdamDreaver You coming?
 
10:14 PM
@halirutan Nope, I'm English only and was more curious for the next berlin conference.
 
Should I click YES above?
 
@AdamDreaver That's a pity because with Marcus van Almsick and Leonid it's going to be very interesting.
 
@halirutan Thanks mate, indeed it is. Hopefully next time.
I need to learn German anyway; I've always wanted to read Zarathustra in it's native tongue.
 
@halirutan Yes.
@halirutan Are you planning to go to the European Tech Conference in Frankfurt?
 
@Szabolcs No, I'm still speaking about it. Maybe I get some people to call WRI and ask why it is not supported in 9.0.1.
@Szabolcs Never heard about this one. What is it? A conference for teachers?
Ahh
 
10:20 PM
@halirutan I really need to turn off auto-correct in OS X ... wolfram.com/events/technology-conference-eu/2013
@halirutan It looks like I may be able to arrange to be in Frankfurt at the time (for a different visit), but 200E + VAT is too steep for me.
 
@Szabolcs I could pay it from my conference budget but I'm not really sure whether I have time.
 
10:53 PM
Can one Get something that has been DumpSave from free CDF player?
 
Can CDF player DumpSave?
 
@Szabolcs The DumpSaveing I can do it from MMA
Some precalculated stuff that would be nice they can load at Initialization
 
11:07 PM
I'm not sure if this was linked from here before:
It's about what to name the programming language of Mathematica.
 
11:36 PM
@Rojo I don't know if it's possible, unfortunately. You could put the init data in a Compress'd string.
 
11:49 PM
@Szabolcs Brett linked it a few days ago. Personally, I can't see the point in distinguishing between Mathematica itself and its language, unless WRI plans to allow third-party implementations so that it could be used in products that aren't already directly based on Mathematica. And I can't see that happening, considering how aggressively opposed to that they've been up to now.
 
@OleksandrR. There's this quote: " We want to communicate that the language is something that we as a company take responsibility for, but also that it will be very widely and often freely available—and not some kind of rare expensive thing." Not sure what it means.
What I'd love to see is an open specification of the language.
It would force clearing up the dark corners.
But I'm not getting my hopes up.
 
@Szabolcs How about M ?
err in mma spek, M[]
 
@OleksandrR. It's probably related to online.wolfram.com, which was just linked on this site today
@AdamDreaver Actually I'm more interested in where the language will be used outside of Mathematica than the name itself :) But if you ask me, I like M better than Wolfram Language. Probably also better form a marketing point of view not to have "Wolfram" in the name of the pure language
 

« first day (396 days earlier)      last day (4094 days later) »