Timeline for Can I improve this sloppy code used with Manipulate?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 11, 2016 at 13:45 | comment | added | Jack LaVigne |
Re-read the first two paragraphs. The goal of the answer was to generate a symbolic solution so Manipulate would run smoothly.
|
|
May 11, 2016 at 10:26 | comment | added | Alejandro Marcos Aragon |
Jack wi1Fun[{l1x_, l1y_}, {l2x_, l2y_}, {p1x_, p1y_}, {p2x_, p2y_}, {p3x_, p3y_}] := eq1[[2]] doesn't work because it still gives me the solution symbolically. What am I doing wrong?
|
|
May 11, 2016 at 1:27 | comment | added | Alejandro Marcos Aragon | I'll try what you suggest. I think the answers are fine, but the drawing is messed up. I'll try to figure out why. By the way, do you have any tips to add a constraint to Locators? I saw the recommended link and it's Chinese to me. | |
May 10, 2016 at 23:20 | comment | added | Jack LaVigne |
If you want to shorten it you could use something like wi1Fun[{l1x_, l1y_}, {l2x_, l2y_}, {p1x_, p1y_}, {p2x_, p2y_}, {p3x_, p3y_}] := eq1[[2]] rather than the spelled out version. Speed was the original goal. I was unable to move a locator point with your original code. I am able to move a bottom node and an answer is produced. I have no idea if it is correct. I only attempted to speed up your code and made no attempt at understanding it.
|
|
May 10, 2016 at 21:59 | comment | added | Alejandro Marcos Aragon | Thanks for answering! I have a couple of concerns regarding the solution. My main concern is that it seems way too verbose. I understand that solving for the weights outside makes sense to make the dynamic module less heavy, but I'd rather have a shorter code as long as I can visualize the results in real time. Also, I just realized that it doesn't work as expected when I start moving the bottom nodes of the triangle (my version doesn't work either). As long as I move the points that define the line or the upper node it's fine though. | |
May 10, 2016 at 21:24 | history | answered | Jack LaVigne | CC BY-SA 3.0 |