# Re: subexpressions (OT: math)

Discussion in 'Python' started by Steve Howell, Jun 2, 2007.

1. ### Steve HowellGuest

--- Steven D'Aprano
<> wrote:

> On Sat, 02 Jun 2007 05:54:51 -0700, Steve Howell
> wrote:
>
> >>
> >> def f(x): y = x*x; return sin(y)+cos(y);
> >>

> >
> > Although I know valid trigonometry is not the

> point of
> > this exercise, I'm still trying to figure out why
> > anybody would ever take the square of an angle.
> > What's the square root of pi/4 radians?

>
> Approximately 0.886 radians. It corresponds to the
> angle of a point on the
> unit circle quite close to (sqrt(2/5), sqrt(3/5)),
> or if you prefer
> decimal approximations, (0.632, 0.775).
>
> Angles are real numbers (in the maths sense), so
> just as reasonable an angle as pi/4 radians. Both
> are irrational numbers
> (that is, can't be written exactly as the ratio of
> two integers).
>

Yes, I understand that, but what is the geometrical
meaning of the square root of an arc length? And what
would the units be? If you take the square root of an
area, the units change from acres to feet, or from
square meters to meters.

____________________________________________________________________________________
Got a little couch potato?
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz

Steve Howell, Jun 2, 2007

2. ### Steven D'ApranoGuest

On Sat, 02 Jun 2007 08:29:59 -0700, Steve Howell wrote:

>
> --- Steven D'Aprano
> <> wrote:
>
>> On Sat, 02 Jun 2007 05:54:51 -0700, Steve Howell
>> wrote:
>>
>> >>
>> >> def f(x): y = x*x; return sin(y)+cos(y);
>> >>
>> >
>> > Although I know valid trigonometry is not the

>> point of
>> > this exercise, I'm still trying to figure out why
>> > anybody would ever take the square of an angle.
>> > What's the square root of pi/4 radians?

>>
>> Approximately 0.886 radians. It corresponds to the
>> angle of a point on the
>> unit circle quite close to (sqrt(2/5), sqrt(3/5)),
>> or if you prefer
>> decimal approximations, (0.632, 0.775).
>>
>> Angles are real numbers (in the maths sense), so
>> just as reasonable an angle as pi/4 radians. Both
>> are irrational numbers
>> (that is, can't be written exactly as the ratio of
>> two integers).
>>

>
> Yes, I understand that, but what is the geometrical
> meaning of the square root of an arc length?

about the square root of an angle.

> And what would the units be?

Angles are a ratio of two lengths, and are therefore dimensionless units.
So the square root of an angle is just another angle, in the same units,
and it requires no special geometric interpretation: the square root of 25
degrees (just an angle) is 5 degrees (just another angle).

(Note: I see that the Unix program "units" does not agree with me. It
tries to use angles as dimensionless in some contexts, but taking roots is
not one of those cases.)

Arc lengths are dimensional lengths. While you can take the square root of
a length, it doesn't have any (obvious) geometrical or physical
interpretation. One might even say it is meaningless, e.g. you can always
say that the square root of (say) 9 feet is 3 feet**(1/2), but there is no
physical meaning to that -- it doesn't correspond to anything measurable.

> If you take the square root of an
> area, the units change from acres to feet, or from
> square meters to meters.

Yes, because areas have dimension L**2, so square-rooting them has the
obvious geometrical interpretation of asking "what length, when squared,
has this area?".

I've seen interpretations of fractional powers of length as scaling
factors for fractals. It's a nice interpretation, but not meaningful in
this context.

--
Steven.

Steven D'Aprano, Jun 3, 2007

3. ### Leonhard VogtGuest

>> Yes, I understand that, but what is the geometrical
>> meaning of the square root of an arc length?

>
> That's a different question to your original question, which was asking
> about the square root of an angle.
>
>> And what would the units be?

>
> Angles are a ratio of two lengths, and are therefore dimensionless units.
> So the square root of an angle is just another angle, in the same units,
> and it requires no special geometric interpretation: the square root of 25
> degrees (just an angle) is 5 degrees (just another angle).

But sqrt(25°) = sqrt(25/180*pi) = 5*sqrt(180/pi) != 5°

Leonhard

Leonhard Vogt, Jun 3, 2007
4. ### Steven D'ApranoGuest

On Sun, 03 Jun 2007 09:02:11 +0200, Leonhard Vogt wrote:

>> Angles are a ratio of two lengths, and are therefore dimensionless units.
>> So the square root of an angle is just another angle, in the same units,
>> and it requires no special geometric interpretation: the square root of 25
>> degrees (just an angle) is 5 degrees (just another angle).

