This course will introduce you to C++ 11 and teach you about syntax fundamentals.

I have following two equations (r and h are constants):

x=x(b)=r (cos(b)+ tan(b)sin(b)-1)+ tan(b)h (eq. 1)

a =a(x,b)= (1/r)*sqrt((h + rsin(b))^2 + (x + r - rcos(b))^2) - b-h/r (eg. 2)

to make it readable, if we assume S=Sin(b), C=Cos(b), and T=tan(b), then we get:

x=x(b)=r (C+ TS -1)+ Th <-- these forms may be useful may be not

a =a(x,b)= (1/r)*sqrt((h + rS)^2 + (x + r - rC)^2) - b-h/r;

I want to have the following functions if possible:

a(x)=....? (eq. 3)

b(x)=....? (eq. 4) <-- this one is not that important.

Question: Is it possible to find a(x) and b(x) having (eq. 1) and (eq. 4) above?

for background discussions please see: http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html

Thank you

x=x(b)=r (cos(b)+ tan(b)sin(b)-1)+ tan(b)h (eq. 1)

a =a(x,b)= (1/r)*sqrt((h + rsin(b))^2 + (x + r - rcos(b))^2) - b-h/r (eg. 2)

to make it readable, if we assume S=Sin(b), C=Cos(b), and T=tan(b), then we get:

x=x(b)=r (C+ TS -1)+ Th <-- these forms may be useful may be not

a =a(x,b)= (1/r)*sqrt((h + rS)^2 + (x + r - rC)^2) - b-h/r;

I want to have the following functions if possible:

a(x)=....? (eq. 3)

b(x)=....? (eq. 4) <-- this one is not that important.

Question: Is it possible to find a(x) and b(x) having (eq. 1) and (eq. 4) above?

for background discussions please see: http://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html

Thank you

Do more with

EXPERT OFFICE^{®} is a registered trademark of EXPERTS EXCHANGE^{®}

Also, if a is defined as taking two parameters then how do you drop one? How do you get from a(x,b) to just a(x)? The only way I could think of where that would make sense would be if b cancelled out of the equation, but it's not going to.

We need a lot more info before we can answer this question.

By eq. 1, you may get

x = r (C+ TS -1)+ Th

=> x = (r-rC)/C + Sh/C

=> Cx - (r-rC) = Sh

=> C (x +r) -r = Sh ...... (eq. 5)

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

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

By solving eq.6,

C = [2r(x+r) + sqrt(4r^2(x+r)^2-4[(x+r)^2

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

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

or

C = [2r(x+r) - sqrt(4r^2(x+r)^2-4[(x+r)^2

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

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

a = (1/r)*sqrt((h + rS)^2 + (x + r - rC)^2) - b-h/r

= (1/r)*sqrt(h^2+2rSh + r^2S^2 + (x+r)^2 - 2r(x+r)C + r^2C^2) - b - h/r

= (1/r)*sqrt(h^2 +(x+r)^2+2r(C(x+r)-r) -2r(x+r)C+r^2)-b-h/r // By substituting (eq. 5) into Sh

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

By substituting eq. 7 into eq. 9

a = (1/r)*sqrt((x+r)^2+h^2-r^2

or

a = (1/r)*sqrt((x+r)^2+h^2-r^2

I verified pkwan's math and it looks good. He used the trig identities S^2 + C^2 = 1 and S/C = T to derive eq 6 and the quadratic formula to derive eqs 7 and 8. The rest is just pretty simple algebra. Very well done.

Don't forget that when you introduce an ArcCos, you need to constrain the domain.

====

>> x = 10 (cos(b)+ tan(b)sin(b)-1)+ tan(b)60

When b = 0, then x is 0 and vice-versa

http://www.wolframalpha.com/input/?i=10+%28cos%28b%29%2B+tan%28b%29sin%28b%29-1%29%2B+tan%28b%2960+for+b%3D0+to+pi%2F2

====

>> a(0,b) = (1/10)*sqrt((60 + 10sin(b))^2 + (0 + 10 - 10cos(b))^2) - b-60/10

When b and x are 0, a is 0

http://www.wolframalpha.com/input/?i=%281%2F10%29*sqrt%28%2860+%2B+10sin%280%29%29%5E2+%2B+%280+%2B+10+-+10cos%280%29%29%5E2%29+-+0-60%2F10

====

But, ...

>> a = (1/r)*sqrt((x+r)^2+h^2-r^2

So, for equivalency, if x = 0, then a should be 0, but..

http://www.wolframalpha.com/input/?i=%281%2F10%29*sqrt%28%28x%2B10%29%5E2%2B60%5E2-10%5E2%29+-60%2F10+-+ArcCos%28%5B10%28x%2B10%29+-++60+sqrt%28-10%5E2%2B%28x%2B10%29%5E2%2B60%5E2%29%5D+%2F+%5B%28x%2B10%29%5E2%2B60%5E2%5D%29%2C+for+x+%3D+0+to+45

====

On another note, not related to this question, when looking at the graphs, it appears that the relationship between a and b is suspect, since for large x, then a small change in b should result in a large change in a. See related question: http://rdsrc.us/qNFw9P

## Premium Content

You need an Expert Office subscription to comment.Start Free Trial