Avatar of Mike Eghtebas
Mike Eghtebas
Flag for United States of America asked on

x(b) ... a(x,b) ... to give a(x)

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: https://www.experts-exchange.com/Programming/Languages/Scripting/Q_27237703.html

Thank you
Math / Science

Avatar of undefined
Last Comment
Mike Eghtebas

8/22/2022 - Mon

What is b(x)? I don't see b shown as a function anywhere.
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.
Mike Eghtebas

re:> What is b(x)? I don't see b shown as a function anywhere

lets ignore b(x).  But, if we had it in a much simpler form say x=rcos(b) then

b=ArcCos(x/r)    and now we have b(x)=ArcCos(x/r)

re:> Also, if a is defined as taking two parameters then how do you drop one? How do you get from a(x,b) ...

This is why I am posting the question here hoping someone familiar with chain function possibly could come up with the answer.

Peter Kwan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Okay I get it. So b(x) actually is important because you replace b in the a(x,b) equation with b(x). I've never seen equations expressed as functions, but it makes sense.

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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck

When x = 0, a should be 0...

>> x = 10 (cos(b)+ tan(b)sin(b)-1)+ tan(b)60
   When b = 0, then x is 0 and vice-versa


>> 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

But, ...
>> a = (1/r)*sqrt((x+r)^2+h^2-r^2) -h/r - ArcCos([r(x+r) -  h sqrt(-r^2+(x+r)^2+h^2)] / [(x+r)^2+h^2]) ... (eq. 11)

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



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
Mike Eghtebas

Hi pkwan,

Thank you for the solution. I included the functions in a java program shown below to test the equations.

At x=0, I was expecting to get zero for both a and b, but I am getting:

angle a       angel b    x
 -02.81  02.81  00.00
 -02.79  02.80  00.25
 -02.78  02.80  00.50

 -00.01  02.26  23.75
 00.03  02.25  24.00
 00.07  02.25  24.25
 00.11  02.25  24.50
 00.15  02.24  24.75
 00.19  02.24  25.00

 06.26  01.94  59.50
 06.30  01.93  59.75

Most likely this dicrepency is due to my mistkes converting from your math equation to java equations shown below:

I will go over it to locate my mistakes.
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;
      System.out.println("angle a\t angel b    x");
      for(double x = 0; x < 60; x +=0.25){
//b = ArcCos([r(x+r) +  h sqrt(-r^2+(x+r)^2+h^2)] / [(x+r)^2+h^2]) ................... (eq. 7)
          b = Math.acos((r*(x+r) -  h*Math.sqrt(-Math.pow(r,2)+Math.pow((x+r),2)+
                  Math.pow(h,2))) / (Math.pow((x+r),2)+Math.pow(h,2)));
// a = (1/r)*sqrt((x+r)^2+h^2-r^2) -h/r - ArcCos([r(x+r) -  h sqrt(-r^2+(x+r)^2+h^2)] / [(x+r)^2+h^2]) ... (eq. 11)
//          System.out.println(" " + df.format(a*(180/Math.PI)) + "  " + df.format(b*(180/Math.PI)) + "  " + df.format(x));
          System.out.println(" " + df.format(a) + "  " + df.format(b) + "  " + df.format(x));

Open in new window

Mike Eghtebas

Hi phoffric,

I didn't see your post.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Mike Eghtebas

I should have used:

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

a = (r *tan(b) + h/cos(b) - h)/r - b                                 (eg. 2) much simpler

x = r (C+T S -1)+T/h                                                       (eq. 1a)
a = (r T + h/C - h)/r - b                                                   (eg. 2a)

now will try the solution from pkwan on these two equations,

Mike Eghtebas


I wonder if you have some time to take a look at this:


Thank you,