|
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
|
|
|
|
|
Take a look at the source code to Graph[^]. This has C++ code for calculating curves through points using Logs, Polynomials etc.
It worked very well for me, I did do a conversion to C# a while ago.
BTW, you didn't say if you wanted source code or just advice since you can do this in Excel given enough time and patience. The Graph source code as most (or all, I can't remember) of the methods which Excel uses when curve fitting.
Sig cops got me...
|
|
|
|
|
BRShroyer wrote: 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.
if you have evenly spaced measurements you can use Catmull-Rom splines[^].
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Art of Problem Solving[^]
"A real programmer wishes there was a command-line version for every application and then proceeds to write a GUI to wrap around it." - Bassam Abdul-Baki
|
|
|
|
|
Hi guys
I would like to copy a process's module. This is how the scenario looks:
Lets say that there is a process called "Main.exe" and it loads plenty of modules and 2 of the modules that it loads are:
1. "Copyer"
2. "Checker"
Now i want to somehow modify something in the module called "Copyer" but if i do that then Checker(which scans this module once in a while) will find out that i have changed something and then exit. So what i have come up with is that i have to somehow copy the Copyer module and then inject it in Main.exe then make this Checker to somehow scan that copyed/injected module instead of the original Copyer module.
Could someone please help me to figure out a way to copy a module and make this Checker scan the copied one instead of the original one?
Thanks
|
|
|
|
|
What I used was a string buffer array. Because an original C buffer is continuous memory blocks, it makes it easy to partition it off. Or you can use a structure which does the same thing.
struct {<br />
char findstring[64];<br />
char licensename[64];<br />
time_t licensedate;<br />
time_t licenselen;<br />
unsigned long crc32a;<br />
unsigned long licensedfeatures;<br />
char licensekey[64];<br />
} lincenseinfo;
this does not take into account someone adjusting the clock unless you write the last date of operation somewhere. That is where it takes some long thinking and hard writing to secure only in software. Eventually you realize it is impossible to secure only in software and deal.
But the process is easy. from an external EXE you can scan the binary EXE of your code looking for the findstring value (any string you want to use, even random characters you pregenerated, but you have to know what to search for). By searching for and finding that start of buffer, you know where the rest of the values are. Set in your license times, CRC validations (optional) and the name of your licensee and their key. The key is based on the same information, name, product, date, length of license and any other related information. You then generated a validated buffer and write it into the file replacing the entire buffer within the already compiled EXE.
Inside your code you verify the information in the buffer matches. If it does not, you exit, or disable features, or turn on demo mode, etc. If the buffer all cross-verifies, then you proceed as a licensed product.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|