An exercise in mathiness



  • @DaveK said:

    @joeyadams said:
    This is why math functions should always have 'units' attributes. Certain functions are only valid on unitless parameters, like inverse trig functions, logarithms, etc.

    Units attributes tied to each value would cost a substantial amount of extra memory and CPU power.  There's no good reason to include such a feature in a programming language unless it's for a computer algebra system.  In reality, the programmer will know he/she did something wrong when the program doesn't work :)

    Units wouldn't be done as attributes, you'd use the language's type system to implement them. 

    A post or two above described a units system via attributes, and that's what I was criticizing.  I'm all for compile-time type checking, this kind included :)

    @joeyadams said:

    Except you'll get [laid] by units that aren't really units, like degrees, radians, decibels, etc.

    Decibels certainly are units.  Degrees are deprecated and should not be used for future development.

    WTF?  Decibels are a dimensionless ratio.  Degrees are a physical unit like radians.

    My bad on the decibels.  I should have checked my facts on that one :)

    As for degrees, I was saying they should be deprecated in favor of radians and perhaps grads instead.  Degrees are for ancient Babylonian navigators who counted in base 6 :)



  •  @joeyadams said:

    WTF?  Decibels are a dimensionless ratio.  Degrees are a physical unit like radians.

    Don't forget radians are also a dimensionless ratio.



  • @joeyadams said:

    As for degrees, I was saying they should be deprecated in favor of radians and perhaps grads instead.  Degrees are for ancient Babylonian navigators who counted in base 6 :)

    I thought they counted in base 60. And although degrees shouldn't be (and aren't) used much in 'real' science or mathematics, they're quite useful for the average person who is just trying to express how far something turned around, what with 360 having a lot of divisors*, and just generally being a rational number. Remember, there are non-idiot children who don't know about fractions, irrational numbers, or using Greek letters to represent them. Argh, I just accidentally elaborated my response to the point where it actually takes your statement seriously. Forget I said all that. Also, wow, I hadn't used grads for so long that I'd forgotten what they were. Yeah, let's switch to grads, and also Swatch beats (because time and angles used to be related, you know, back when people had analogue clocks, and the whole hour/minute/second thing is for ancient Babylonian navigators who counted in base 60, using symbols made up of those for 10, 5 and 1 if I remember correctly) for the unmathed masses (scientists may apply for a special pass to be allowed to continue using radians and seconds), and watch the chaos.

    • Note that I do not support the use of that same argument in favour of imperial measurements, largely because although 12 also has some nice divisors, 1000 is also easy to compute with (for multiplication too) and an integer, so there's not quite the huge usability contrast that there is between pi radians and 180 degrees. Ooh, I know, let's have a flamewar about that.


  • Degrees are deprecated? We use radians in math because it's more convenient for many things, but for non-mathies, it's probably a lot easier to say "throw the ball at 45 degrees angle" than saying "throw the ball at pi over 4".



  • Pi over four has less syllables than 45 degrees, though :)  It'd be nicer if people could say "throw the ball at a 50 grads angle" without getting blank stares ;)



  • @vyznev said:

    I suppose a language that did dimensional analysis (preferably at compile time) for numeric values could be useful for engineering etc.

    My TI-89 does that. It will even show the correct units for the intended operations, for example:

    5 Kg * 9.81 m/s^2 = 49.05 N

    The programming language fully supports the units, and also does unit conversion, so it gives a lot of flexibility with whatever you want to do.



  • http://www.boost.org/doc/libs/1_37_0/doc/html/boost_units.html

     

    Compile time checking for units and whatnot in C++.



  • I am looking right now (without looking at the answer):

    For one thing, you don't enter an angle if you want to calculate the arcsin, arccos, arctan. (The numbers are correct however, if you convert 30 degrees to radians and pass the result to asin,acos,atan, but it still is not sensible)

    The asin,acos,atan returns a angle, it doesn't take a angle as the parameter!

    I think whoever wrote the textbook just doesn't understand trigonometry.

    Sorry, I don't see another thing wrong with it (maybe I'm not looking very closely?), other than, why don't you have a book?


Log in to reply