>
> But sqrt(25°) = sqrt(25/180*pi) = 5*sqrt(180/pi) != 5°

Hmmm... perhaps that's why the author of the "units" program doesn't
treat angles as dimensionless when taking square roots.

Given that, I withdraw my claim that the sqrt of an angle is just an
angle. I can't quite see why it shouldn't be, but the evidence is fairly
solid that it isn't.

--
Steven

Steven D'Aprano, Jun 3, 2007
5. ### Guest

On 3 , 14:05, Steven D'Aprano <>
wrote:
> On Sun, 03 Jun 2007 09:02:11 +0200, Leonhard Vogt wrote:
> >> bla-bla

>
> Hmmm... perhaps that's why the author of the "units" program doesn't
> treat angles as dimensionless when taking square roots.
>
> Given that, I withdraw my claim that the sqrt of an angle is just an
> angle. I can't quite see why it shouldn't be, but the evidence is fairly
> solid that it isn't.
>
> --
> Steven

angle is dimensionless unit.
To understand it: sin() can't have dimensioned argument. It is can't
to be - sin(meters)

it is difficult to invent what is a "sqrt from a angle" but it can be.

, Jun 3, 2007
6. ### Gary HerronGuest

wrote:
> On 3 , 14:05, Steven D'Aprano <>
> wrote:
>
>> On Sun, 03 Jun 2007 09:02:11 +0200, Leonhard Vogt wrote:
>>
>>>> bla-bla
>>>>

>> Hmmm... perhaps that's why the author of the "units" program doesn't
>> treat angles as dimensionless when taking square roots.
>>
>> Given that, I withdraw my claim that the sqrt of an angle is just an
>> angle. I can't quite see why it shouldn't be, but the evidence is fairly
>> solid that it isn't.
>>
>> --
>> Steven
>>

>
> angle is dimensionless unit.
>

Of course not! Angles have units, commonly either degrees or radians.

However, sines and cosines, being ratios of two lengths, are unit-less.
> To understand it: sin() can't have dimensioned argument. It is can't
> to be - sin(meters)
>

> it is difficult to invent what is a "sqrt from a angle" but it can be.
>

I don't know of any name for the units of "sqrt of angle", but that
doesn't invalidate the claim that the value *is* a dimensioned
quantity. In lieu of a name, we'd have to label such a quantity as
"sqrt of degrees" or "sqrt of radians". After all, we do the same
thing for measures of area. We have some units of area like "acre", but
usually we label areas with units like "meters squared" or "square
meters". That's really no stranger than labeling a quantity as "sqrt
of degrees".

Gary Herron, PhD.
Department of Computer Science
DigiPen Institute of Technology

Gary Herron, Jun 3, 2007
7. ### Guest

On 3 , 21:43, Gary Herron <> wrote:
> wrote:
>
> > angle is dimensionless unit.

>
> Of course not! Angles have units, commonly either degrees or radians.
>
> However, sines and cosines, being ratios of two lengths, are unit-less.> To understand it: sin() can't have dimensioned argument. It is can't
> > to be - sin(meters)

>
> No it's sin(radians) or sin(degrees).> it is difficult to invent what is a "sqrt from a angle" but it can be.
>
> I don't know of any name for the units of "sqrt of angle", but that
> doesn't invalidate the claim that the value *is* a dimensioned
> quantity. In lieu of a name, we'd have to label such a quantity as
> "sqrt of degrees" or "sqrt of radians". After all, we do the same
> thing for measures of area. We have some units of area like "acre", but
> usually we label areas with units like "meters squared" or "square
> meters". That's really no stranger than labeling a quantity as "sqrt
> of degrees".
>
> Gary Herron, PhD.
> Department of Computer Science
> DigiPen Institute of Technology

angle is a ratio of two length and dimensionless.
http://en.wikipedia.org/wiki/Angle#Units_of_measure_for_angles

only dimensionless values can be a argument of a sine and exponent!
Are you discordant?

, Jun 3, 2007
8. ### Guest

On 3 , 22:07, "" <> wrote:
>
> angle is a ratio of two length and dimensionless.http://en.wikipedia.org/wiki/Angle#Units_of_measure_for_angles
>
> only dimensionless values can be a argument of a sine and exponent!
> Are you discordant?

if you are discordant read more :
sine is a dimensionless value.
if we expand sine in taylor series sin(x) = x - (x^3)/6 + (x^5)/120
etc.
you can see that sin can be dimensionless only if x is dimensionless
too.

