| bio | website | |
|---|---|---|
| location | China | |
| age | 21 | |
| visits | member for | 7 months |
| seen | Apr 14 at 10:36 | |
| stats | profile views | 4 |
Undergraduate at Tsinghua University with strong interest in mechatronics.
|
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 |
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 |
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 |
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 |
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 |