View Full Version : Semi - OT Trig Problem

crews1

06-15-2005, 08:08 PM

Semi - OT because this problem comes from the book 'Machine Shop Trade Secrets' page 272.

"A ten-foot ladder is leaned up against a wall. A two-foot cubic box is placed under the ladder and up against the wall. The angle of the ladder is adjusted so that it is touching the floor, the wall, and the corner of the box. How high up the wall does the ladder touch?"

The answer is given in the Appendix (9.6771 feet) but can anyone explain to me how to arrive at that answer?

Your Old Dog

06-15-2005, 08:37 PM

Math was my greater weakness but that was in the days before affirmative action.

Picturing this in my mind I can see a side view of a square and two triangles. If you know the heigth of the box (it's cubic as phrased in your question) can't you deduce that having it touch the ladder would in affect creat two triangles of which you know two sides of both of them and there by able to compute the third leg? Just asking, there's likely one of those letter answers but I won't be able to follow it LOL

[This message has been edited by Your Old Dog (edited 06-15-2005).]

mochinist

06-15-2005, 08:38 PM

<font face="Verdana, Arial" size="2">Originally posted by crews1:

Semi - OT because this problem comes from the book 'Machine Shop Trade Secrets' page 272.

"A ten-foot ladder is leaned up against a wall. A two-foot cubic box is placed under the ladder and up against the wall. The angle of the ladder is adjusted so that it is touching the floor, the wall, and the corner of the box. How high up the wall does the ladder touch?"

The answer is given in the Appendix (9.6771 feet) but can anyone explain to me how to arrive at that answer?</font>

Two words Auto Cad.

Lol okay now flame me math gurus. http://bbs.homeshopmachinist.net//smile.gif

3 Phase Lightbulb

06-15-2005, 09:02 PM

I'm working on it... I need more information to give you a correct answer.

Looking at the side of the ladder, how wide are the ladder rails? Are they square at the bottom, or are they round? What about the top of the ladder. Is the top rounded, or square? (I.E: Is one corner of the ladder touching the ground, and one corner touching up at the top, or is the ladder pivoting at the bottom?

All of these items affect the rise over run when leaning it.. If it's not specified, I'll assume the ladder has no width and just pivots on an infinitly small radius/point.

-Adrian

crews1

06-15-2005, 09:17 PM

Sorry, but that was all the info that there was.

I *assume* that it isn't a trick question and that the 'ladder' and 'box' are used to make it easier to visualize.

He has a sketch that shows it as a triangle with the hypotenuse of 10 and the 2-foot square at the base.

Paul Alciatore

06-15-2005, 09:21 PM

This one is a classic. Been used more times than I can count. Why? Read on.

http://img.photobucket.com/albums/v55/EPAIII/LadderOnWall.bmp

We are trying to solve for y in the diagram, the distance from the floor to the top of the ladder. We have two unknowns, x and y so we need two independent equations with these variables in order to solve for them.

x^2 + y^2 = 10^2 Obvious Equation 1

Looking at areas we can see that the area of the large triangle is xy/2 and the areas of the smaller triangles are 2(x-2)/2 and 2(y-2)/2 respectively. These quickly reduce to x-2 and y-2. And the area of the square is 2*2 or 4. Since the area of the large triangle is the sum of the areas of the two small triangles and the square, we can say:

xy/2 = (y-2) + (x-2) + 4

Reducing,

xy = 2y - 4 + 2x - 4 + 8

xy = 2y + 2x Equation 2

Working with Equation 2,

xy -2x = 2y

x(y-2) = 2y

x = 2y/(y-2) Equation 3

Plugging the value of x in equation 3 into equation 1 we get

(2y/(y-2))^2 + y^2 = 100

4y^2/(y^2 -4y + 4) + y^2 = 100

Now you have to multiply all terms by the denominator of the first term (y^2 -4y + 4)

4y^2 + y^2(y^2 -4y + 4) = 100(y^2 -4y + 4)

This reduces to:

y^4 - 4y^3 - 92y^2 + 400y - 400 = 0 Equation 4

In short, you have to solve a fourth degree equation for y. That's why it is a classic. Not many people can solve such an equation. Mathematicians can. I did in high school and college and I did this problem about three times in the past but I will pass on the rest now. It isn't fun. It gets really messy. You will get four answers because it is a fourth order equation. If I remember, two are immaginary numbers and the other two are for the ladder at a steep angle and a shallow angle (x and y are swapped).

If anyone wants to complete it, have fun.

Oh, I don't think I have ever seen any shortcuts for this process - except the CAD route which is approximate so in the world of math puzzles it doesn't count.

Paul A.

crews1

06-15-2005, 09:32 PM

Thank you for taking the time to post that detailed explanation. I appreciate it.

3 Phase Lightbulb

06-15-2005, 09:33 PM

I'm inventing a shortcut right now. This might take me awhile. http://bbs.homeshopmachinist.net//smile.gif

C. Tate

06-15-2005, 09:33 PM

Don't take this to your local trig teacher as I cannot verify without my books (can't find them). I am fairly certin you will have to use trigonometric identities to solve this one. You will have to express one of the unknowns as a relationship to the other known values and them solve algebraicly using the trig identities. I will do some research and post later.

CCWKen

06-15-2005, 11:13 PM

Where's Klotz when ya need em? http://bbs.homeshopmachinist.net//biggrin.gif

He's probably reading this and laughing his ass off.

It's a quadratic equation.

See here:

http://mathcentral.uregina.ca/QQ/database/QQ.09.98/blade1.html

3 Phase Lightbulb

06-16-2005, 01:19 AM

Crews1,

I found there were several ways to solve this problem. Google searching was not one of them http://bbs.homeshopmachinist.net//smile.gif

I came up my own equation to calculate the height of the ladder against the wall. This program lets you enter the length of the ladder, and the size of the box. The program calculates how high the ladder will reach on the wall when touching the floor, the box, and the wall at the same time.

My equation comes up with 9.66865 feet. Your result of 9.6771 is .008 taller. I wonder who's method is more accurate.

-Adrian

/*****************************************/

/* */

/* Created 06-15-05: Adrian Michaud */

/* */

/* Ladder and Box Calculation Shortcut */

/* */

/*****************************************/

#include <math.h>

void main(int argc, char **argv)

{

double ladder,box;

if (argc < 3)

{

printf("Usage: ladder height box");

exit(1);

}

sscanf(argv[1], "%lf", &ladder);

sscanf(argv[2], "%lf", &box);

printf("Height of Ladder : %lf feet\n", ladder);

printf("Size of Box : %lf feet\n", box);

printf("Height of Ladder is: %lg feet\n",

cos(atan(box/((ladder-box)-

((sin(atan(box/(ladder-box)))

*ladder)-box))))*ladder);

}

Z:\>cl ladder.c

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86

Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

ladder.c

Microsoft (R) Incremental Linker Version 6.00.8447

Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:ladder.exe

ladder.obj

Z:\>ladder

Usage: ladder height box

Z:\>ladder 10 2

Height of Ladder : 10.000000 feet

Size of Box : 2.000000 feet

Height of Ladder is: 9.66865 feet

Z:\>

[adrian@localhost dev]$ gcc ladder.c -oladder-linux -lm

[adrian@localhost dev]$ ./ladder-linux 10 2

Height of Ladder : 10.000000 feet

Size of Box : 2.000000 feet

Height of Ladder is: 9.66865 feet

[adrian@localhost dev]$

Source Code Link:

http://www.bbssystem.com/ladder/ladder.c

WIN32 .EXE:

http://www.bbssystem.com/ladder/ladder.exe

Linux X86 Binary executable:

http://www.bbssystem.com/ladder/ladder-linux

-Adrian

Link is easier than writing all that stuff here.

I have a question for you Adrian. What are the maximum possible internal angles of an equilateral triangle in spherical trig?

[This message has been edited by Evan (edited 06-16-2005).]

Norman Atkinson

06-16-2005, 02:05 AM

Sorry folks!

Read the question.

What happens when the ladder falls!

There are 2 answers.

Norman

Paul Alciatore

06-16-2005, 02:07 AM

No Evan, it is still a fourth order equation that just happens to be simple enough to be solved by use of the quadratic formula. It will still have four solutions, two of which will be physicially impossible and are thus discarded. These four solutions are listed in the last line.

But I guess it does qualify as a simplification. Although, not many will be clever enough to think of that trick. You only found it with a web search.

Paul A.

Norman Atkinson

06-16-2005, 02:28 AM

Paul,

Agreed but there are only 2 practical answers.

I did this thing when my brain was young- on guard back in 1949!

It appeared as a Christmas Teaser in Model Engineer- many many years ago.

It's rather like the one

If you walk a mile South, then a mile west, and then a mile North you come back to the same place. What is the colour of the animal?

So reverse it, you walk a mile North, and a mile East and a mile South, the colour changes.

So much for a classical education?

Norman

spope14

06-16-2005, 07:12 AM

Why would you put a box under a ladder like that?

ahidley

06-16-2005, 07:18 AM

What if there is a black cat sittin on the box?

Swarf&Sparks

06-16-2005, 07:36 AM

Evan, correct me if I'm wrong but that's 90 for an eq spherical triangle http://bbs.homeshopmachinist.net//biggrin.gif Long time since I dusted off that sextant, but.....

Lin

fencepost

06-16-2005, 08:10 AM

I think it is also important to know:

Exactly what is inside the box?

What is the box made of?

What is the ladder made of?

Whay is the ladder being placed in such a position?

What is the ambient temperature?

What time of day is all of this taking place - don't forget the time zone and is daylight savings time in effect?

Longitude and latitude when this event is taking place?

It seems to me there is a whole lot of information missing rendering the problem down to a best efforts guess.

Okay, too much coffee now. What I need is a donut.

Axel

Swarf&Sparks

06-16-2005, 08:55 AM

And if it's a cat in the box, ask Schrodinger http://bbs.homeshopmachinist.net//biggrin.gif

Norman Atkinson

06-16-2005, 09:06 AM

This Cat. Was it black or was white?

Or was it black and white?

White answers my first question

Black and white answers the last

bit.

Fence post- you were surprisingly correct.

The answers were Zero and Zero

Doesn't the time fly when you are having fun?

Norman

SS,

That's correct. Years ago I wrote a computer program to do line of position sight reductions in a Commodore VIC 20. It included an ephemeris program written from first principles using Kepler's laws of motion and taking in to account the 30 or so significant periodic terms that affect the orbit of earth. I got it down to about 1/2 second accuracy over a decade or so.

It all had to fit in only 4k of ram.

[This message has been edited by Evan (edited 06-16-2005).]

jstinem

06-16-2005, 09:24 AM

Good morning,

Aren't there an infinite number of answers based on the number of ways that the "2 cubic box" could be drawn?

Joe

Norman Atkinson

06-16-2005, 09:30 AM

No Evan, ram is wrong!

The First animal was a bear- a Polar one

The second was a penguin- which was black and white.

The clue was doesn't time fly. referring to the Greenwich meridian- which goes to the Poles.

They are coming to take me away- Ha Ha

Norman

Swarf&Sparks

06-16-2005, 09:36 AM

Gimme a bit of latitude here Norman. Ewe are right, but don't all merdians pass through Poland (?)

But Norman, the real question is what are the internal angles of your triangle?

3 Phase Lightbulb

06-16-2005, 10:48 AM

<font face="Verdana, Arial" size="2">Originally posted by Evan:

Link is easier than writing all that stuff here.

I have a question for you Adrian. What are the maximum possible internal angles of an equilateral triangle in spherical trig?

[This message has been edited by Evan (edited 06-16-2005).]</font>

There is an infinite number. Are you google searching for questions too? We need more thinkers here.

-Adrian

BillH

06-16-2005, 10:56 AM

Just a pythagorem Theorem problem no? just plain ol geometry.

mklotz

06-16-2005, 11:34 AM

No trig in this problem. The relevant equation is indeed a quartic but, with

an inspired substitution, this can be reduced to the solution of two

quadratics.

b = side of box

l = length of ladder

y = height of smallest triangle

x = base of medium sized triangle

Then the base of the large triangle is x+b and its height is y+b.

From similar triangles, we have:

y/b = b/x <=> x*y = b^2 <=> y = b^2/x (1)

Applying Pythagoras to the large triangle:

(x+b)^2 + (y+b)^2 = l^2

or:

x^2 + 2*b*x + b^2 + y^2 + 2*b*y + b^2 = l^2

Substituting y = b^2/x from (1) yields:

x^2 + 2*b*x + b^2 + b^2/x^2 + 2*b*b^2/x + b^2 = l^2 (2)

Now define:

a = x + b^2/x (3)

so:

a^2 = x^2 + 2*b^2 + b^4/x^2

Then (2) becomes:

a^2 + 2*b*a - l^2 = 0

Solve for 'a' using the quadratic formula.

Now substitute a into (3) and solve the resulting quadratic to find x.

a = x + b^2/x (3)

x^2 - a*x + b^2 = 0

The old problem about "a mile south, a mile west, a mile north, back to

starting point - bear color?" is a fascinating one. Few people realize that

there are an infinite number of points on earth that satisfy the criteria.

The north pole is the most obvious one. But consider a latitude circle just

north of the south pole. Imagine that this circle is so placed as to have a

circumference of exactly one mile. If I stand anywhere a mile north of this

circle I can walk a mile south and be on this circle. Walking a mile west (or

east) will take me once around this circle and back to where I started on the

circle. Then walking a mile north will return me to my starting point.

Since there are no bears in Antarctica, there are an infinite number of ways

for the bear color to be indeterminate.

Regards, Marv

Home Shop Freeware - Tools for People Who Build Things

http://www.geocities.com/mklotz.geo

"There is an infinite number."

Wrong answer. There is a maximum limit to the interior angle at the vertices of an equilateral triangle in spherical trig. That maximum is what I asked for.

John Stevenson

06-16-2005, 11:42 AM

Personally I think it's a waste of time.

Whilst you have been working this out I have shifted the ladder and the box and reached up with the fork truck.

Hight up the wall isn't critical as the fork truck is adjustable on hight.

Ipso facto - job done.

hey crews1, nice to meet ya.

take a good look at your problem. if the ladder touches the box, then the angle the ladder makes with the ground will be the same angle it makes with the top of the box.

unless you weigh 400lbs and the ladder bends in the middle. http://bbs.homeshopmachinist.net//smile.gif

do a little trig for both triangles (the one next to the box, and the one on top of the box). you won't be able to figure out the angle just yet, but you'll have two equations for the same angle.

that means one of your unknows (the angle) disappears.

(note that you never really even need to know what the angle is)

now look at the big triangle (ladder, ground and wall).. use the pythag-O theorem now and you'll get an equation with only one unknown.

bet your tailstock it'll be a quadratic equation.

solve it to get the mystery distance.

use that to figure out either how far the bottom of the ladder is away from the wall, or how high the top is from the ground.

-tony

BillH

06-16-2005, 11:59 AM

AH HAH! So thats how the quadratic equation is used in real life! Stupid schools, instead of just teaching math formulas, they need to be teaching how to utilize the math in the real world, students would have an easier time grasping with it.

Paul Alciatore

06-16-2005, 11:59 AM

I think you guys are real good at "thinking out of the box".

Paul A.

so if you were freezing your ass off and starving, 1 mile away from the south pole.. and someone were to tell you that 1 mile east of where you were there is hot food and a warm bed, how many of you would walk a big circle around the south pole? how many of you would walk east and go eat?

-tony

Norman Atkinson

06-16-2005, 12:14 PM

I suspect that there is a more cheating to come.

I am waiting for Allan W. to come in with

mistaking a nun for a penguin in Antarctica.

I heard from him that a terrible mistake happened with a short sighted rapist!

I am awaiting the classical welsh joke about " Don't come down that ladder, I've taken it away" and the reply about being

"Half Way Down"

For my part, thank you for bringing much needed sunshine into my shaded mental ward.

Here comes the matron- She's big, Big, BIG Woman!!

Norman

3 Phase Lightbulb

06-16-2005, 12:15 PM

<font face="Verdana, Arial" size="2">Originally posted by Evan:

"There is an infinite number."

Wrong answer. There is a maximum limit to the interior angle at the vertices of an equilateral triangle in spherical trig. That maximum is what I asked for.</font>

This is the question you asked me (Quoted from your own message)

"I have a question for you Adrian. What are the maximum possible internal angles of an equilateral triangle in spherical trig?"

Apparently you don't even understand your own question. I see this a lot in your questions and answers.

This spherical equilateral triangle has an infinite number of internal angles just as there are an infinate number of arcs.

http://www.bbssystem.com/trig.gif

-Adrian

I didn't state vertices. I assumed incorrectly you would understand that. SS did.

Wirecutter

06-16-2005, 01:08 PM

<font face="Verdana, Arial" size="2">Originally posted by 3 Phase Lightbulb:

My equation comes up with 9.66865 feet. Your result of 9.6771 is .008 taller. I wonder who's method is more accurate.

</font>

Adrian -

In your code, you use the term arctan(box/(ladder-box)) a couple of times. My trig is also a bit rusty, but doesn't this mean you've shortened the segment of the ladder going from the box's corner to the floor? Are you suggesting that this hypoteneus (of the smaller triangle) is the same length as the box side? That would shorten your ladder's reach just a bit.

Flame away, math nerds, while I go check this out.

-M

The spherical equilateral triangle does not have an infinite number of internal angles. It has three only. The definition of internal angle in geometry is "an internal angle is an angle that two sides of a polygon form by touching each other" or "the angle inside two adjacent sides of a polygon".

Wirecutter

06-16-2005, 01:18 PM

<font face="Verdana, Arial" size="2">Originally posted by mklotz:

No trig in this problem. The relevant equation is indeed a quartic but, with

an inspired substitution, this can be reduced to the solution of two

quadratics.

b = side of box

l = length of ladder

y = height of smallest triangle

x = base of medium sized triangle

Then the base of the large triangle is x+b and its height is y+b.

</font>

Marv -

You've confused me. You've assigned x and y, but we already know that they're both 2. Did you mean to say that:

y = height of medium sized triangle

x = base of smallest triangle

????

Eschew obfuscation, dude.

-M

3 Phase Lightbulb

06-16-2005, 01:26 PM

<font face="Verdana, Arial" size="2">Originally posted by Evan:

I didn't state vertices. I assumed incorrectly you would understand that. SS did.</font>

"Wrong answer. There is a maximum limit to the interior angle at the vertices of an equilateral triangle in spherical trig. That maximum is what I asked for."

Sounds like you stated vertices to me from your quote above. Since you claim to understand vertices, it would be interesting to see how you answer a question that will require more knowledge than knowing how to perform a Google search: How does my equation work?

-Adrian

You are talking in circles Adrian.

3 Phase Lightbulb

06-16-2005, 01:33 PM

<font face="Verdana, Arial" size="2">Originally posted by Wirecutter:

Adrian -

In your code, you use the term arctan(box/(ladder-box)) a couple of times. My trig is also a bit rusty, but doesn't this mean you've shortened the segment of the ladder going from the box's corner to the floor? Are you suggesting that this hypoteneus (of the smaller triangle) is the same length as the box side? That would shorten your ladder's reach just a bit.

Flame away, math nerds, while I go check this out.

-M</font>

Wirecutter, I'll explain in detail how my equation works but I don't want to give Evan the answer yet. I'd like to see him anwser something that isn't available from Google http://bbs.homeshopmachinist.net//smile.gif

-Adrian

mklotz

06-16-2005, 01:35 PM

wirecutter,

My writeup is taken from my original solution of this problem. "Small and

medium sized triangle" were based on that problem and so may not correspond

with the diagram here. (I didn't mean to refer to the diagram posted earlier

in the thread.)

All that's really important is the statement:

"Then the base of the large triangle is x+b and its height is y+b."

where the large triangle referred to is the one formed by the ladder, the wall

and the baseline. Derive the meaning of x and y from that statement.

Sorry about the confusion.

Regards, Marv

Home Shop Freeware - Tools for People Who Build Things

http://www.geocities.com/mklotz.geo

Sorry, but I'm not familar with C syntax. I program in machine code, BASIC, Fortran (not for a long time) and POV-RAY Scene Description Language.

Try programming in Brain**** some day. It's very similar to the low level language I used on the Bendix G15

[This message has been edited by Evan (edited 06-16-2005).]

3 Phase Lightbulb

06-16-2005, 01:55 PM

<font face="Verdana, Arial" size="2">Originally posted by Evan:

Sorry, but I'm not familar with C syntax. I program in machine code, BASIC, Fortran (not for a long time) and POV-RAY Scene Description Language.</font>

Here is the equasion:

box = size of Box in feet

ladder = size of Ladder in feet

height=cos(atan(box/((ladder-box)-

((sin(atan(box/(ladder-box)))

*ladder)-box))))*ladder)

