Find: b(x) and a(x)...

Mike Eghtebas used Ask the Experts™
on
having:

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

r and h are constants.

Find: b(x) and a(x)

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

Thank you.
Comment
Watch Question

Do more with

EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
student

Commented:
Hopefully pkwan will see this and do what he did in your previous questions.

Let's step away from the general case and ask
"What is happening when the values are very small?"
We have our two equations.
a = (r *tan(b) + h/cos(b) - h)/r - b
x = h*tan(b) + r/cos(b) - r
When "b" is very small, we can use these approximations
tan(b) is approximately equal to "b"
cos(b) is approximately equal to 1
So when b is very small we have
a = 0
x = h*b
So when b is very small and h = 60   (notice r is not a factor)
x = 60*b
We can confirm this with some Java.
``````import java.text.DecimalFormat;
public class SmallValues {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("000.000");
double h = 60;
double r = 10;
double a = 0;
double x = 0;
double x2 = 0;
for(double b = 0; b < 0.1; b += 0.005){
a = (r * Math.tan(b) + h/Math.cos(b) - h)/r - b;
x = h*Math.tan(b) + r/Math.cos(b) -r;
System.out.println("b = " + df.format(b) + " a = " + df.format(a) + " x = " + df.format(x));
}
}
}
``````
Output results:
b = 000.000 a = 000.000 x = 000.000
b = 000.005 a = 000.000 x = 000.300
b = 000.010 a = 000.000 x = 000.601
b = 000.015 a = 000.001 x = 000.901
b = 000.020 a = 000.001 x = 001.202
b = 000.025 a = 000.002 x = 001.503
b = 000.030 a = 000.003 x = 001.805
b = 000.035 a = 000.004 x = 002.107
b = 000.040 a = 000.005 x = 002.409
b = 000.045 a = 000.006 x = 002.712
b = 000.050 a = 000.008 x = 003.015
b = 000.055 a = 000.009 x = 003.318
b = 000.060 a = 000.011 x = 003.622
b = 000.065 a = 000.013 x = 003.927
b = 000.070 a = 000.015 x = 004.231
b = 000.075 a = 000.017 x = 004.537
b = 000.080 a = 000.019 x = 004.842
b = 000.085 a = 000.022 x = 005.149
b = 000.090 a = 000.025 x = 005.455
b = 000.095 a = 000.027 x = 005.763
This would suggest that initially we are unwrapping the rope from the drum rather than unwinding(which would cause turning of the drum).
Database and Application Developer

Commented:
re:> This would suggest that initially we

It show how well your equations work.

Now, to complete the work do we need to have a(x) and b(x) or for now you can include x(b) and a(b) by incrementing b to get a and x to complete the animation?

Thanks,

Mike
Analyst Programmer
Commented:
Let us assume S = sin(b), C = cos(b) as usual.

x + r = r/cos(b) + h*tan(b)  .... (eq. 1)
=> C (x+r) - r = hS
=> (x+r)^2 C^2 - 2r(x+r) C + r^2 = h^2(1-C^2)
=> [(x+r)^2 + h^2] - 2r(x+r) C + (r^2 - h^2) = 0

x + r = r/C + h*T
=> T = (x+r)/h - r/hC ..... (eq. 6)

Solving for C,

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) + h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2] ... (eq. 2)

and

C =  [r(x+r) - h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2] ... (eq. 3)

so

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

and

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

Substituting eq. 2 to eq.6 into a,

a = (r *tan(b) + h/cos(b) - h)/r - b
= T + h/rC - h/r - b
= (x+r)/h - r/hC  + h/rC - h/r - b
= (x+r)/h - h/r -  ArcCos( [r(x+r) - h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2]) - (r^2 - h^2)/(hr[r(x+r) + h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2])

Analyst Programmer

Commented:
Correction:

a = (r *tan(b) + h/cos(b) - h)/r - b
= T + h/rC - h/r - b
= (x+r)/h - r/hC  + h/rC - h/r - b
= (x+r)/h - h/r -  ArcCos( [r(x+r) + h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2]) - (r^2 - h^2)/(hr[r(x+r) + h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2])

and

a = (r *tan(b) + h/cos(b) - h)/r - b
= T + h/rC - h/r - b
= (x+r)/h - r/hC  + h/rC - h/r - b
= (x+r)/h - h/r -  ArcCos( [r(x+r) - h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2]) - (r^2 - h^2)/(hr [r(x+r) - h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2])

student

