Skip to main content
1-Visitor
December 17, 2012
Solved

Define variables for multiple functions

  • December 17, 2012
  • 2 replies
  • 1875 views

I have defined variables for phi and delta. I used these variables in a function which came to the correct result. I used them in another function right below and was given the wrong value. After substituting the variable with the actual value, I got the right answer. How do I define the variables correctly for more than a single function? FIle is attached. Please advise.

Best answer by RichardJ

With a quadratic in phi that must be an empirical formula, therefore the coefficients assume phi is a numerical value, but with particular implicit units. In this case, degrees. You must therefore divide phi by that unit in the formula. If you do it this way, rather than manually entering the numeric values, the formula will work whether you define phi in degrees or radians.

2 replies

1-Visitor
December 17, 2012

In the term (0.8152-0.0545phi+0.001771*phi^2), you can not substitute in 34 for phi. That has to be converted to radians.

1-Visitor
December 17, 2012

The function was based on regression analysis of phi and delta in degree. So I cannot convert them to radian. As you can see in the calcualtion below. Both phi and delta were input in degee. The calcualted value (i.e., 4.731) is the correct answer. I think the problem is related to how to define phi and delta as globle variables. Any other suggestions?

1-Visitor
December 17, 2012

Oh, so those coefficients were from a regression that you performed elsewhere. Hmmm, in that case, the coefficients actually do contain some sort of units. Are you doing the regression in Excel. I would recommend one of two things:

1) Repeat the regression in radians. This basically eliminates the need for units (at least in terms of angles).

2) Do the regression in Mathcad!

RichardJ19-TanzaniteAnswer
19-Tanzanite
December 17, 2012

With a quadratic in phi that must be an empirical formula, therefore the coefficients assume phi is a numerical value, but with particular implicit units. In this case, degrees. You must therefore divide phi by that unit in the formula. If you do it this way, rather than manually entering the numeric values, the formula will work whether you define phi in degrees or radians.

1-Visitor
December 18, 2012

It is correct. Thanks.