cos(), sin() are in radians and atan() returns radians.

-Adrian

BillH

06-16-2005, 02:08 PM

Nice little pissing match you got going.

Ok, how about a new quiz, Using Fortran, C or Java, write a nested loop that calculates pi and terminates once a specific level of precision is reached, i.e., the difference between each iteration of the loop is less than .0001 or so.

Wirecutter

06-16-2005, 02:08 PM

<font face="Verdana, Arial" size="2">Originally posted by 3 Phase Lightbulb:

Wirecutter, I'll explain in detail how my equation works but I don't want to give Evan the answer yet. I'd like to see him anwser something that isn't available from Google http://bbs.homeshopmachinist.net//smile.gif

-Adrian

</font>

Ah, I thought I detected a little needling there... http://bbs.homeshopmachinist.net//wink.gif

Wirecutter

06-16-2005, 02:10 PM

<font face="Verdana, Arial" size="2">Originally posted by Evan:

Try programming in Brainfunk some day. It's very similar to the low level language I used on the Bendix G15

</font>

Is that anything like the joys of Labview when you have an honestly complex task to perform? Those pretty pictures sure get messy.

3 Phase Lightbulb

06-16-2005, 02:17 PM

Or if you prefer X86 machine code:

.file "ladder.asm"

.desc "Ladder and Box Calculator"