Commented:
pkwan, question spots on last line.
... - h sqrt((x+r)  ...
should that be
- h * sqrt((x+r)
?
h^2)/(hr [r(x+r) - h sq
should that be
h^2)/(h*r [r(x+r) - h sq
?
Analyst Programmer

Commented:
:rrz@871311, you are correct.
Database and Application Developer

Commented:
Hi pkwan,

I am not able to get     => T = (x+r)/h - r/hC ..... (eq. 6)
I traced your work filling in the gaps. Could you please show me how we get from:

=> [(x+r)^2 + h^2]C^2 - 2r(x+r) C + (r^2 - h^2) = 0

to

=> T = (x+r)/h - r/hC ..... (eq. 6)
=============

I have started from:
x + r = r/cos(b) + h*tan(b)  .... (eq. 1)

x + r = r/C + h*T
multipily by C

C(x + r = r/C + h*T)

Cx+Cr = r + hS

=> C(x+r) - r = hS

(C(x+r) - r)^2 = (hS)^2

(x+r)^2 C^2 - 2r(x+r) C + r^2 = h^2(S^2)

1=S^+C^2    S^2=1-C^2

=> (x+r)^2 C^2 - 2r(x+r) C + r^2 = h^2(1-C^2)

(x+r)^2 C^2 - 2r(x+r) C + r^2 = h^2 - h^2 C^2

(x+r)^2 C^2 + h^2 C^2 - 2r(x+r) C + r^2 + h^2 =0

[(x+r)^2 + h^2] C^2 - 2r(x+r) C +  r^2 + h^2 =0

=> [(x+r)^2 + h^2]C^2 - 2r(x+r) C + (r^2 - h^2) = 0

[(x+r)^2C^2- 2r(x+r) C + r^2]= h^2-h^2C^2

[(x+r)C - r]^2 = h^2(1-C^2)

(x+r)C - r = h sqrt(1-C^2)

(x+r) = r/C + h sqrt(1-C^2)/C   <--- please show me how I can get from here to next line,

x + r = r/C + h*T
=> T = (x+r)/h - r/hC ..... (eq. 6)

Solving for C,
student

Commented:
I tried to convert pkwan's last line to java. It doesn't work like it should work. Here is my java code line.
``````a = (x+10)/60 - 60/10 -  Math.acos( (10*(x+10) - 60 * Math.sqrt(Math.pow(x+10,2) + Math.pow(60,2) - Math.pow(10,2)))/(Math.pow(x+10,2) + Math.pow(60,2)))  - (Math.pow(10,2) - Math.pow(60,2))/(60*10 *(10*(x+10) - 60 * Math.sqrt(Math.pow(x+10,2) + Math.pow(60,2) - Math.pow(10,2)))/(Math.pow(x+10,2) + Math.pow(60,2)));
``````
I don't know if I made a mistake in the conversion or not.
student

Commented:
I used values  r = 10 and h = 60
Analyst Programmer

Commented:
Actually, derivation of eq.1 and derivation of eq.6 is independent (both are from the x + r = r/cos(b) + h*tan(b) )

x + r = r/cos(b) + h*tan(b)
=> x + r = r/C + h*T
=> h * T = (x+r) - r/C
=> T = (x+r)/h - r/(h*C)
Database and Application Developer

Commented:
Thank you pkwan. I envy your math ability. b(x) checks out but I have to go over it again because when I ran it for c1 and c2 to see which to accept and which to reject, I see that neither is acceptable...

rrz@871311,

Using following code I get cos(b) outside its acceptable range of -1 to 1:

arc b       arc b1    x
24.03  24.03  00.00
25.28  25.28  00.25

320.83  320.83  59.25
322.08  322.08  59.50
323.33  323.33  59.75
^---------^---------------these values should be between -1 and 1

So I will check the equation again. I wonder using x(b) two times as eq.1 and again eq.6 maybe responsible for this error.

I will check the code again to see it is the source of error.

Thanks,

Mike

``````import java.text.DecimalFormat;
public class Data1 {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.00");
double h = 30;
double r = 5;
double a = 0;
double b = 0;
double b1 = 0;
System.out.println("arc b\t arc b1    x");
for(double x = 0; x < 60; x +=0.25){
//          b = Math.acos((r*(x+r)+h*Math.sqrt(Math.pow((x+r),2)+Math.pow(h,2)-Math.pow(r,2))/
//                                        (Math.pow((x+r),2) + Math.pow(h,2))));
//          b1 = Math.acos((r*(x+r)-h*Math.sqrt(Math.pow((x+r),2)+Math.pow(h,2)-Math.pow(r,2))/
//                                        (Math.pow((x+r),2) + Math.pow(h,2))));

b = (r*(x+r)-h*Math.sqrt(Math.pow((x+r),2)+Math.pow(h,2)-Math.pow(r,2))/
(Math.pow((x+r),2) + Math.pow(h,2)));
b1 = (r*(x+r)-h*Math.sqrt(Math.pow((x+r),2)+Math.pow(h,2)-Math.pow(r,2))/
(Math.pow((x+r),2) + Math.pow(h,2)));
//        System.out.println(" " + df.format(b1*(180/Math.PI)) + "  " + df.format(b*(180/Math.PI)) + "  " + df.format(x));
System.out.println(" " + df.format(b1) + "  " + df.format(b) + "  " + df.format(x));
}
}
}
``````
Database and Application Developer

Commented:
FYI, The way this design works,  60 degrees > b<=0 degrees

or 0.5>ArcCos(b)<=0
Database and Application Developer

Commented:
corrction...

FYI, The way this design works,  60 degrees > b>=0 degrees

or 0.5>ArcCos(b)>=0
Database and Application Developer

Commented:

cos(b) b   cos(b1)    x
24.03    24.03     00.00
25.28    25.28     00.25
26.53    26.53     00.50
27.78    27.78     00.75
29.03    29.03     01.00
30.28    30.28     01.25
^---------^---------------these values should be between -1 and 1
Database and Application Developer

Commented:
Good news. the issue with angle b is resolved.

a deg.     b deg.      x
-848.62  00.00    00.00
-848.73  06.02    01.00
-848.93  08.59    02.00
-849.23  10.62    03.00
-849.63  12.37    04.00
-850.13  13.94    05.00
^--- I need to debug this part.
``````import java.text.DecimalFormat;
public class Data1 {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.00");
double h = 60;
double r = 10;
double a = 0;
double b = 0;
double b1 = 0;
System.out.println("a deg.\t  b deg.  x");
for(double x = 0; x <= 60; x +=1.0){

b1 = Math.acos((r*(x+r)+h*Math.sqrt(Math.pow(x,2)+Math.pow(h,2)-2*x*r))/
(Math.pow((x+r),2) + Math.pow(h,2)));

a = (x+r)/h - h/r -  Math.acos( (r*(x+r) - h * Math.sqrt(Math.pow((x+r),2) + Math.pow(h,2)
- Math.pow(r,2)))/(Math.pow(x+r,2) + Math.pow(h,2)))  - (Math.pow(r,2) -
Math.pow(h,2))/(h*r *(r*(x+r) - h * Math.sqrt(Math.pow(x+r,2) + Math.pow(h,2) -
Math.pow(r,2)))/(Math.pow(x+r,2) + Math.pow(h,2)));

System.out.println(" " + df.format(a*(180/Math.PI)) + "  " + df.format(b1*(180/Math.PI)) + "  " + df.format(x));

}
}
}
``````
student

Commented:
I am working on this. I will post soon.
student

Commented:
x = htan(b) + r/cos(b) - r
x/h = tan(b) + (r/h)/cos(b) - r/h
let j = x/h
k = r/h
C = cos(b)
Use pkwan's method:
sqrt(1 - C^2)/C = tan(b)  //trig identity
j+k = sqrt(1 - C^2)/C + (r/h)/C
C(j+k) - k = sqrt(1 - C^2)
(C(j+k) - k)^2 = 1 - C^2
C^2(j+k) + k^2 - 2Ck(j+k) = 1 - C^2
0 = ((j+k)^2 + 1)C^2 - 2k(j+k)C + k^2 - 1
C = (2k(j+k) + sqrt((2k(j+k))^2 - 4((j+k)^2 + 1)(k^2 - 1)))/2((j+k)^2 + 1)
Rewrite for java:
C = (2*k*(j+k) + Math.sqrt(Math.pow(2*k*(j+k),2) - 4*(Math.pow(j+k,2) + 1)*(k*k - 1)))/2*(Math.pow(j+k,2) + 1)

Here is java code.
``````import java.text.DecimalFormat;
public class Ax {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.000");
double h = 60; //height of drum from base line
double r = 10; //drum radius
double k = r/h;
double j = 0;
double a = 0;
double C = 0; // equals cos(b)
for(double x = 0; x <= 1000; x += 50){
j = x/h;
C = (2*k*(j+k) + Math.sqrt(Math.pow(2*k*(j+k),2) - 4*(Math.pow(j+k,2) + 1)*(k*k - 1)))/(2*(Math.pow(j+k,2) + 1));
a = (r * Math.tan(Math.acos(C)) + h/C - h)/r - Math.acos(C);
System.out.println(" x = " + df.format(x) + " a = " + df.format(a) + " b = " + df.format(Math.acos(C)));
}
}
}
``````
The output:
x = 00.000 a = 00.000 b = 00.000
x = 50.000 a = 01.759 b = 00.667
x = 100.000 a = 05.498 b = 00.992
x = 150.000 a = 09.905 b = 01.153
x = 200.000 a = 14.571 b = 01.247
x = 250.000 a = 19.358 b = 01.307
x = 300.000 a = 24.212 b = 01.348
x = 350.000 a = 29.105 b = 01.378
x = 400.000 a = 34.023 b = 01.401
x = 450.000 a = 38.959 b = 01.420
x = 500.000 a = 43.908 b = 01.434
x = 550.000 a = 48.865 b = 01.446
x = 600.000 a = 53.830 b = 01.456
x = 650.000 a = 58.800 b = 01.465
x = 700.000 a = 63.774 b = 01.472
x = 750.000 a = 68.751 b = 01.479
x = 800.000 a = 73.731 b = 01.485
x = 850.000 a = 78.714 b = 01.490
x = 900.000 a = 83.698 b = 01.494
x = 950.000 a = 88.684 b = 01.498
x = 1000.000 a = 93.672 b = 01.502

Please check my work.  I tried to plug it into
http://www.wolframalpha.com/
but it didn't work. Maybe phoffric knows how to get the plot from that site. We could use java to create graph, if you want to have it.
I will be back online in 6 hours.

Database and Application Developer

Commented:
Here is the link in Java and JavaScript sections for the applet or desktop version:

http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27245193.html

Thank you,

Mike
student

Commented:
Did you check my code ?
Database and Application Developer

Commented:
re:> Did you check my code ?

I did go through it. It is compact and less to write. But, I got different results for the b angles produced compared to pkwan's angle b(x) equation.

As you know, in the beginning, I had some problem with his equations also but after I traced my work again, the outcome seemed very good and acceptable.

I will review your equation again also to make sure I am getting the same result as his (or check his equation again to make sure there is consistency between two solutions).

Meanwhile, until I recheck your formula again, I though you may want to put your JApplet or a desktop version of it together while I am checking the equations here.

Replacing the equations shouldn't be too hard. Meanwhile, if you have any problem with your equations, you may want to  consider using the one below (I still need to check a(x). Angle be looks good though. Next I will check pkwan's a(x) to make sure we have one set of reasonable equations. Then I will do your version to cross check pkwan's equations.

Regards,

Thank you

``````import java.text.DecimalFormat;
public class Data1 {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.00");
double h = 60;
double r = 10;
double a = 0;
double b = 0;
double b1 = 0;
System.out.println("a deg.\t  b deg.  x");
for(double x = 0; x <= 60; x +=1.0){

b1 = Math.acos((r*(x+r)+h*Math.sqrt(Math.pow(x,2)+Math.pow(h,2)-2*x*r))/
(Math.pow((x+r),2) + Math.pow(h,2)));

a = (x+r)/h - h/r -  Math.acos( (r*(x+r) - h * Math.sqrt(Math.pow((x+r),2) + Math.pow(h,2)
- Math.pow(r,2)))/(Math.pow(x+r,2) + Math.pow(h,2)))  - (Math.pow(r,2) -
Math.pow(h,2))/(h*r *(r*(x+r) - h * Math.sqrt(Math.pow(x+r,2) + Math.pow(h,2) -
Math.pow(r,2)))/(Math.pow(x+r,2) + Math.pow(h,2)));

System.out.println(" " + df.format(a*(180/Math.PI)) + "  " + df.format(b1*(180/Math.PI)) + "  " + df.format(x));

}
}
``````
student

Commented:
Did you run the code you just posted ?  The output is crap.  Are you learning anything here ?
Database and Application Developer

Commented:
pkwan,

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) + h sqrt((x+r)^2+h^2-r^2)]/[(x+r)^2 + h^2] ... (eq. 2)

