Manishearth
Reputation
Next privilege 250 Rep.
11
Impact
~2k people reached

• 0 posts edited

# 34 Actions

 Dec 19 awarded Popular Question Aug 15 asked EquationTrekker-like behavior for state space? Jan 31 awarded Citizen Patrol Jan 16 comment How can I simulate this toggle mechanism? I think you first have to choose the length of the rod so that it fits in the distance between the two centers, and subsequently use trigonometry to calculate the position of the point on the lower circle. Jan 3 awarded Talkative Dec 17 accepted How should I go about writing more functional and list based code? Dec 17 comment How should I go about writing more functional and list based code? @rm-rf Yep, it is. Hadn't looked at the second answer, and it is really relevant. Thanks :) Dec 17 comment How should I go about writing more functional and list based code? Hmm, this is interesting :) I haven't used Fold much but I can see how it would be useful here. (Also, I don't "come from" Lisp, I just am comfy with it but I am much more at ease with procedural things). Dec 17 comment How should I go about writing more functional and list based code? @Nasser Thing is, I am reasonably comfortable with Lisp. But Mathematica has its own style, and the problems faced are different. Plus, there are many in-built commands that work well with functional programming or lists. Dec 17 asked How should I go about writing more functional and list based code? Nov 4 awarded Commentator Nov 4 awarded Teacher Oct 30 comment Writing NDSolve-like functions Oh wait, nevermind. It's only being used on the symbol inputs, now I think I got it. Thanks :) Oct 30 comment Writing NDSolve-like functions Ah, thanks. Why does it work in this case though? When I try t = 5; Print[t]; Block[{t}, Print[t]; t = 6;]; Print[t], the t in the block is taken as a fresh variable. Whereas here it seems to be substituted in from the outside. Oct 30 comment Writing NDSolve-like functions It seems to work both ways, though. What's the difference? Is it preventing the variables from messing with outside variables? Oct 30 comment Writing NDSolve-like functions Thanks! I didn't know about SetAttributes, (or Block, I've been using Module which is lexical.), which must be where I went wrong. I also didn't know about the ability to use lists in the function declaration itself. I think that there may be a syntax error here, though, the t,xvar,yvar shouldn't be in the Block statement. Not sure. Oct 30 accepted Writing NDSolve-like functions Oct 29 revised Writing NDSolve-like functions added 153 characters in body Oct 29 comment Writing NDSolve-like functions @rm-rf Well, if that can be genericized I don't mind, but when I use this set of code I usually don't need much of a range for t -- in fact, none at all. I'll add that bit, though. Oct 29 revised Writing NDSolve-like functions added 50 characters in body