.data

.qword temp1,temp2,temp3,result

.text

ladder:

fldl %st(1), 10.000

fldl %st(2), 2.000

fsub %st(1), %st

fdivr %st, %st(1)

fxch %st(1)

fld1; fpatan

fxch %st(1)

fstpl temp1

fstpl temp2

call sin

fmull temp2

fsubr %st, %st(1)

fldl temp1

fsubp %st, %st(2)

fdivp %st, %st(1)

fld1; fpatan

fstpl temp3

call cos

fmull temp2

fstpl result

ret

-Adrian

3 Phase Lightbulb

06-16-2005, 02:30 PM

<font face="Verdana, Arial" size="2">Originally posted by BillH:

Nice little pissing match you got going.

Ok, how about a new quiz, Using Fortran, C or Java, write a nested loop that calculates pi and terminates once a specific level of precision is reached, i.e., the difference between each iteration of the loop is less than .0001 or so.</font>

Here is my PI calculator.. Calculates PI out to 800 decimal places:

/* Calculate PI */

#define SHIFT_ACC 10000

#define SHIFT_LUT 2800

int main(void)

{

int grad=0;

int mant=0;

int base=0;

int divshift=0;

int accum=SHIFT_ACC;

int radi=SHIFT_LUT;

int lut[SHIFT_LUT+1];

while(base-radi)

lut[base++]=accum/5;

while(grad=radi*2)

{

for(base=radi;divshift+=lut[base]*accum,lut[base]=(divshift%--grad),

divshift /= grad--,--base;divshift*=base);

radi-=14;

printf("%.4d", mant + (divshift/accum));

mant = (divshift%accum);

}

}