Isolating sqrt() portion from your eq. 2 above:

sqrt(4r^2(x+r)^2 - 4[(x+r)^2 + h^2](r^2 - h^2))]

2sqrt(r^2(x+r)^2 - [(x+r)^2 + h^2](r^2 - h^2))]

2sqrt(r^2(x^2+r^2+2xr) - [(x^2+r^2+2xr) + h^2](r^2 - h^2))])

2sqrt[(r^2x^2+r^4+2xr^3) - (x^2+r^2+2xr + h^2)(r^2 - h^2)]

2sqrt[(r^2x^2+r^4+2xr^3) - (x^2r^2+x^2h^2 + r^4-r^2h^2 + 2xr^3-2xrh^2 + h^2r^2-h^4)]

2sqrt[r^2x^2+r^4+2xr^3 - x^2r^2+x^2h^2 - r^4+r^2h^2 - 2xr^3+2xrh^2 - h^2r^2+h^4]

2sqrt[(r^2x^2-r^2r^2) + (r^4-r^4) + (2xr^3-2xr^3) + (x^2h^2+2xrh^2) + (x^2h^2 - h^2r^2 + h^4)]

2sqrt(x^2h^2 - h^2r^2 + h^4)

2sqrt(x^2h^2 - h^2r^2 + h^4)

