23 reputation
5
bio website
location China
age 22
visits member for 1 year, 11 months
seen Apr 14 '13 at 10:36

Undergraduate at Tsinghua University with strong interest in mechatronics.


Oct
4
awarded  Commentator
Oct
4
awarded  Scholar
Oct
4
accepted Confusing ReplaceRepeated & Hold
Oct
4
comment Confusing ReplaceRepeated & Hold
Yes exactly(although I figured out the vector-scalar relationship earlier myself earlier). You made it clear without doubt.
Oct
4
awarded  Supporter
Oct
4
comment Confusing ReplaceRepeated & Hold
Oh... So I could just write procedural code as I'm used to. I thought it has to be purely functional!
Oct
4
comment Confusing ReplaceRepeated & Hold
@J.M. And yes--since I'm just starting, I am very concerned with writing proper, idiomatic code that resemble mathematical/pragmatic notation as much as possible...
Oct
4
comment Confusing ReplaceRepeated & Hold
Hmm I think I get the idea about how and why Hold[] works now. I don't really like the idea of injecting syntactic noise into mathematical notation, so could you please suggest a way I could rewrite the code in a more idiomatic way?
Oct
4
revised Confusing ReplaceRepeated & Hold
deleted 99 characters in body
Oct
4
comment Confusing ReplaceRepeated & Hold
@Mr.Wizard Umm... I think the order of replacement might matter if I just apply it once?
Oct
4
comment Confusing ReplaceRepeated & Hold
@J.M. Oops I didn't know it. Thanks for the tip(although it probably didn't matter in this example)
Oct
4
comment Confusing ReplaceRepeated & Hold
Yes I have already figured out that OP-v1 expanded first to {_,_}-v1 then {_-v1,_-v1}, before v1 even got expanded, where the - was understood as operation between vector and scalar, all while I really mean to "expand both OP and v1 before applying the vector difference"...
Oct
4
awarded  Editor
Oct
4
awarded  Student
Oct
4
comment Confusing ReplaceRepeated & Hold
@J.M. I think replacing all rules to assignments will do. I'm basically just simulating "intermediate variables" I got so used to before the transition to Mathematica.
Oct
4
revised Confusing ReplaceRepeated & Hold
added 631 characters in body
Oct
4
comment Confusing ReplaceRepeated & Hold
@Mr.Wizard should I write the expression in a procedural form(C-like)?
Oct
4
comment Confusing ReplaceRepeated & Hold
@rm-rf okay I'm not quite familiar with the procedures here... I'll do right away
Oct
4
asked Confusing ReplaceRepeated & Hold