|
Good find.
It always takes me an age to translate something from the book into CS, this is a real time saver!
|
|
|
|
|
The former link is also mentioned in the latter. So it might be.
LOL.. Got me to 'CLICK'
|
|
|
|
|
Hi!
I'm just looking for your thoughts and ideas on what would be the most elegant way to implement a system of Si units in C++.
Cheers,
--
Mike
|
|
|
|
|
Units are only semantic definitions over the variables used in your applications.
In your design, you should mention that all values are in SI units, and offer appropriate conversions functions between base units ( meter, kilogram, ... ) and alternative unit type (inches, pound, onces, ... )
after that, it's only a matter of enforcing, really not hard, those rules.
or maybe I did not understand what you want.
|
|
|
|
|
Maximilien wrote: Units are only semantic definitions over the variables used in your applications.
This need not be the case. An interesting discussion can be found here[^] in the Boost documentation. Code can be found in the Boost vault here[^].
Steve
|
|
|
|
|
An interesting discussion can be found here[^] in the Boost documentation. Code can be found in the Boost vault here[^].
Steve
|
|
|
|
|
it still is semantics.
in their example of multiplication
F = m . a
quantity<float,force> f = m * a;
you have to distinct "dimensions" one mass (FG) and one acceleration( m/s ) and the result which is a force ( newton )
they all have disctinct semantics, and the result is still valid.
for such a system to work in the context of symbolic equations ( F=MA )one would need to validate all combinations of operands dimensions that can result in another third dimensions.
quantity<float,mass> bogus = m * a; , they say it is not valid, but it's only mathematic/physic semantic
in that example, you will have to know and code that a Force is only Mass x Acceleration.
I think they are confusion symbolic expressions with numerical computation.
I don't believe I express myself correctly on that matter.
anyway, this is one great discussion!!!
|
|
|
|
|
The point of the Boost stuff is that you declare a type called "force", for example. You also have a type called "mass" and "acceleration". Now if you try to write f=mv ("f" is if type "force", "m" is of type "mass" and "v" is of type "velocity") you get a compiler error. If you just use normal numeric types no such checks are possible.
Steve
|
|
|
|
|
You are required to write a program which generates pie-chart using the given data during the development of an application. What will be the algorithm of your program
Asif
|
|
|
|
|
ch.Asif wrote: What will be the algorithm of your program
Ah, but of course it will be one that can generate pie-charts using the given data!
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
ch.Asif wrote: You are required to write a program which generates pie-chart using the given data during the development of an application. What will be the algorithm of your program
data.read()
data.process()
data.draw_piechart()
in steps 2&3, always remember: Any sufficiently advanced technology is indistinguishable from magic. – Arthur C. Clarke, 1962
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
data.read()
data.process()
If(Cherry)
data.draw_piechart(Cherry)
elseif (blueberry)
data.draw_piechart(bluebarry)
elseif(fruit)
.........
SORRY I just had to!
|
|
|
|
|
This sounds like a test question.
|
|
|
|
|
I'd use
3D Pie Chart By Julijan Sribar. Found on the Code Project!
|
|
|
|
|
Geee. I have to ask such a simple question but I AM SURE you folks are ALOT smarter than me! Especially at math! (But I work with with my hands like a Master!) Anyway, seemed so simple untill I tried to do it.. LOL..
Lets say you have a Joystick that inputs 0 to 1000 units. I want to limit the output to some variable (To keep it simple I'll use whole numbers) to some variable such as 40, 50, 60 etc. that gives a output that is from 0 to this variable in equal units?
I'm so STUPID at Math! Sorry my Left or Right brain not working for this simple problem!
|
|
|
|
|
divide the actual output by 1000, then multiply by your variable to get the new scaled output.
onew = (oold /1000) * var
|
|
|
|
|
SO SORRY I voted a 1 when I should have Voted a 5! I told you I was STUPID!
At first glance my brain said 1 was THE BEST..
Thank You.. DO not be to harsh on me.. I'm really a nice old man..
|
|
|
|
|
And if your joystick is connected to an embedded system with no hardware floating point support, you can keep everything in integer with good results by reordering the arithmetic:
onew = (oold * var) / 1000
You might have to cast the old variable to the next larger type to be sure you don't overflow and then cast back.
The evolution of the human genome is too important to be left to chance.
|
|
|
|
|
i think solution is in following steps
1.get the maximum value of the out put.say you get that for input 1000.
it means you would want to get myMaxLimit when you get maxOP
2.so now you can use follwoing formula to limit your input
desiredOP = (currentOP/maxOP)*myMaxLimit
sameer
|
|
|
|
|
I would like to add, to the other comments psted here, that you can also do integer rounding. For example:
(1456+500)/1000=1
(1677+500)/1000=2
As you can see 1456 gets rounded to 1 and 1677 gets rounded to 2. It is just like rounding floating point numbers 1.456 and 1.677. In fact, all values from 500 to 1499 will be rounded to 1, and all values from 1500 to 2499 will be rounded to 2.
Rogério Rilhas
|
|
|
|
|
Hi i'm a maths b student and i need some help with a question on a maths assignment, The question is:
The question asks me to find an equation fo each of the 5 parabolas of a bridge given that:
1. the width of the bridge is 40m
2. The maximum height of the road section at the top is 2m
3. The height of the tallest supporting parabola is 13m
4. The height of the smaller supporting parabolas is 8m.
I know the equation I need to use and it is
y = ax^2 + bx^2 + c
Then the equation goes to
y = a(x-p)^2 + q
Can you please help me out because I don't know how i should start it.
PLEASE HELP, ASAP
Any help would be much appreciated.
|
|
|
|
|
Try expressing height of a given parabola H as a function of its width at the base W (H(W))
|
|
|
|
|
I am hoping somebody can tell me the best method (and possibly links on more info for that method) to use for calculating a line that runs smoothly through a few data points. The points are positions on a fan blade and I am looking at trying to roughly calculate a line that would be the profile of the blade if it was cut along the points. I thought that knowing the the location of the peaks and valleys, and possibly a few extra data points, would allow me to interpolate the other points I need to make a complete profile. I would then do this in several areas to get the surface of the blade by interpolating in the two directions through the points.
My original idea was to use splines, but I am not sure this is the right way to go. More so because I am not sure how you go about calculating the equations to go through the points and how to separate the line into the different regions for the different equations. Since it is a surface, NURBS may be another option. But, if I am having difficulty with splines, what are my chances of figuring out NURBS?
Thanks for any help.
Brad
|
|
|
|
|
I'm not sure if it will be easier or harder than doing a cubic spline, but you may want to also look into Bezier curves to see if they can help you.
--
Marcus Kwok
|
|
|
|
|
I'm not sure if it would be easier or harder either.
I am still looking up information and have come across Bezier splines (which I found out use Bernstein polynomials, whatever those are? but are verified using de Casteljau's algorithm), Bezier curves, B-splines, and cubic splines. I am assuming they are all a different way to do the same thing.
I've been out of school for a little while and this is making my head hurt. I am finding a lot of theory and examples of plotting splines, but not many examples of getting the equations from the points.
Thanks.
Brad
|
|
|
|