2h*sqrt(x^2 - r^2 + h^2)    <-- this is what I get unless you could spot an error to this point.

---------------now

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

Isolating and expanding sqrt() portion of (eq. 4), we get:

sqrt((x+r)^2+h^2-r^2) => sqrt(x^2+r^2+2xr+h^2-r^2)

or sqrt(x^2+2xr+h^2)

so sqrt(x^2+2xr+h^2) is not the same as sqrt(x^2 - r^2 + h^2)

so, your submission in eq. 4 should have been:

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

not:

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

After this change, I was able to limit cos(b) = (+/-)1
Database and Application Developer

Commented:
re:> Did you run the code you just posted ?

The output for b angel looks okay after above correction:

changing:

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

to

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

Now, I will follow up with a angle.

Please note the sample output below:

a deg.     b deg.      x
-848.62  00.00    00.00
-848.73  06.02    01.00
-848.93  08.59    02.00
-849.23  10.62    03.00
-849.63  12.37    04.00
-850.13  13.94    05.00
^--- I need to debug this part.

b is in degrees for x=0, 1, 2, etc.

I need to work on a angel now.

Mike

Analyst Programmer

Commented:
Hi,

2sqrt[(r^2x^2+r^4+2xr^3) - (x^2r^2 + x^2h^2 + r^4-r^2h^2 + 2xr^3-2xrh^2 + h^2r^2-h^4)] <- This line is incorrect (should be x^2r^2 - x^2h^2, but does not matter, the next line is correct though.

The incorrect derivation is this line:

2sqrt[(r^2x^2-r^2r^2) + (r^4-r^4) + (2xr^3-2xr^3) + (x^2h^2+2xrh^2) + (x^2h^2 - h^2r^2 + h^4)]

=> 2sqrt(x^2h^2 - h^2r^2 + h^4)

You missed this term: (x^2h^2+2xrh^2)
student

Commented:
>a deg.     b deg.      x
> -848.62  00.00    00.00
That doesn't make any sense. "a" has to be zero at the start.

We have developed two separate methods in our discussion.
In the  first method we used these two equations
x = r/cos(b) + h*tan(b) - r
a = (r *tan(b) + h/cos(b) - h)/r - b
by incrementing "b" in each equation to calculate "x" and "a"
In the second method we solved for "b" as a function of "x"  ( thanks to the method suggested by pkwan) and plugged it to the second equation. Thus we can now increment "x" and calculate "a" directly.
So you should compare the results of these two methods.

student

Commented:
My equations are correct.
Database and Application Developer

Commented:
re:> That doesn't make any sense. "a" has to be zero at the start.

I have mention number couple of times that a is being looked at. Angel a is not QC'ed. You are right, it should be zero.

Another thing I have noticed is the following I want to bring to your attention:

a=(1/r)*(h*Math.tan(b)+(r/Math.cos(b)))-b      <-- our starting equation.

I have a question you may be able to help me with. If we plug b=0, a needs to be zero also:

a=(1/r)*(h*Math.tan(0)+(r/Math.cos(0)))-0                 r=10, and h=60

a= (1/10)(60*0 + (10/1)

a= 0.1(10)=1

it is off by 180 degrees.

This is the offset we are getting with angel a output.

how we can explain this?

Thx

Database and Application Developer

Commented:
I m done with pkwan's  b(x) equation. After discussing the 180 degree problem with a(b), I will start checking your good equations.

student

Commented:
>a=(1/r)*(h*Math.tan(b)+(r/Math.cos(b)))-b      <-- our starting equation.
Where did you get that equation ?

In your question at the top above here, you have
a = (r *tan(b) + h/cos(b) - h)/r - b
That is correct.
student

Commented:
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27245193.html
eq. 2  in your graph  is correct.
Database and Application Developer

Commented:
sorry for confusion. I ran from 0" to 60"

The output looks good:

a deg.   b deg.  x
00.00  00.00  00.00
01.93  06.02  01.00
03.97  08.59  02.00
06.12  10.62  03.00

204.37  49.60  56.00
208.87  49.96  57.00
213.38  50.32  58.00
217.90  50.67  59.00
222.43  51.01  60.00

Looks good to me although a(x) is not used. Here we have used a(b).

``````import java.text.DecimalFormat;
public class Data1 {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.00");
double h = 60;
double r = 10;
double a = 0;
double b = 0;

System.out.println("a deg.\t  b deg.  x");
for(double x = 0; x <= 60; x +=1.0){

b = Math.acos((r*(x+r)+h*Math.sqrt(Math.pow(x,2)+Math.pow(h,2)-2*x*r))/
(Math.pow((x+r),2) + Math.pow(h,2)));
a = (((r *Math.tan(b) + h/Math.cos(b) - h))/r) - b;

System.out.println(" " + df.format(a*(180/Math.PI)) + "  " +
df.format(b*(180/Math.PI)) + "  " + df.format(x));

}
}
}
``````
student

Commented:
That last code outputs something close to what mine does. I will try to find out why they don't match.
Database and Application Developer

Commented:
by the way, the first equations are also yours. pkwan only helps in manipulation of them.
Database and Application Developer

Commented:
Based on the comment from pkwan, I modified the equation. see how this compares to what you have:

a deg.        b deg.  x
00.00  00.00  00.00
00.05  00.95  01.00
00.19  01.90  02.00
00.43  02.85  03.00
00.76  03.79  04.00

134.27  42.71  59.00
138.18  43.17  60.00
``````import java.text.DecimalFormat;
public class Data1 {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.00");
double h = 60;
double r = 10;
double a = 0;
double b = 0;

System.out.println("a deg.\t  b deg.  x");
for(double x = 0; x <= 60; x +=1.0){

b = Math.acos((r*(x+r)+h*Math.sqrt(Math.pow(x,2)+Math.pow(h,2)+2*x*r))/
(Math.pow((x+r),2) + Math.pow(h,2)));
a = (((r *Math.tan(b) + h/Math.cos(b) - h))/r) - b;

System.out.println(" " + df.format(a*(180/Math.PI)) + "  " +
df.format(b*(180/Math.PI)) + "  " + df.format(x));

}
}
}
``````
Database and Application Developer