I am a professional physicist and a know about what I talk

, Jun 3, 2007
9. ### Cameron LairdGuest

In article <4662675b\$>,
Leonhard Vogt <> wrote:
>>> Yes, I understand that, but what is the geometrical
>>> meaning of the square root of an arc length?

>>
>> That's a different question to your original question, which was asking
>> about the square root of an angle.
>>
>>> And what would the units be?

>>
>> Angles are a ratio of two lengths, and are therefore dimensionless units.
>> So the square root of an angle is just another angle, in the same units,
>> and it requires no special geometric interpretation: the square root of 25
>> degrees (just an angle) is 5 degrees (just another angle).

>
>But sqrt(25°) = sqrt(25/180*pi) = 5*sqrt(180/pi) != 5°
>
>Leonhard

Yes it is; that is, if you're willing to countenance the square root
of an angle at all, then there should be no problem swallowing

sqrt(pi radians / 180) = 1 sqrt(degree)

so that

sqrt(25 degrees) = sqrt(25) * sqrt(pi radians / 180)

= 5 * sqrt(degree)

If it helps, we can call

zilth := sqrt(pi radians / 180)

Measured in square-roots of a degree, a zilth is numerically 1.

Cameron Laird, Jun 3, 2007
10. ### Wildemar WildenburgerGuest

wrote:
> if you are discordant read more :
> sine is a dimensionless value.
> if we expand sine in taylor series sin(x) = x - (x^3)/6 + (x^5)/120
> etc.
> you can see that sin can be dimensionless only if x is dimensionless
> too.
>
> I am a professional physicist and a know about what I talk
>
>

No you don't. I'm a student of physics, and I know better:

First of all, what you have presented here is called the MacLaurin
series. It is however a special case of the Taylor series, so you are
correct. I just thought I'd let you know. (Sorry to sound like a bitch
here, i love smartassing )

Let me start by saying that *if* x had a dimension, none of the terms in
your expansion would have the same dimension. A well well-versed
physicist's head should, upon seeing such a thing, explode so as to warn
the other physicists that something is terribly off there. How (ye
gods!) do you add one metre to one square-metre? You don't, that's how!

OK, the *actual* form of the MacLaurin series for some function f(x) is

f(x) = f(0) + x/1! f'(0) + x^2/2! f''(0) + ...

So in each term of the sum you have a derivative of f, which in the
case of the sine function translates to sine and cosine functions at the
point 0. It's not like you're rid of the function just by doing a
polynomial expansion. The only way to *solve* this is to forbid x from
having a dimension. At least *I* see no other way. Do you?

/W
(Don't take this as a personal attack, please. I'm a good guy, I just
like mathematical nitpicking.)

Wildemar Wildenburger, Jun 4, 2007
11. ### Wildemar WildenburgerGuest

Gary Herron wrote:
> Of course not! Angles have units, commonly either degrees or radians.
>
> However, sines and cosines, being ratios of two lengths, are unit-less.
>
>> To understand it: sin() can't have dimensioned argument. It is can't
>> to be - sin(meters)
>>
>>

> No it's sin(radians) or sin(degrees).
>

NO!
The radian is defined as the ratio of an arc of circumfence of a circle
to the radius of the circle and is therefore *dimensionless*. End of story.

*grunt*

Wildemar Wildenburger, Jun 4, 2007
12. ### Steven D'ApranoGuest

On Sun, 03 Jun 2007 11:26:40 -0700, wrote:

> if you are discordant read more :
> sine is a dimensionless value.
> if we expand sine in taylor series sin(x) = x - (x^3)/6 + (x^5)/120
> etc.
> you can see that sin can be dimensionless only if x is dimensionless
> too.
>
> I am a professional physicist and a know about what I talk

I am confused why you get different results for the square root of an
angle depending on whether you use degrees or radians:

sqrt(25°) = 5° = 0.087266462599716474 radians

If angles are dimensionless numbers, then:

should equal

but they don't.

How do you interpret the square root of an angle? What does it mean?

--
Steven.

Steven D'Aprano, Jun 4, 2007
13. ### Gary HerronGuest

Wildemar Wildenburger wrote:
> Gary Herron wrote:
>
>> Of course not! Angles have units, commonly either degrees or radians.
>>
>> However, sines and cosines, being ratios of two lengths, are unit-less.
>>
>>
>>> To understand it: sin() can't have dimensioned argument. It is can't
>>> to be - sin(meters)
>>>
>>>
>>>

