@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.)
@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.
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
@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. 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
Accidentally 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?
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.
I did this: Turn[orient_,dir_]:=Module[{d=Switch[dir,Left,-1,Right,1],olist={North,East,South,West}},Extract[olist,Mod[Position[olist,orient][[1]]+d,Length[olist],1]]]
not sure that actually turned out shorter or faster than your version; just a difference of style
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 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
@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}]
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."
@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.
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
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.
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...
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.
@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.
@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
@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?
@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"?
@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.
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
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/…
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?
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.
@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
@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.
@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