Commented:
pkwan,

Do you ever make a mistake? I guess not.

Commented:
I see that you are asking for a graph. The graph site does not allow enough chars for a(x); no problem with just b(x) though.

So, I added a graph to an excel spreadsheet (attached) that I did for an earlier question. Rope-Puller.xlsx
rope-pull.PNG

Commented:
You can change the values of r and h in Excel and immediately see the effect on the graph.
student

Commented:
I compared your last code(Data1.java) to my output. They still don't match.  In fact your previous version of Data1 was a better match to my output.   I am going offline. I will be back in the morning.
student

Commented:
Thanks phoffric,  that looks good.
Could you graph the results  a(x)  from the two separate methods on the same graph ?
In the  first method we used these two equations
x = r/cos(b) + h*tan(b) - r
a = (r *tan(b) + h/cos(b) - h)/r - b
by incrementing "b" in each equation to calculate "x" and "a"
In the second method we solved for "b" as a function of "x"  ( thanks to the method suggested by pkwan) and plugged it to the second equation. Thus we can now increment "x" and calculate "a" directly.
Good night.
Database and Application Developer

Commented:
re> They still don't match

If in your judgment the second set of the equations produce better data, we should just use those.
student

Commented:
Did you go through my derivation ?
From my post above here:

x = htan(b) + r/cos(b) - r
x/h = tan(b) + (r/h)/cos(b) - r/h
let j = x/h
k = r/h
C = cos(b)
Use pkwan's method:
sqrt(1 - C^2)/C = tan(b)  //trig identity
j+k = sqrt(1 - C^2)/C + (r/h)/C
C(j+k) - k = sqrt(1 - C^2)
(C(j+k) - k)^2 = 1 - C^2
C^2(j+k) + k^2 - 2Ck(j+k) = 1 - C^2
0 = ((j+k)^2 + 1)C^2 - 2k(j+k)C + k^2 - 1
C = (2k(j+k) + sqrt((2k(j+k))^2 - 4((j+k)^2 + 1)(k^2 - 1)))/2((j+k)^2 + 1)

