fred rosenberger

lowercase baba
+ Follow
since Oct 02, 2003
fred likes ...
Chrome Java Linux
St. Louis
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by fred rosenberger

Ryan McGuire wrote:Fred, any update?

no..I'm sort of torn between wanting to know, and not wanting to embarrass my daughter.  To be honest, I'm satisfied with the "contrived example, and you shouldn't plug steradians into the sine function" answer.

If/when we have parent teacher conferences, i may ask about it, but honestly, i doubt the teacher will know either.  I used to be a secondary school math teacher, and i don't remember ever being taught anything like this...
1 week ago
i'm probably going to ask the math teacher, too.  I'm sure they hate parents like me.

It probably is a 100% contrived example meant to show the difference between (sin theta)^2 and sin (theta^2)...but it bugs me when I can't see why stuff doesn't work.
3 weeks ago

Campbell Ritchie wrote:Is she really supposed to evaluate sinθ²?

yes, it truly was sin(θ²).  There were 5-6 problems, and a different one was to evaluate sin²θ

Campbell Ritchie wrote:Neither degrees nor radians have dimensions; does each even have a square at all?

does the number 2 have a dimension?  I think not. but i know it has a square.

and my research shows that the square of a radian is a Steradian, or square radian. It is used in 3-d geometry, referring to a solid angle of a sphere.  It's sort of like the area where a cone starting at the center of a sphere intersects the surface of said sphere.
3 weeks ago
I was helping my daughter with her trig homework the other day. I'm a bit rusty, admittedly, but I don't know what i'm doing wrong on one problem.

we are given that θ = pi / 3.  We were asked to compute sin (θ^2).

That's pretty straightforward, using a calculator, and getting about 0.8897.

but then things goto weird.  I know that pi/3 = 60 degrees.  When i do substitution, i get sin(60^2), which is sin(3600), or zero.

I know i'm doing something wrong - there must be a hidden assumption i'm making, but i just don't see what I'm doing wrong.

3 weeks ago
If i recall correctly, once an int reaches the maximum value and is incremented, it rolls over to the lower bound negative value, and starts counting back up to zero.  

Note that this is something you can test with a simple program.  Just set your variable to Integer.MAX_VALUE, print it, add one, print it again.

Now, there is no way for us to tell what impact this might have on your program.  you might have "take the sqrt of the number", which would cause a problem.  You might have "use this as an index on an array - which could cause a problem. You might only be able to display 5 digits..There are many, many ways it could cause a problem, any or all of which might be in your code.
isn't javac.exe a file like anything else?  Why can't you rename it?
3 weeks ago
So many people get confused on this, we have a FAQ devoted to it.
4 weeks ago
As a side note, I think you approached this problem the wrong way.  No offense - I think you were set up wrong by the teacher.

You shouldn't approach any programming problem with "How do I use X to accomplish Y?".  The danger is you might be doing the equivalent of asking "How do I use a hammer to tighten a hex-nut?"  There probably is a way you could do it, but it may not be the best option for you.  It certainly could be - and in this case, using Math.abs can be useful...but it's not how you should approach the problem.

The first thing you should do is figure out how you, personally, would solve it using pencil and paper.  THEN try and figure out how you'd explain to a 3rd grade child how THEY can do it.  Only when you are done doing that should you start thinking about what tools Java has to let you do what you want.

just my 2 cents.
1 month ago

wayne brandon wrote:how could i compare if there is the same number in each, like the 2?

Just a tip...programmers tend to be extremely literal.  When you say 'int vale', programmers think about the full value of the number.  What you really want to do is find the set of digits in each of two numbers, and find the intersection.

One of the hardest jobs of coding is coming up with clear, well defined, and complete specs.  Writing code is about 90% thinking, and only 10% typing.
1 month ago
the unix cron i'm familiar with only goes to minutes...possibly seconds in some versions, but that's not one i've ever seen

I think millisecond timing would be rather hard, since you never know when you will get your cpu time. If something else is hogging the system, you may have to wait a while...
2 months ago
my concern with using "mary" is that there is nothing to prevent you from doing this:

Now both "mary" and "ruth" point to the same object...but which is it?

is there a reason you need a reference to each one? Why not use a collection (array, list, etc)?  
2 months ago
You shouldn't worry about performance unless you have a documented spec on what the performance should be.  "As fast as possible" is NOT a valid spec.  "less than 10 milliseconds" is.  

You should almost always focus on readability and maintenance over speed.  After all, if you save 1 millisecond by optimizing code, but then spend 20 hour debugging it in the future, you're probably going to be at a net loss - especially since a user won't ever notice the savings.
2 months ago
personally, I wouldn't try and write a monolithic expression that covers all the bases.  Your requirement are bound to change over time, and if you have a single expression, it gets EXTREMELY hard to adjust it later. It's almost impossible to adjust it without breaking something else.

I would instead consider writing many small expressions, each contained in their own boolean method, then aggregate those...

Now it's much easier to swap in and out various conditions as your requirements change.
2 months ago
Woody, Sam, Carla and Diane worked at the bar. Sam was an alcoholic, so he never drank (liquor).  

Norm, Cliff, Frasier and Lilith were regulars at the bar.
2 months ago
We also have the Cattle Drive.  The problems are posted and you can use them. If you want formal reviews, there is a fee for that.
3 months ago