Here is the output:

3.14159265358979323846264338327950288419716

9399375105820974944592307816406286208998628

0348253421170679821480865132823066470938446

0955058223172535940812848111745028410270193

8521105559644622948954930381964428810975665

9334461284756482337867831652712019091456485

6692346034861045432664821339360726024914127

3724587006606315588174881520920962829254091

7153643678925903600113305305488204665213841

4695194151160943305727036575959195309218611

7381932611793105118548074462379962749567351

8857527248912279381830119491298336733624406

5664308602139494639522473719070217986094370

2770539217176293176752384674818467669405132

0005681271452635608277857713427577896091736

3717872146844090122495343014654958537105079

2279689258923542019956112129021960864034418

1598136297747713099605187072113499999983729

7804995105

BillH

06-16-2005, 02:39 PM

I'll take your word that it works Adrian, ok, now show me assembly code to make a Stepper motor driver using an Atmel microcontroller. http://bbs.homeshopmachinist.net//smile.gif

Oh and btw, you didnt show source to the #defines you made.

[This message has been edited by BillH (edited 06-16-2005).]

3 Phase Lightbulb

06-16-2005, 02:46 PM

<font face="Verdana, Arial" size="2">Originally posted by BillH:

I'll take your word that it works Adrian, ok, now show me assembly code to make a Stepper motor driver using an Atmel microcontroller. http://bbs.homeshopmachinist.net//smile.gif</font>