I used j and k to make it more readable and more concise. Where is it not clear ?
The line
0 = ((j+k)^2 + 1)C^2 - 2k(j+k)C + k^2 - 1
0 = [[((j+k)^2 + 1)]]  C^2   -   [[2k(j+k)]]  C   +    [[ k^2 - 1]]
The bracketed terms are used in the quadratic formula.
pkwan had a great idea but I don't think he followed through with the implementation.

Database and Application Developer

Commented:
re:> pkwan had a great idea but I don't think he followed through with the implementation.

b(x) and a(x, b)

not

b(x) and a(x)

yes?

I am through with going over working on b(x) and a(x, b), now I am starting on your new equations.

I am sure, as you have stated also, your numbers look good.  I will update you shortly.

Thanks,

Mike
Database and Application Developer

Commented:
rrz@871311,

As you have stated, because of j and k subs, it is more compact. I further simplified to:

C=(k(j+k) + SQRT(j^2+2jk+1))/((j+k)^2+1)

Now I will test it in code. I really don't see how this should result in something different than what pkawn had. Of course one possible source of problem could be java's conversions during the calculations.

brb
Database and Application Developer

Commented:
rrz@871311,

After checking your equation, I ran it. It has identical values as pkwan's. Using his equation I get b deg. and using your equation I get C deg. listed below:

a deg.  b deg.   x     C deg.
00.00  00.00  00.00   00.00
00.05  00.95  01.00   00.95
00.19  01.90  02.00   01.90
00.43  02.85  03.00   02.85

130.41  42.25  58.00   42.25
134.27  42.71  59.00   42.71
138.18  43.17  60.00   43.17
``````import java.text.DecimalFormat;
public class Data1 {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.00");
double h = 60;
double r = 10;
double a = 0;
double b = 0;
double C = 0;
double j = 0;
double k = r/h;

System.out.println("a deg.  b deg.   x     C deg.");
for(double x = 0; x <= 60; x +=1.0){
j=x/h;
C=Math.acos((k*(j+k) + Math.sqrt(Math.pow(j,2)+2*j*k+1))/(Math.pow((j+k),2)+1));
b = Math.acos((r*(x+r)+h*Math.sqrt(Math.pow(x,2)+Math.pow(h,2)+2*x*r))/
(Math.pow((x+r),2) + Math.pow(h,2)));
a = (((r *Math.tan(b) + h/Math.cos(b) - h))/r) - b;

System.out.println(" " + df.format(a*(180/Math.PI)) + "  " +
df.format(b*(180/Math.PI)) + "  " + df.format(x)+ "   " + df.format(C*(180/Math.PI)));

}
}
}
``````

Commented:
>> Could you graph the results  a(x)  from the two separate methods on the same graph ?

The data for the two separate methods are both in the attached spreadsheet. When I plotted the both results on one graph, they overlapped.
student

Commented:
>C=(k(j+k) + SQRT(j^2+2jk+1))/((j+k)^2+1)
I don't think that is right. Could you show us how you arrived at that ?
Database and Application Developer

Commented:
brb on that
student

Commented:
Thanks proffric, I don't have Excel, so I couldn't see that.
The graph you posted is great.  It is easy to see that
b=a  at x=20
initial slope of b(x) (see  http:#36325705  )   db/dx =  1/60
student

Commented:
>brb
What does that mean?

Commented:
>> I don't have Excel
You can get the open source version for free (using MS on one PC, and open source on other).
http://www.openoffice.org/

brb = be right back
student

Commented:
Thanks phoffric.
Database and Application Developer

Commented:
re:> Could you show us how you arrived at that ?

I responded: "brb on that". sorry for not using full sentense.

Here is how I got what you were asking for:

x = h* tan(b) +(r/cos(b) - r
(x/h)=tan(b) + (r/h)/cos(b) - (r/h)
j=x/h    k=r/h    C=cos(b)   T=tan(b)
j= T + (k/C) -k   having: T = SQRT(1-c^2)/C

j-k = SQRT(1-c^2)/C + (k/C)

(j+k)C = SQRT(1-c^2) + k

(j+k)C - k = SQRT(1-c^2)

((j+k)C - k)^2 = (1-c^2)

(j+k)^2C^2 + k^2 - 2k(j+k)C -1 + c^2 =0

((j+k)^2 +1)C^2 - 2k(j+k)C + (k^2-1) =0

delta= SQRT([]^2 - 4[])/2[]

delta= SQRT([-2k(j+k)]^2 - 4[(j+k)^2 +1)(k^2-1)])

delta= SQRT(4k^2(j+k)^2 - 4(j+k)^2 +1)(k^2-1))

delta= 2SQRT(k^2(j+k)^2 - (j+k)^2 +1)(k^2-1))

delta= 2SQRT(k^2(j^2+k^2+2jk) - (j^2 + k^2 + 2jk + 1)(k^2-1))

delta= 2SQRT(j^2k^2+k^4+2jk^3 - (j^2k^2-j^2 + k^4-k^2 + 2jk^3-2jk + k^2-1))

delta= 2SQRT(j^2k^2+k^4+2jk^3 - j^2k^2+j^2 - k^4+k^2 - 2jk^3+2jk - k^2+1)

