Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

plot using http://www.wolframalpha.com...

At:  https://www.experts-exchange.com/questions/27243101/Find-b-x-and-a-x.html?anchorAnswerId=36339702#a36339702

The following function is discussed. If you are familiar with http://www.wolframalpha.com/ site. It will be appreciated if you could produce a plot of:

a = a(x) = (tan(arccos(C))+6/C-6)-arccos(C)

where   C = (.16*(x/60+.16)+sqrt((x/60)^2+x/180+1))/((x/60+.6)^2+1)     and  

j=x/60, h=60,  r=10, and  k=.6

for the range of  x=0 to 1000    
     

Thank you.
Avatar of rrz
rrz
Flag of United States of America image

Actually the general equations are
a = (r*tan(arccos(C)) + h/C- h)/r - arccos(C)
where
C = (k*(j+k)+sqrt(j^2+2*j*k+1))/((j+k)^2+1)
j = x/h   k = r/h

Let
h = 60 ,  r = 10 ,   k= 1/6  ,  j = x/60  
So we have
C = (1/6 * (x/60+ 1/6)+sqrt((x/60)^2+x/180+1))/((x/60 + 1/6)^2+1)
Avatar of phoffric
phoffric

The OP is incorrect or just a better form in first post?
ASKER CERTIFIED SOLUTION
Avatar of phoffric
phoffric

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, phoffric.   Your values match my code output in the high and low range. In the range  35 < x < 70  there seem to be a discrepancy.  I don't know why or if it matters.
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;  // angle the drum has been rotated
      double C = 0; // equals cos(b) 
      for(double x = 0; x <= 100; x += 5){
          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)));
      }
  }
}

Open in new window

Output:
 x = 00.000 a = 00.000 b = 00.000
 x = 05.000 a = 00.021 b = 00.083
 x = 10.000 a = 00.082 b = 00.163
 x = 15.000 a = 00.182 b = 00.240
 x = 20.000 a = 00.319 b = 00.314
 x = 25.000 a = 00.490 b = 00.384
 x = 30.000 a = 00.693 b = 00.449
 x = 35.000 a = 00.923 b = 00.510
 x = 40.000 a = 01.180 b = 00.566
 x = 45.000 a = 01.459 b = 00.619
 x = 50.000 a = 01.759 b = 00.667
 x = 55.000 a = 02.077 b = 00.712
 x = 60.000 a = 02.412 b = 00.753
 x = 65.000 a = 02.761 b = 00.792
 x = 70.000 a = 03.123 b = 00.827
 x = 75.000 a = 03.496 b = 00.860
 x = 80.000 a = 03.880 b = 00.890
 x = 85.000 a = 04.273 b = 00.918
 x = 90.000 a = 04.674 b = 00.945
 x = 95.000 a = 05.083 b = 00.969
 x = 100.000 a = 05.498 b = 00.992
>> In the range  35 < x < 70  there seem to be a discrepancy.
No internal discrepancy; just external printed representation due to roundoff.

Either change Java to have 4 decimal places or change spreadsheet to have 3 decimal places to match your current output. Then you should see exact match.
x = 00.0000 a = 00.0000 b = 00.0000
 x = 05.0000 a = 00.0207 b = 00.0826
 x = 10.0000 a = 00.0820 b = 00.1630
 x = 15.0000 a = 00.1823 b = 00.2403
 x = 20.0000 a = 00.3192 b = 00.3140
 x = 25.0000 a = 00.4903 b = 00.3836
 x = 30.0000 a = 00.6925 b = 00.4489
 x = 35.0000 a = 00.9233 b = 00.5098
 x = 40.0000 a = 01.1796 b = 00.5663
 x = 45.0000 a = 01.4590 b = 00.6188
 x = 50.0000 a = 01.7589 b = 00.6673
 x = 55.0000 a = 02.0771 b = 00.7121
 x = 60.0000 a = 02.4117 b = 00.7535
 x = 65.0000 a = 02.7607 b = 00.7918
 x = 70.0000 a = 03.1227 b = 00.8271
 x = 75.0000 a = 03.4963 b = 00.8599
 x = 80.0000 a = 03.8801 b = 00.8902
 x = 85.0000 a = 04.2732 b = 00.9184
 x = 90.0000 a = 04.6744 b = 00.9445
 x = 95.0000 a = 05.0831 b = 00.9689
 x = 100.0000 a = 05.4984 b = 00.9916

For instance at x = 50 I have a = 01.7589   on your graph it is around 2.4
The question is
-
produce a plot of:

a = a(x) = (tan(arccos(C))+6/C-6)-arccos(C)

where   C = (.16*(x/60+.16)+sqrt((x/60)^2+x/180+1))/((x/60+.6)^2+1)     and  

j=x/60, h=60,  r=10, and  k=.6
-
I do not see where j, h, r, or k enter into the given equation
We have been working on this for a number of questions. Please look at eghtebas's history for his previous questions on this on going discussion.  
h = distance from center of drum to the horizontal base line along which the string(rope) is being pulled to the right
r = radius of drum  
j and k were created for convenience in our calculations.
j = x/h
k = r/h
Avatar of Mike Eghtebas

ASKER

Hi abur,

