|
Harold,
Yes, I was referring to SSE2. Almost everyone has it. And, I just never worry about the voting, but it seems seems other Helpful Harrys have bumped it up.
Dave.
|
|
|
|
|
in my experience, a table lookup can go a long way, using either an 8-bit or a 16-bit index, and repeating for each 8/16-bit fraction of the data.
And then, are you sure you need the count? and nothing else?
chances are counting the bits is bus bandwidth limited already, so combining it with another operation may pay off big time.
|
|
|
|
|
Anyone know a desktop calculator that takes mixed hex and decimal inputs?
Tadeusz Westawic
An ounce of Clever is worth a pound of Experience.
|
|
|
|
|
Windows 7 calculator does this, and I know there are other freebies out there. Google will tell you - ask for programmer calculator.
It's time for a new signature.
|
|
|
|
|
new sig
Tadeusz Westawic
Caveat juris excretorium.
|
|
|
|
|
Tadeusz Westawic wrote: mind is failing in old age
Sounds like me!
It's time for a new signature.
|
|
|
|
|
In my opinion Google is a good way to study!
|
|
|
|
|
where is the algorithm question?
|
|
|
|
|
Didn't Math forum get consolidated to this room? This is not forum for Math question?
Tadeusz Westawic
An ounce of Clever is worth a pound of Experience.
|
|
|
|
|
This forum used to be called "Math and Algoritms" or something similar. But the math unfortunately had to go, so now it is about algorithms only. Advice on software selection is mostly handled in the Lounge now.
|
|
|
|
|
The Windows XP calculator allows this too.
|
|
|
|
|
The Windows Vista calculator has an option for hex calculations...choose the scientific option from the view menu.
|
|
|
|
|
Thanks All,
The salient feature I needed was mixing radices in same operation which the VISTA calculator allows.
Thanks once more.
Tadeusz Westawic
Caveat juris excretorium.
|
|
|
|
|
|
I'm looking for a solution to an equation that looks familiar, but I've forgotten too much in 30 years. I'm hoping one of our younger folks ( or mathematically skilled old farts ) can help.
Given the equation:
4R/D = Φ - sinΦ
what is the value of Φ given that D is constant, and R is known from other independent calculations? WolframAlpha came up with a nice graph, but I need an analytic solution that I can use to return a definite numeric answer to the calling program. Any solutions out there?
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I don't think that has an analytical solution, but it's pretty easy to solve numerically by using one of various techniques to find the root of
Φ - sin(&Phi) - (4*R/D) = 0.
Since -1 <= sin(&Phi) <= 1, you should be able to find an excellent starting point for iterating.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
That wasn't the answer I was hoping for, but you may be right. This may come down to solving a problem in more than one variable, using linear programming techniques or some other optimization methodology. The problem set involves a flow of fluid through a pipe; I want to be able to vary the slope of the pipe, or change the amount of liquid dumped into it and predict what the depth of water will be under steady state conditions; transient analysis is completely beyond my pay grade.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I agree with Walt, a few iterations of Newton-Raphson[^] should solve that numerically.
|
|
|
|
|
yup Newton Raphsom method would do it.
Also It would be helpful to find out what are the ranges of possible values of phi, say if phi belongs in -1 to 1 you can apply sine series formula to phi.
|
|
|
|
|
The equation is modeling a physical phenomenon (water streaming in a pipe), I don't know all the details, however I'm confident it will be well behaved, have a simple first guess (say 10 degrees), and converge easily.
|
|
|
|
|
What do the variables represent? Is there a way to determine reasonable variable limits? For example, if you know that Φ must be between +/- 2 Π that limits the solutions and table look up or a curve fit to the solution might be good enough. How much precision do you need?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I was thinking perhaps a cubic spline solution...
The variables are part of the equation for fluid flow in a pipe, and Φ represents the angle from horizontal a line drawn from the center of the pipe to the intersection of the line marking the top of the fluid within.
V = (1.485/n)* R2/3 * S1/2, ft/sec.
S is the slope of the pipe, and n is a very small number that varies with the smoothness of the pipe - a common value is .013. R is called the 'hydraulic radius' and is given by the ratio of the area of flow to the wetted perimeter in the pipe. Calculating that area value is what hurts my head.
It's fairly straightforward to calculate the flow, given everything else, but I'm trying to predict a level in the pipe from a given flow and slope. That's not what the equation is designed for, though there's no reason not to use it this way. If I can't find a reasonable way to do it, I may have to resort to Bernoulli's equation, with all those nasty energy calculations and differential equations. We hates those...
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Roger Wright wrote: I was thinking perhaps a cubic spline solution...
A cubic spline would be an approximation, i.e. a curve fitting a couple of points. Calculating it would be more complex than solving the equation itself, and the results would not be all that accurate.
|
|
|
|
|
Sure, Manning's equation. It's been awhile since I worked with single phase open channel flow. S should be the slope of the hydraulic head (potential gradient) if I recall. That's not the same as the pipe slope, unless the head loss is negligible or the pipe is full. If it's full, then Darcy-Weisbach is a better way to estimate and if you're in fully turbulent flow, the friction factors can be estimated quite easily, but it's still probably not an analytic solution.
I'm not sure I understand what Φ is in relation to the hydraulic gradient and/or pipe slope, though. Where does the Φ come in?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
I doubt that Manning's is the right equation to use, but having searched out a number of public building codes I've found that all of them require sewer flows to be calculated using it. Even crazier, most of them specify that n = .013 be used, regardless of the pipe material. Darcy-Weisbach is probably better, but the only application I've found using it requires reading values from a nomograph - ridiculous! IIRC, I believe it requires knowledge of the viscosity and flow characteristics, as well, little of which is known at design time. I can estimate %solids from the measurements taken from the influent at the sewer processing plant, but even then I probably have areas with wildly different fluid properties.
The angle Φ is used to calculate the area of fluid in a pipe that isn't full. Picture a circle with a line drawn through it representing the fluid level. A line from the center of the circle to the point where the fluid level intersects the circle makes the angle Φ with the horizontal.
I've got some more figuring to do, I guess. Or perhaps I should just keep it simple.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|