Sure.. This will only take a few minutes. First, pick one of the Atmel AVR processors that you would like to me write the code for.

Here is a list of processors and microcontrollers that I currently write machine code/assembly language for:

http://www.gnuxtools.com/processors.html

Go down to the avr family, and pick the Atmel controller you want me to target.

<font face="Verdana, Arial" size="2">Originally posted by BillH:

Oh and btw, you didnt show source to the #defines you made.

[This message has been edited by BillH (edited 06-16-2005).]</font>

Which #define are you refering to? They are all there...

-Adrian

BillH

06-16-2005, 03:46 PM

LOL Adrian, well Im thinking of getting an Atmel STK 500 developement board and learning to program these microcontrollers, always been a thorn in my side that I didnt know how to do for so many ideas I get in my head.

I dont even know which Atmel is appropriate for it, I just downloaded WinAVR to try out the IDE and simulate some stuff, I got your #defines mixed up with includes, havent had C since high school, just finished Java at college.

I've been toying with making a CNC router, and discussed steppers with Ibew before, my newest idea is to make a CNC scriber, you know for layout work, as a learning expirience for all of the above and learning to setup EMC to drive it.

<font face="Verdana, Arial" size="2">

height=cos(atan(box/((ladder-box)-

((sin(atan(box/(ladder-box)))

*ladder)-box))))*ladder)

