We help IT Professionals succeed at work.

# have x(b) to find b(x)...

on
Can you rewrite:

x=x(b)= h*tan(b)-(r/cos(b))+r

as b(x)=...

r and h are constants.

Thank you.

Comment
Watch Question

## View Solutions Only

Analyst Programmer
Commented:
Let us say S = sin(b), C = cos(b).

x = h*tan(b) - r/cos(b) + r
=> x = h*S/C - r/C + r
=> C(x-r) + r =  h*S
=> C^2 (x-r)^2 + 2r(x-r) C + r^2 = h^2(1-C^2)                             // square both side, and use S^2 + C^2 = 1
=> C^2 [(x-r)^2 + h^2] + 2r(x-r) C + (r^2-h^2) = 0

Solving the equation using quadratic formula, the roots of C are:

C = [-2r(x-r) + sqrt(4r^2(x-r)^2-4[(x-r)^2+h^2](r^2-h^2))]/(2[(x-r)^2 + h^2])
= [-r(x-r) + sqrt(-h^2r^2+(x-r)^2h^2+h^4]/[(x-r)^2 + h^2]
= [-r(x-r) + h sqrt((x-r)^2+h^2-r^2]/[(x-r)^2 + h^2]
and

C = [-2r(x-r) - sqrt(4r^2(x-r)^2-4[(x-r)^2+h^2](r^2-h^2))]/2*[(x-r)^2 + h^2]
= [-r(x-r) - sqrt(-h^2r^2+(x-r)^2h^2+h^4]/[(x-r)^2 + h^2]
= [-r(x-r) - h sqrt((x-r)^2+h^2-r^2]/[(x-r)^2 + h^2]

So you can deduce:

b = ArcCos([-r(x-r) + h sqrt((x-r)^2+h^2-r^2]/[(x-r)^2 + h^2])

and

b = ArcCos([-r(x-r) - h sqrt((x-r)^2+h^2-r^2]/[(x-r)^2 + h^2])
student

Commented:
Look at the bottom of the discussion at
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html
The equation should have been
x = h*tan(b) + r/cos(b) - r

So once we get pkwan's corrected equation. We can plug it into our function for "a" and then we will have the long sought after  "a" as a function of "x"  . Wow! It is going to be a complicated equation.
Database and Application Developer

Commented:
:rrz@871311,

I guess based on the information given to pkwan, he has done his magic and the answer should be accepted. I guess I will post a new question asking for his help after we first discuss a point.

Looking at the attached graph, I guess you are accepting (eq. 1) and possibly you are rejecting (eq. 2). What is wrong with (eq. 2)? I find it to be correct. If you have a simpler one to replace it, it will be nice to show what it is and how you derive it?

Thank you,

Mike
drum-1.png
Database and Application Developer

Commented:

a =a(x,b)= (1/r)*sqrt((h + rsin(b))^2 + (x + r - rcos(b))^2) - b-h/r         (eq.1)
x=x(b)=r (cos(b)+ tan(b)sin(b)-1)+ tan(b)h                                           (eq. 2)
student
Commented:
Here are the two equations that I think we should be using.
a = (r *tan(b) + h/cos(b) - h)/r - b
x = h*tan(b) + r/cos(b) - r

Derivation of first:
Look at your graph right above here
Length of orange+red+purple = Length of green line = h + r*(a + b)
and your graph at
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html?cid=748#a36323336
Length of green line = r*tan(b) + h/cos(b)
Equating the two
h + r*(a +b) = r*tan(b) + h/cos(b)
a = (r *tan(b) + h/cos(b) - h)/r - b

Derivation of second:
You derived it at
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html?cid=748#36323401
I made a correction to right below it at
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html?cid=748#36323575
Again look at your graph at
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html?cid=748#a36323336
The bottom of the yellow triangle(with one hash mark) = r/cos(b)
The bottom of the blue triangle(with two hash marks) = h*tan(b)
Therefore the horizontal distance
from center of drum to the  pulling point(bottom of green line) = r/cos(b) + h*tan(b)
Looking at your graph right above here, we can see that same horizontal distance = r + x
Finally we have
x + r = r/cos(b) + h*tan(b)

If I haven't made any errors and you agree with my derivation, then please create one of your good looking graphs to show all this clearly.  I am sorry that it has taken so long to get to this point. It seems so clear now.

Ok, if pkwan will produce "b" as a function of "x" from
x = h*tan(b) + r/cos(b) - r
we will plug it into
a = (r *tan(b) + h/cos(b) - h)/r - b
and put that mess into our java code to see what comes out.  Or if
http://www.wolframalpha.com/
will graph it for us that would be great.
student

Commented:
If you make a new graph, then change the way you illustrate the rope. It would more clear to have the orange segment followed by the purple segment followed by the red segment. Even better, just show the r*(a+b) rope segment in one color followed by the original rope segment in another color.  As the pulling progresses the drum rotates and the point of contact moves up simultaneously, so the segment of rope that comes off the drum is made from both. I look at it as some unwinding and some unwrapping.
Database and Application Developer

Commented:
As I am going through your post one item at a time:

r:> a = (r *tan(b) + h/cos(b) - h)/r - b

I can see how you got this and it is brilliant.
---------------
re:> ((x+d)/rTan(b)) = h/r

I think this should be

((x+d)/rTan(b)) = (h+k)/r

You have switched from one version (left below) of blue triangle to the other one (right below). See the graph below for k and d.

Unfortunately, my last attempt in deriving x =h*Tan(b) - (r/cos(b)) +r had the same problem.

I will read the rest of the post and also wait for your response for the second item here.

Regards,

Mike

drum-3.png
Database and Application Developer

Commented:
re: It would more clear to have t...

I just saw your post on this. Yes it is good idea and I will show r(a+b) together at the top in same color.

Mike
student

Commented:
Forget about d and k.  Just use my derivation that I gave using the horizontal additions.
Database and Application Developer

Commented:
re:> x + r = r/cos(b) + h*tan(b)

Wow, this is real nice.
Database and Application Developer

Commented:
ok, i will make the graph and the rest.

thx
Database and Application Developer

Commented:
again with x + r = r/cos(b) + h*tan(b)

This x has a moving origin. This cannot be. the origin of x has to be r distance to the right from the center line of the drum.

Sorry for this set back.

Mike
student

Commented:
>the origin of x has to be r distance to the right from the center line of the drum
Yes.
>This x has a moving origin.
No.  You said that "r" is a constant for each animation.
Database and Application Developer

Commented:
on the graph above x shown with two dashes has moving origin as the string is pulled.
student

Commented:
x = 0 at the point where the rope started before being pulled. You have x mislabeled  in the right-hand graph above here.
Database and Application Developer

Commented:
the following equation is good one because it doesn't refer to x:

a = (r *tan(b) + h/cos(b) - h)/r - b

We need to fix string origin to zero where it is pulled zero inch.
Database and Application Developer

Commented:
brb
student

Commented:
In the left-hand graph, you have it correct.
x=0 where the rope starts.
The drum is located at  x = - r   and  y = h
student

Commented:
>We need to fix string origin to zero where it is pulled zero inch.
It has been there all along.
>brb
What does that mean?
student

Commented:
rrz>You have x mislabeled  in the right-hand graph above here.
That where you got confused. The bottom of that triangle should have labeled  h*tan(b)
Database and Application Developer

Commented:
rrz@871311,

I agree and very much like  a = (r *tan(b) + h/cos(b) - h)/r - b

But, I don't see how you get this one:

x + r = r/cos(b) + h*tan(b)

Could you please, in reference to the graph below, make your case? I know you have patiently done this a few times but I thing there is something illusive causes the problem going back and fort from one graph to another.

thanks.
Cam-3.png
Database and Application Developer

Commented:
wrong graph... sorry

rrz@871311,

I agree and very much like  a = (r *tan(b) + h/cos(b) - h)/r - b

But, I don't see how you get this one:

x + r = r/cos(b) + h*tan(b)

Could you please, in reference to the graph below, make your case? I know you have patiently done this a few times but I thing there is something illusive causes the problem going back and fort from one graph to another.

thanks.
drum-3.png
student

Commented:
The drum is located at x = - r   y = h
The rope starts at x = 0  y = 0
After some pulling  the bottom the rope is at x = x
At that time the horizontal distance between the center of the drum and the bottom of the rope = x + r
Ignore your last two graphs.Forget about d and k.
Look at your graph at
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html?cid=748#a36323336
The bottom of the yellow triangle = r/cos(b)
The bottom of the blue triangle = h*tan(b)
They cover the same horizontal distance as the radius of the drum and the distance pulled.
Therefore
x + r = r/cos(b) + h*tan(b)

Database and Application Developer

Commented:
This is thinking out of the box. I will post the new question now.

Thanks,

Mike
Database and Application Developer

Commented:
Hi pkwan,

If you happened to view this post, please help us with the following math question.

http://www.experts-exchange.com/Other/Math_Science/Q_27243101.html

Regards,

Mike