>> No it's sin(radians) or sin(degrees).
>>
>>

>
> NO!
> The radian is defined as the ratio of an arc of circumfence of a circle
> to the radius of the circle and is therefore *dimensionless*. End of story.
>
> *grunt*
>

No, not end-of-story. Neither of us are being precise enough here. To
"Although the radian is a unit of measure, it is a dimensionless
quantity."

But NOTE: Radians and degrees *are* units of measure., however those
units are dimensionless quantities , i.e., not a length or a time etc.

The arguments to sine and cosine must have an associated unit so you
know whether to interpret sin(1.2) as sine of an angle measured in
degrees or radians (or whatever else).

Gary Herron

Gary Herron, Jun 4, 2007
14. ### Lloyd ZusmanGuest

"Steven D'Aprano" <> writes:

> On Sun, 03 Jun 2007 11:26:40 -0700, wrote:
>
>> if you are discordant read more :
>> sine is a dimensionless value.
>> if we expand sine in taylor series sin(x) = x - (x^3)/6 + (x^5)/120
>> etc.
>> you can see that sin can be dimensionless only if x is dimensionless
>> too.
>>
>> I am a professional physicist and a know about what I talk

>
> I am confused why you get different results for the square root of an
> angle depending on whether you use degrees or radians:
>
> sqrt(25°) = 5° = 0.087266462599716474 radians
>
> If angles are dimensionless numbers, then:
>
>
> should equal
>
>
> but they don't.

That's because for arbitrary functions f and g,

f(g(x)) is not equivalent to g(f(x))

This has nothing to do with whether or not x is a dimensionless number.

(replace "f" with "degrees_to_radians" and "g" with "sqrt")

--
Lloyd Zusman

God bless you.

Lloyd Zusman, Jun 4, 2007
15. ### Erik Max FrancisGuest

Gary Herron wrote:

> Of course not! Angles have units, commonly either degrees or radians.

...
> I don't know of any name for the units of "sqrt of angle", but that
> doesn't invalidate the claim that the value *is* a dimensioned
> quantity. In lieu of a name, we'd have to label such a quantity as
> "sqrt of degrees" or "sqrt of radians". After all, we do the same
> thing for measures of area. We have some units of area like "acre", but
> usually we label areas with units like "meters squared" or "square
> meters". That's really no stranger than labeling a quantity as "sqrt
> of degrees".

What he (probably) means is that the only proper unit of angle is
dimensionless, i.e., the radian. All the rest are different ways of
measuring things that technically violate rules of dimensional analysis.

In practice, it doesn't much matter, since angles are usually nicely
stuffed inside trigonometric functions, e.g., r = A sin theta. The
problem occurs when, via calculus, angles get pulled out of
trigonometric substitution. This can happen via the chain rule easily
enough. For the example r(t) = A sin theta(t) with A constant, the
derivative

v(t) = dr/dt = A (d/dt) sin theta(t) = A dtheta/dt cos theta.

dtheta/dt is the time rate of change of an angle, and since it appears
outside of a trigonometric function, must be expressed in units of
radians per unit time or you'll get the wrong answers for v(t). Using
alternate units (deg, grad, gon, rev, etc.) for expressing the angle
here is not an option; you must use radians, which are technically just
another name for a dimensionless figure.

The radian is defined as the length of the subtended arc divided by the
length of the radius, which is a length divided by a length, and thus
dimensionless. (Like in a lot of dimensional analysis, you write "rad"
when desired to give a helpful hint, not because it's necessary; the
radian has the same units as 1.)

--
Erik Max Francis && && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
There never was a good war or a bad peace.
-- Benjamin Franklin

Erik Max Francis, Jun 4, 2007
16. ### Erik Max FrancisGuest

Gary Herron wrote:

> No, not end-of-story. Neither of us are being precise enough here. To
> "Although the radian is a unit of measure, it is a dimensionless
> quantity."
>
> But NOTE: Radians and degrees *are* units of measure., however those
> units are dimensionless quantities , i.e., not a length or a time etc.