Thank you for your post. You are right, I have missed giving complete information. As you see in the code lines (posted by rrz@871311 above), i and k are defined.  rrz@871311, phoffric, and I a design, calculation, and animation of an assembly of drum and string wrapped around it while ago. I interested you may follow it via https://www.experts-exchange.com/questions/27243101/Find-b-x-and-a-x.html?anchorAnswerId=36339702#a36339702 link.

      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 <= 100; x += 5){
          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);

I hope this link along the partial code included here could explain a bit. My apology for not submitting a complete question.

Regards,

Mike
Paul and rrz@871311,

Although you have asked for x=0 to x=1000, but what I prefer and will be of interest to me is x=0 to x=60 with 1" increments. I didn't want to disturb your train of though therefore didn't mentioned it before.

Mike
aburr>I do not see where j, h, r, or k enter into the given equation  
You are right they are not necessary for the specific graph.
Actually for values given, please use equations.
a = (tan(arccos(C))+6/C-6)-arccos(C)
C = (1/6 * (x/60+ 1/6)+sqrt((x/60)^2+x/180+1))/((x/60 + 1/6)^2+1)  
there  is an error at the top.
> of interest to me is x=0 to x=60 with 1" increments  
Ok, then the discrepancies are important to resolve ?
If phoffric could post the equations that he used to produce his graph, then we can compare them to what I have in my java code.
is the middle term      +6/(C-6)    or    +(6/C)-6   ?
>> I prefer and will be of interest to me is x=0 to x=60 with 1" increments
That's what I thought, but your OP says:
     for the range of  x=0 to 1000


>> For instance at x = 50 I have a = 01.7589   on your graph it is around 2.4
The graph agrees with your results; but you have to look more closely due to a slight loss of resolution in the upload of the figure.

For the complete table, just open up the spreadsheet. You can use the free office link that I provided earlier. (I verified that it is compatible with this spreadsheet.)
>> I do not see where j, h, r, or k enter into the given equation  
h and r are essential model parameters

j and k are introduced by rrz as temporary variables, apparently for cleaner looking code.
>is the middle term      +6/(C-6)    or    +(6/C)-6   ?
(6/C) - 6  
In the general case,
a = (r *tan(b) + h/cos(b) - h)/r - b
In this case,
a = tan(arccos(C)) +6/C - 6  -  arccos(C)  
by the way,
C = cos(b)
>j and k are introduced by rrz as temporary variables, apparently for cleaner looking code.
They made the calculations much easier and allowed eghtebas to find some simplifications.

phoffric>but your OP says:for the range of  x=0 to 1000  
That was my idea. Its not really necessary now
phoffric>(I verified that it is compatible with this spreadsheet.)  
Great!
I am working on the animation applet. I won't take the time to look at Excel at this time. Thanks for the info.
I got the attached file but I am not sure I used your equation ex.jpg ex.jpg
Thank you.
Here is graph and data for 0..60.
User generated image
x	a(x)	j=x/h	C(j)
0	0.000	0.00	1.00
1	0.001	0.02	1.00
2	0.003	0.03	1.00
3	0.007	0.05	1.00
4	0.013	0.07	1.00
5	0.021	0.08	1.00
6	0.030	0.10	1.00
7	0.040	0.12	0.99
8	0.053	0.13	0.99
9	0.067	0.15	0.99
10	0.082	0.17	0.99
11	0.099	0.18	0.98
12	0.118	0.20	0.98
13	0.138	0.22	0.98
14	0.159	0.23	0.97
15	0.182	0.25	0.97
16	0.207	0.27	0.97
17	0.233	0.28	0.96
18	0.260	0.30	0.96
19	0.289	0.32	0.96
20	0.319	0.33	0.95
21	0.351	0.35	0.95
22	0.384	0.37	0.94
23	0.418	0.38	0.94
24	0.453	0.40	0.93
25	0.490	0.42	0.93
26	0.528	0.43	0.92
27	0.568	0.45	0.92
28	0.608	0.47	0.91
29	0.650	0.48	0.91
30	0.693	0.50	0.90
31	0.737	0.52	0.90
32	0.782	0.53	0.89
33	0.828	0.55	0.88
34	0.875	0.57	0.88
35	0.923	0.58	0.87
36	0.973	0.60	0.87
37	1.023	0.62	0.86
38	1.074	0.63	0.86
39	1.126	0.65	0.85
40	1.180	0.67	0.84
41	1.234	0.68	0.84
42	1.289	0.70	0.83
43	1.345	0.72	0.83
44	1.401	0.73	0.82
45	1.459	0.75	0.81
46	1.517	0.77	0.81
47	1.577	0.78	0.80
48	1.637	0.80	0.80
49	1.697	0.82	0.79
50	1.759	0.83	0.79
51	1.821	0.85	0.78
52	1.884	0.87	0.77
53	1.948	0.88	0.77
54	2.012	0.90	0.76
55	2.077	0.92	0.76
56	2.143	0.93	0.75
57	2.209	0.95	0.75
58	2.276	0.97	0.74
59	2.344	0.98	0.73
60	2.412	1.00	0.73

Open in new window

:aburr,

I just saw your post after accepting the answer. I couldn't open ex.jpg (in Windwos 7) I don't know why?