</font>

Bracket mismatch.

3 Phase Lightbulb

06-16-2005, 04:04 PM

<font face="Verdana, Arial" size="2">Originally posted by Evan:

Bracket mismatch.</font>

The last bracket is not needed. It was from the printf( ... :

height =cos(atan(box/((ladder-box)-

((sin(atan(box/(ladder-box)))

*ladder)-box))))*ladder;

-Adrian

Last Old Dog

06-16-2005, 05:22 PM

Evan,

I programmed for years. Unix, FORTRAN, COBOL, ADA for DOD, FORTH, a dozen Basics, Pascal, Delphi sheesh. But my downfall was Assembly Language for Logical Systems Inc, the 6502, 68xxx Motorolas, Honeybucket (Honeywell), TI Minis TX5 DX10, then 8086, through the 486. All for motion control and process control. Even to writing ‘catastrophic event’ simulators for control room operator trainees. I am convinced all this contributed to burn-out then the current insidious onslaught of ‘brain rot’.

No longer though, no more bit twiddling, no more libraries. Never again will I have to check the carry flag after shifting left, no more long distance jumps, no more double indirect addressing. No more expletives followed by a ‘Halt - Reset - Load’ front panel sequence. Then, punching in 16 bit instructions to spark up the machine. Now I am free . . . you hear free . . .FREEEEEE.

Time for my meds.

Norman Atkinson

06-16-2005, 05:37 PM

When you lot are finished, could I have either the ladder or the box back?

My incontinence pads are on the top shelf.

Here's Matron. She's a big woman, Big, BIG.

If she stands more on her tip toes at an an angle of 30 degrees, I can see right up her...........

No , Matron NO!

Norman

Your Old Dog

06-16-2005, 05:42 PM

My head hurts.

spkrman15

06-16-2005, 06:11 PM

Wow. I can't beleive we got all these posts about a ladder. I love the questions though! I also like how no one has showed their work yet.

Alot of talk / no action! Makes me feel like i am at work. Everyone arguing about how it should be done...all the while, it could have been finished!

Just teasing!

Rob http://bbs.homeshopmachinist.net//smile.gif

3 Phase Lightbulb

06-16-2005, 06:19 PM

I think there is a lot of panic google searching going on right now. http://bbs.homeshopmachinist.net//smile.gif

-Adrian

Sorry, it's been a very busy day at my store. I stayed after a few minutes to have a whack at it. I am not sure I follow your logic completely but this is what I came up with.

ladder=10, box=2

a=ladder-box : 8

b= atan(box/a) : Approximate difference of the tangent of the angle of ladder/wall and angle if box were tangent. Assume difference is equal to ratio of difference of box to ladder. Find that angle. 0.245

c=sin(b)*ladder : Find sine of that angle and scale it to approximate tangent. 2.4254

cos(atan(2 / (a - (c * 10) - box)))) * 10