delta= 2SQRT(j^2+2jk+1)/2(j+k)^2 +1)

C=(2k(j+k)+2SQRT(j^2+2jk+1)/2(j+k)^2 +1)

C=(k(j+k)+SQRT(j^2+2jk+1)/(j+k)^2 +1)
Database and Application Developer

Commented:
correction...

C=(k(j+k)+SQRT(j^2+2jk+1))/(j+k)^2 +1)
Database and Application Developer

Commented:
phoffric,

Thank you for the graph. It gives more insight on the working of the assembly. Very valuable. You are a few step ahead of the game. After the animation program, I will be focusing in that and possibly posting related questions on that.

Regards,

Mike

Commented:
It is interesting to change the r and h values and verify that your intuition about what the graph should look like matches the actual graph.

The equations used for x = f(b), where b is incremented is based on results in your question. The equations for b = b(x) are not as I had done them awhile back. But they are equivalent to what you are using based on spot check verification of the data you have been posting.
Database and Application Developer

Commented:
x = f(b) is not a good to function to worry about. No one would worry about the magnitude of b as input or output.

Input should be x (always) and rotation should be output.

Commented:
I did it both ways in the spreadsheet so that I could compare results for verification. The results agree.
Database and Application Developer

Commented:
thanks
student

Commented:
Excellent work! Great simplification! I was being lazy.
``````public class Ax {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("00.000");
double h = 60; //height of drum from base line
double r = 10; //drum radius
double k = r/h;
double j = 0;
double a = 0;  // angle the drum has been rotated
double C = 0; // equals cos(b)
for(double x = 0; x <= 1000; x += 50){
j = x/h;
C = (k*(j+k) + Math.sqrt(j*j + 2*j*k + 1))/((j+k)*(j+k) + 1);
a = (r * Math.tan(Math.acos(C)) + h/C - h)/r - Math.acos(C);
System.out.println(" x = " + df.format(x) + " a = " + df.format(a) + " b = " + df.format(Math.acos(C)));
}
}
}
``````
Output:
x = 00.000 a = 00.000 b = 00.000
x = 50.000 a = 01.759 b = 00.667
x = 100.000 a = 05.498 b = 00.992
x = 150.000 a = 09.905 b = 01.153
x = 200.000 a = 14.571 b = 01.247
x = 250.000 a = 19.358 b = 01.307
x = 300.000 a = 24.212 b = 01.348
x = 350.000 a = 29.105 b = 01.378
x = 400.000 a = 34.023 b = 01.401
x = 450.000 a = 38.959 b = 01.420
x = 500.000 a = 43.908 b = 01.434
x = 550.000 a = 48.865 b = 01.446
x = 600.000 a = 53.830 b = 01.456
x = 650.000 a = 58.800 b = 01.465
x = 700.000 a = 63.774 b = 01.472
x = 750.000 a = 68.751 b = 01.479
x = 800.000 a = 73.731 b = 01.485
x = 850.000 a = 78.714 b = 01.490
x = 900.000 a = 83.698 b = 01.494
x = 950.000 a = 88.684 b = 01.498
x = 1000.000 a = 93.672 b = 01.502
Database and Application Developer

Commented:
Where  do we go from here? Is a desktop animation or a JApplet possible at this point?

new question is at:
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27245193.html
student

Commented:
>Where  do we go from here?
It  would nice to see a graph of  a = f(x) ,for x=0 to 1000
I guess if we ask real nice, proffric might post one.  I tried to plug it into
http://www.wolframalpha.com/
but its about 8 characters to big(even if I cram it all together.
To make it as easy as possible, here is what is needed.
If we let  h=60  r=10  k=.6   j=x/60  , then we have
C = (.16*(x/60+.16)+sqrt((x/60)^2+x/180+1))/((x/60+.6)^2+1)
plug C into
a = (tan(arccos(C))+6/C-6)-arccos(C)

I was able to get a image(see below).
>Is a desktop animation or a JApplet possible at this point?
Yes, I'll start working on it, after dinner tonight.
wolframalpha-20110809173740192.gif
student

Commented:
oops
>If we let  h=60  r=10  k=.6   j=x/60
I meant
If we let  h=60  r=10  k=.1666666   j=x/60
Database and Application Developer

Commented:
re:>  if we ask real nice, proffric might post one.

I will post a new question to do this, hoping he has the time for it.

Also, I have to tell your contribution in developing the original equation was just amazing. I look forward to see the JApplet.

Thanks,

Mike
Database and Application Developer

Commented:
Paul,

The plot question is at:

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

Thank you,

Mike
Database and Application Developer

Commented:
Thank you pkwan.

Do more with