They're both "unit of measure" in some general sense, I suppose, but
only one is dimensionless. pi/2 rad = pi/2. 90 deg != 90. Of the
plane angles, only radians are dimensionless, and of the solid angles,
only steradians are dimensionless. This is because they're defined as
the ratio of two quantities with similar dimensions (length for radians

> The arguments to sine and cosine must have an associated unit so you
> know whether to interpret sin(1.2) as sine of an angle measured in
> degrees or radians (or whatever else).

The problem with this reasoning is when angular-dimensioned quantities
pop out of trigonometric functions, which happens routinely in the world
you're screwed.

--
Erik Max Francis && && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
There never was a good war or a bad peace.
-- Benjamin Franklin

Erik Max Francis, Jun 4, 2007
17. ### Wildemar WildenburgerGuest

Gary Herron wrote:
>> The radian is defined as the ratio of an arc of circumfence of a circle
>> to the radius of the circle and is therefore *dimensionless*. End of story.
>>
>>
>>

>
> The arguments to sine and cosine must have an associated unit so you
> know whether to interpret sin(1.2) as sine of an angle measured in
> degrees or radians (or whatever else).
>

Touché.

Yes, I think we can all agree on that.

/W

Wildemar Wildenburger, Jun 4, 2007
18. ### stefGuest

Gary Herron wrote:
> Wildemar Wildenburger wrote:
>
>> Gary Herron wrote:
>>
>>
>>> Of course not! Angles have units, commonly either degrees or radians.
>>>
>>> However, sines and cosines, being ratios of two lengths, are unit-less.
>>>
>>>
>>>
>>>> To understand it: sin() can't have dimensioned argument. It is can't
>>>> to be - sin(meters)
>>>>
>>>>
>>>>
>>>>
>>> No it's sin(radians) or sin(degrees).
>>>
>>>
>>>

>> NO!
>> The radian is defined as the ratio of an arc of circumfence of a circle
>> to the radius of the circle and is therefore *dimensionless*. End of story.
>>
>> *grunt*
>>
>>

> No, not end-of-story. Neither of us are being precise enough here. To
> "Although the radian is a unit of measure, it is a dimensionless
> quantity."
>
> But NOTE: Radians and degrees *are* units of measure., however those
> units are dimensionless quantities , i.e., not a length or a time etc.
>
> The arguments to sine and cosine must have an associated unit so you
> know whether to interpret sin(1.2) as sine of an angle measured in
> degrees or radians (or whatever else).
>
> Gary Herron
>
>
>

Sorry about entering the discussion so late,
and not sure I repeat one of the messages.

But can't we see it this way:
radians / degrees (which one 360 or 400) are just mathematical
scaling factors,
like kilo, mega etc.

If a wheel is turning around at
does something physical change is we leave the radian out
the wheeel is turning at
100 [1/sec]

No it's now called frequency, and has just some different scaling.

Yes, in electronics the noise density is often expressed in [nV/SQRT(Hz)]

cheers,
Stef Mientki

stef, Jun 4, 2007
19. ### Erik Max FrancisGuest

Wildemar Wildenburger wrote:

> So in each term of the sum you have a derivative of f, which in the
> case of the sine function translates to sine and cosine functions at the
> point 0. It's not like you're rid of the function just by doing a
> polynomial expansion. The only way to *solve* this is to forbid x from
> having a dimension. At least *I* see no other way. Do you?

That was precisely his point. The Maclaurin series (not MacLaurin) only
makes any sense if the independent variable is dimensionless. And thus,
by implication, so it is also the case for the original function.

--
Erik Max Francis && && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM, Y!M erikmaxfrancis
The time to repair the roof is when the sun is shining.
-- John F. Kennedy

Erik Max Francis, Jun 4, 2007
20. ### Wildemar WildenburgerGuest

Erik Max Francis wrote:
> Wildemar Wildenburger wrote:
>
>
>> So in each term of the sum you have a derivative of f, which in the
>> case of the sine function translates to sine and cosine functions at the
>> point 0. It's not like you're rid of the function just by doing a
>> polynomial expansion. The only way to *solve* this is to forbid x from
>> having a dimension. At least *I* see no other way. Do you?
>>

>
> That was precisely his point. The Maclaurin series (not MacLaurin) only
> makes any sense if the independent variable is dimensionless. And thus,
> by implication, so it is also the case for the original function.
>
>

No that was not his point. Maybe he meant it, but he said something
profoundly different. To quote:

wrote:
> if we expand sine in taylor series sin(x) = x - (x3)/6 + (x5)/120 etc.
> you can see that sin can be dimensionless only if x is dimensionless too.

This argumentation gives x (and sin(x)) the option of carrying a unit.
That however is *not* the case. This option does not exist. Until
someone proves the opposite, of course.

Geez, I love stuff like that. Way better than doing actual work.

/W

(PS: THX for the MacLaurin<>Maclaurin note. I can't help that
appearantly; I also write 'LaGrange' all the time.)

Wildemar Wildenburger, Jun 4, 2007