cos(atan(2 / (a - (2.4254 - box)))) * 10 : subtract box from tangent

cos(atan(box / (a - .24245))) * 10 : subtract difference of box and tangent from ladder-box

cos(atan(box / 7.75746)) * 10 : take out box

cos(atan(.2576)) * 10 : Find angle

cos(.2521) * ladder :Cosine is height, scale it with ladder.

bob_s

06-16-2005, 08:02 PM

It is simple.

Height that ladder reaches on the wall = y

distance of base of ladder from wall = 2+x

Length of ladder = 10

Inclination angle of ladder = a

tan(a)= y/(2+x)= 2/x ---> y = 4/x + 2 {1}

Pythagorus 100 = y^2 + (2+x)^2 {2}

substitute {1} --> {2}

result F(x)= 0 = x^4 +4x^3 -92x^2 +16x +16

derivative = 4x^3 +12x^2 -184x +16 = F`(x)

evaluate F(x) for x=0 F(0)=16

evaluate F(x) for x=1 F(1)=-55 F`(1)=-152

Iteratively solve using

xnew = xold - F(xold)/F`(xold)

Continue until F(xnew) = 0

6 iterations to reach result

xnew = .521036705806472

y = 4/xnew +2 = 9.6770023213791

regards

bob

Wirecutter

06-16-2005, 08:25 PM

<font face="Verdana, Arial" size="2">Originally posted by NORMAN ATKINSON:

When you lot are finished, could I have either the ladder or the box back?

My incontinence pads are on the top shelf.

Here's Matron. She's a big woman, Big, BIG.

If she stands more on her tip toes at an an angle of 30 degrees, I can see right up her...........

No , Matron NO!

Norman</font>

Ah yes. Kinda like using binoculars to stare at the sun, huh?

3 Phase Lightbulb

06-16-2005, 10:36 PM

Evan, this might clear things up..

http://www.bbssystem.com/ladder/solveA.gif

This is how my equation works.

ladder = 10.0

box = 2.0

The base angle from the corner of the box to the top of the ladder is calculated:

angle = atan(box / (ladder-box))

This angle is represented by the BLUE line in the diagram.

Notice the BLUE line now lifts off the floor. It's placed on the wall at the (10' ladder mark). We now need to calculate how much to lower the blue lines pivot point in order to touch the ground, the box, and the wall.

I figured out that the distance 'A' in the diagram is my "shortcut". So lets calculate the distance 'A':

offset = sin(angle) * ladder

'offset' is now the distance from the 'A' endpoint from the wall. We now need to subtract the size of the box to get the value of 'A':

A = offset - box;

'A' now contains the distance between the end of the blue line, and the box.

We now recalculate the angle by dropping the blue line down to the location of the RED line using the 'A' offset:

newAngle = atan(box/(ladder-box) - A)

This new angle is represented by the RED line in the diagram.

Now that we know the correct angle to touch the floor, the box, and the wall, just calculate the ladders height at this new angle:

height = cos(newAngle) * ladder;

My "shortcut" needs a small scaling factor correction that is based on the ratio of the box size and the length of the ladder. I have not figured out the scaling equation that needs to be applied to 'A' in order to make the new angle calculation perfect, but it's a linear equation so maybe someone else wants to improve my Ladder and Box shortcut equation.

-Adrian