<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><p class="MsoNormal">Hi Mark,<span></span></p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal">Again, congratulations for completing challenge2 and thanks
for sharing in your approach using PointPlotter in C++ code just to get
practise in Classes. The attachments are impressive.<span></span></p>
<p class="MsoNormal">Along the same lines, I\u2019m using both <b>C programming</b> (in
a tiny $6.00 development board) and <b>Pascal</b>, the programming language of
Delphi, to solve challenges before posting. This has helped in getting the cobwebs out and in learning
something new. So, from that perspective one of the objectives of proposing \u201cchallenges\u201d
has been achieved.<span></span></p><p class="MsoNormal"><br></p>
<p class="MsoNormal">George, thanks for your comment. I tend to agree with you
that Challenge 2 gives the impression (possible poor presentation) that it
involves CNC. In reality CNC is not required to solve Challenge 2. It\u2019s all beautiful
coding. However, for output #10/11 it does require solving a \u201cquadratic
equation\u201d which may bring fond memories of grade 11 math or maybe not. In
programming it\u2019s difficult to avoid using mathematics to solve real problems. Look
at Deid\u2019s ultrasonic project. Part of his project required the measurement of
time of a reflected sound wave to reach the point of origin. An equation relating
time to the speed of sound at room temperature.<span></span></p><p class="MsoNormal"><br></p>
<p class="MsoNormal">For those of you who are stuck on output#10, see attachment.
If you are edging in getting started, the coding for challenge 2 will flow more
quickly than it did in challenge 1. Straight few lines of code for most of the outputs.<span></span></p>
<p class="MsoNormal">Happy Coding,<span></span></p>
<p class="MsoNormal">Jim<span></span></p></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Nov 15, 2020 at 11:12 AM Mark G. <<a href="mailto:vpm@palaceofretention.ca">vpm@palaceofretention.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thanks Jim.<br>
<br>
I rechecked my formulas and found an errant factor<br>
of 2 in my calculation of the a value (not acceleration)<br>
for the ax^2 + bx + c equation.<br>
<br>
Re-running:<br>
<br>
$ echo 33009 9002 11 | ../bin/cnc<br>
Input:<br>
RegP: 33009 bits: 1000000011110001<br>
RegM: 9002 bits: 0010001100101010<br>
RegS: 11 bits: 00001011<br>
Output #1: 241 (position) bits: 11110001<br>
Output #2: 35 (velocity) bits: 00100011<br>
Output #3: 2 (accel.) bits: 00000010<br>
Output #4: 10 (time) bits: 00001010<br>
<br>
Error status:<br>
Position error.<br>
Velocity ok.<br>
Acceleration error.<br>
Time error.<br>
<br>
Error corrected:<br>
Output #5: 240 (position) bits: 11110000<br>
Output #6: 35 (velocity) bits: 00100011<br>
Output #7: 10 (accel.) bits: 00001010<br>
Output #8: 9 (time) bits: 00001001<br>
<br>
Error status:<br>
Position ok.<br>
Velocity ok.<br>
Acceleration ok.<br>
Time ok.<br>
<br>
Output #9:<br>
Travel time t: 6.93 (s)<br>
final velocity v: 69.28 (cm/sec)<br>
<br>
Output #10:<br>
Testung t1 solution 1: 5.68 (s)<br>
Invalid t2 with t1 solution 1: -2.36<br>
trying t1 solution 2: 1.32 (s)<br>
Valid t2 with t1 solution 2: 6.36 (s)<br>
<br>
Solution t1: 1.32 (s)<br>
Solution t2: 6.36 (s)<br>
<br>
Output #11:<br>
Solutions involving a negative amount for t2 are not<br>
physically possible without time travel.<br>
<br>
===========<br>
<br>
I wrote the program in C++, using a class named PointPlotter<br>
and a main program, just to get practice using classes in<br>
C++.<br>
<br>
Mark<br>
<br>
<br>
<br>
On 2020-11-15 12:25 a.m., James Briante wrote:<br>
> Hi Mark,<br>
> <br>
> Congratulations for 100% on Challenge 2 (Bonus helped!)<br>
> <br>
> I\u2019ve used your times for (t_1 , t_2 ) to compute total distance covered.<br>
> <br>
> P = 2p_1 + p_2<br>
> <br>
> = at_1 ^2 + vt_2 , using your values gives<br>
> <br>
> = 10(1.17)^2 + 35(6.66)<br>
> <br>
> = 246.789, past desired position (p =240)<br>
> <br>
> Check your solution to the quadratic equation.<br>
> <br>
> Jim<br>
> <br>
> <br>
> <br>
> On Sat, Nov 14, 2020 at 9:29 PM Mark G. <<a href="mailto:vpm@palaceofretention.ca" target="_blank">vpm@palaceofretention.ca</a> <br>
> <mailto:<a href="mailto:vpm@palaceofretention.ca" target="_blank">vpm@palaceofretention.ca</a>>> wrote:<br>
> <br>
> Hi Jim,<br>
> <br>
> Thanks for the corrections. Here are my updated results<br>
> with some trial solutions for outputs 9 and 10.<br>
> I differ in output 10.<br>
> <br>
> $ echo 33009 9002 11 | ../bin/cnc<br>
> Input:<br>
> RegP: 33009 bits: 1000000011110001<br>
> RegM: 9002 bits: 0010001100101010<br>
> RegS: 11 bits: 00001011<br>
> Output #1: 241 (position) bits: 11110001<br>
> Output #2: 35 (velocity) bits: 00100011<br>
> Output #3: 2 (accel.) bits: 00000010<br>
> Output #4: 10 (time) bits: 00001010<br>
> <br>
> Error status:<br>
> Position error.<br>
> Velocity ok.<br>
> Acceleration error.<br>
> Time error.<br>
> <br>
> Error corrected:<br>
> Output #5: 240 (position) bits: 11110000<br>
> Output #6: 35 (velocity) bits: 00100011<br>
> Output #7: 10 (accel.) bits: 00001010<br>
> Output #8: 9 (time) bits: 00001001<br>
> <br>
> Error status:<br>
> Position ok.<br>
> Velocity ok.<br>
> Acceleration ok.<br>
> Time ok.<br>
> <br>
> Output #9:<br>
> Travel time t: 6.93 (s)<br>
> final velocity v: 69.28 (cm/sec)<br>
> <br>
> Output #10:<br>
> Testung t1 solution 1: 12.83 (s)<br>
> Invalid t2 with t1 solution 1: -16.66<br>
> trying t1 solution 2: 1.17 (s)<br>
> Valid t2 with t1 solution 2: 6.66 (s)<br>
> <br>
> Solution t1: 1.17 (s)<br>
> Solution t2: 6.66 (s)<br>
> <br>
> Output #11:<br>
> Solutions involving a negative amount for t2 are not<br>
> physically possible without time travel.<br>
> <br>
> <br>
> <br>
> On 2020-11-12 8:00 p.m., James Briante wrote:<br>
> ><br>
> ><br>
> > Mark -a big thanks for pointing out the errors! v & t in the<br>
> > Callenge2.pdf are typing errors. I should have included the actual<br>
> > output screen (see attachment) with the other files. I've blacked<br>
> out<br>
> > the answer to Output #11.<br>
> ><br>
> > Things have been quiet on project talk re: challenge 2. Could these<br>
> > errors be the reason?<br>
> ><br>
> > I don't have a read on what I should do for output #10. Should I<br>
> provide<br>
> > the solution to the quadratic equation?<br>
> ><br>
> > Jim<br>
> ><br>
> ><br>
> > On Wed, Nov 11, 2020 at 5:09 PM Mark G. <<a href="mailto:vpm@palaceofretention.ca" target="_blank">vpm@palaceofretention.ca</a><br>
> <mailto:<a href="mailto:vpm@palaceofretention.ca" target="_blank">vpm@palaceofretention.ca</a>><br>
> > <mailto:<a href="mailto:vpm@palaceofretention.ca" target="_blank">vpm@palaceofretention.ca</a><br>
> <mailto:<a href="mailto:vpm@palaceofretention.ca" target="_blank">vpm@palaceofretention.ca</a>>>> wrote:<br>
> ><br>
> > Hi Jim,<br>
> ><br>
> > I've completed up-to output #8 of the challenge and have<br>
> > some discrepancies with your challenge specification.<br>
> > Specifically, velocity/acceleration error switch, differing<br>
> > values for uncorrected time (t) and velocity (v).<br>
> ><br>
> > Your values:<br>
> > Input Data: 33009,9002,11 (initial values - RegP, RegM, RegS)<br>
> > Output #1: 241 (value of p, transferred from RegP)<br>
> > Output #2: 186 (value of v, transferred from RegM)<br>
> > Output #3: 10 (value of a, transferred from RegM)<br>
> > Output #4: 220 (value of t, transferred RegM)<br>
> > <br>
> --------------------------------------------------------------------------------<br>
> ><br>
> > Output # 5 to #8 \u2013 values of p, v, a, and t with corrections<br>
> > <br>
> --------------------------------------------------------------------------------<br>
> ><br>
> > Output #5: 240 (p)<br>
> > Output #6: 35 (v)<br>
> > Output #7: 10 (a)<br>
> > Output #8: 9 (t)<br>
> ><br>
> > My values:<br>
> ><br>
> > $ echo 33009 9002 11 | ../bin/cnc<br>
> > Input:<br>
> > RegP: 33009 bits: 1000000011110001<br>
> > RegM: 9002 bits: 0010001100101010<br>
> > RegS: 11 bits: 00001011<br>
> > Output #1: 241 (position) bits: 11110001<br>
> > Output #2: 35 (velocity) bits: 00100011<br>
> > Output #3: 2 (accel.) bits: 00000010<br>
> > Output #4: 10 (time) bits: 00001010<br>
> > Position error.<br>
> > Velocity ok.<br>
> > Acceleration error.<br>
> > Time error.<br>
> > Error corrected:<br>
> > Output #5: 240 (position) bits: 11110000<br>
> > Output #6: 35 (velocity) bits: 00100011<br>
> > Output #7: 10 (accel.) bits: 00001010<br>
> > Output #8: 9 (time) bits: 00001001<br>
> > Position ok.<br>
> > Velocity ok.<br>
> > Acceleration ok.<br>
> > Time ok.<br>
> ><br>
> > What do you think?<br>
> ><br>
> > Mark<br>
> ><br>
> > --<br>
> > Projects mailing list<br>
> > <a href="mailto:Projects@vicpimakers.ca" target="_blank">Projects@vicpimakers.ca</a> <mailto:<a href="mailto:Projects@vicpimakers.ca" target="_blank">Projects@vicpimakers.ca</a>><br>
> <mailto:<a href="mailto:Projects@vicpimakers.ca" target="_blank">Projects@vicpimakers.ca</a> <mailto:<a href="mailto:Projects@vicpimakers.ca" target="_blank">Projects@vicpimakers.ca</a>>><br>
> > <a href="http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca" rel="noreferrer" target="_blank">http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca</a><br>
> ><br>
> ><br>
> <br>
> -- <br>
> Projects mailing list<br>
> <a href="mailto:Projects@vicpimakers.ca" target="_blank">Projects@vicpimakers.ca</a> <mailto:<a href="mailto:Projects@vicpimakers.ca" target="_blank">Projects@vicpimakers.ca</a>><br>
> <a href="http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca" rel="noreferrer" target="_blank">http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca</a><br>
> <br>
> <br>
-- <br>
Projects mailing list<br>
<a href="mailto:Projects@vicpimakers.ca" target="_blank">Projects@vicpimakers.ca</a><br>
<a href="http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca" rel="noreferrer" target="_blank">http://vicpimakers.ca/mailman/listinfo/projects_vicpimakers.ca</a><br>
</blockquote></div>