|
who can help me to solve the problem about 30 exercise in chapter 11, Graph Theory [Reinhard Diestel, 2005] or 30 exercise in chapter 8, Graph Theory [Reinhard Diestel, 2005] ?thanks!!!!!!!!! 
|
|
|
|
|
|
Hi,
I am trying to write a VC++ application that will increase the CPU load on a Windows machine.
I am specifically trying to make this application take up say 'X'% of the total CPU usage. Though I have a few ideas in mind like trying to run some sort of indefinite loop, I can't make or even restrict the app to take up only 'X'% of the CPU clock cycles.
I would really appreciate any ideas for algorithms from the creative geniuses out there that would load the CPU to about 'X'% (Need not be exactly 'X', a generous approximation would do for me!). Pls do have in mind that 'X' is a variable here (I'm thinking of at least 4 possible values - 25, 50, 75, 95/100).
Thanks in advance!
~Rennie.
|
|
|
|
|
I guess that you were looking for this[^] article?
I are troll
|
|
|
|
|
Hi,
a simple control engineering approach:
TimeSpan some=33milliseconds;
forever {
if (getCumulativeCPUload() < wantedCPUload) busyLoop(some);
else sleep(some);
}
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks for the suggestions!
But I guess I didn't really spell out my question properly. I am not looking for a way to make a random value approximate to a given 'X' value and I also do know how to get CPU usage data from the system. ...
What I am looking for are ideas to load the CPU and in the process control exactly how much CPU usage my application (that will host the algorithm) will generate!
For example when I tried to execute something like this - sqrt(rand()) - inside a indefinite loop, I am able to generate considerable CPU usage, but then I can't control exactly how much this would take up. So the requirement is for 'a generic algorithm which will load the CPU in a controlled arithmetic fashion (not haphazardly) & also manipulate how much CPU it uses up simply by taking a different set of input values'.
Hope I've made my query clear! So any ideas?
|
|
|
|
|
"Exactly" isn't possible, as you're not the only running proces. Luc [^]has posted you some pseudocode that can be used to load the CPU to a specified percentage.
Here's a possible implementation of that pseudocode;
static void SimulateProcessorLoad(int wantedCPUload)
{
PerformanceCounter cpuCounter = new PerformanceCounter()
{
CategoryName = "Processor",
CounterName = "% Processor Time",
InstanceName = "_Total"
};
do
{
if (cpuCounter.NextValue() < wantedCPUload)
busyLoop();
else
Thread.Sleep(33);
} while (true);
}
The idea's; use a PerformanceCounter to get the current CPU-load. If the load is too high, do a Sleep . If the load isn't high enough, fake some processing
I are troll
|
|
|
|
|
hi all,
Can anyone tell me the math behind this MS Excel functions. I am writing software for iPhone and I want to use the functionality like FV function of Excel.Also i want to only pass first three argument
|
|
|
|
|
Buy a CRC manual, or any basic business math textbook. Both contain formulas for calculating future values, though the CRC manual uses tables rather than formulas for the calculations.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi, please give me some hints as how to do this.
Assuming a three-bit exponent field and a four-bit mantissa, write the 8-bit pattern for the following decimal values:
a.13.0
b.0.3125
A. 13.0
positive so first bit 0
exponent = 000
mantissa = 1101
=0000 1101
B. 0.3125
=3.125x10-1
positive so first bit 0
exponent = offset by 4 because 2^3 = 8 / 2 = 4 ... so 4 - 1 = 3 = 011 in binary
Mantissa = 3.125 = 0011.001
= 0011 0011.001
is this correct? please help
|
|
|
|
|
Sadaiyappan wrote: is this correct? please help
I'm not telling.
This smells like a home work to me. I never, never, was afraid of passing wrong answer. Besides the objective of going to school is learning not getting marks. If I make a mistake, there lies an opportunity to learn.
why don't you pass it as it is, and wait to see what comes out. That way you learn. Either it will reinforce what you know or you will learn from your mistake.
What do you think?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
I would say:
13.0 <=> 01101010
3.125 <=> 01001001
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
the mantissa would be correct for those FP formats that hide the first mantissa bit.
There are several conventions about exponent offset, I haven't met yours yet.
The OP's format was not fully defined.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: There are several conventions about exponent offset, I haven't met yours yet.
Trying to mimic this [^], my exponent is biased with 3 .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
how do simplify this expression: a'b+ab' into one using just AND and OR statements?
|
|
|
|
|
Hi,
that looks like a trick question.
Either your inputs are A, A', B and B' so you already have the solution (2 ANDs, 1 OR)
or your inputs are just A and B, and you are supposed to come up with A' and B' yourself, which is impossible when only having AND and OR gates.
However you could create any combinatorial function you desire from an unlimited number of NAND gates
(that is an AND gate followed by an inverter); same for NOR gates.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
The expression is a XOR function, and it can't be done without at least a NOT operator available to you, unless you assume you have all four inputs at hand. As Luc pointed out, you can implement it using NAND and NOR logic, because you can use either as a NOT operator, but it can't be done with only A and B as inputs, and AND and OR as operators. Your teacher is either an idiot, or a tricksy hobbit.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Hi, please help me with this problem, I have been trying it for hours now and am getting no where.
Imagine a machine with four inputs and one output that functions as follows: the output is on (1) if exactly two of the inputs are on (1) and off (0) otherwise.
ok this is what i get using min terms:
A B C D x
A.B 1
A.C 1
A.D 1
B.C 1
B.D 1
C.D 1
so i get this : (A*B*C'*D') + (A*B'*C*D')+(A*B'*C'*D)+(A'*B*C*D')+(A'*B*C'*D)+(A'*B'*C*D)
now this is confusing me.. am i supposed to draw this out? If i draw it out i will have 16 inputs not 4...
|
|
|
|
|
You've already solved it; your equation is correct. It produces a 1 for the six situations where exactly two inputs are on.
There are four inputs, labeled (not surprisingly) A, B, C, and D. Each has a second branch (going through an inverter if this is a circuit) that gives the complement of the input. The resulting eight signals go into the six AND functions you've identified, and the output of these ANDs goes into an OR with six inputs and one output.
If this equation describes a circuit, the eight signals are drawn going into six AND gates (drawn like a capital 'D' for the word "and"), and the outputs (from the curved part of the Ds) go into an OR gate (which looks like this http://www.eng.cam.ac.uk/DesignOffice/mdp/electric_web/Digital/04108.png[^])
The whole circuit (called a "sum of products") resembles this: http://www.cise.ufl.edu/~mssz/CompOrg/Figure3.8-AdderCkt2.gif[^]
|
|
|
|
|
Could anyone please help me out as I am in need of code to calculate BER and MSE related to audio steganography,in matlab
|
|
|
|
|
hi all,
Can anyone tell me the math behind this MS Excel functions. I am writing software for iPhone and I want to use the functionality like CUMIPMT function of Excel to calculate interest
CUMIPMT(rate,nper,pv,start_period,end_period,type) Returns the cumulative
interest paid on a loan between start_period and end_period.
CUMIPMT(rate,nper,pv,start_period,end_period,type)
Rate is the interest rate.
Nper is the total number of payment periods.
Pv is the present value.
Start_period is the first period in the calculation.
Payment periods are numbered beginning with 1.
End_period is the last period in the calculation.
Type is the timing of the payment.
Type Timing
0 (zero) Payment at the end of the period
1 Payment at the beginning of the period
|
|
|
|
|
|
If you happen to know the amount of the payment (assuming equal payments), there's a shortcut. Multiply the number of payments by the payment amount, then subtract the original balance. This takes a lot fewer calculations than summing all the individual interest amounts, and I suspect that might be important in a handheld device.
If you don't know the payment amount, calculate it from:
Pmt = Amt * (int / ((1 - (1 + int)^(-n)) where
Amt = Initial Principal Balance
Pmt = Payment amount each period
int = Interest rate (in decimal form) for the period
n = number of periods.
The value of int can be calculated by dividing the annual interest rate by the number of payments per year. If you're assuming 10% per year, with monthly payments, int would be .10/12; if payments are made weekly, int = .10/52.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
That's only assuming your payments are going towards principle and interest equally. Most payments go preferentially towards the interest at the beginning of the mortgage. The amount that goes to principle depends on the interest rate.
|
|
|
|
|
No, that's fully amortized, with more interest at the start than the end. The (1 + i) factor is what does the trick, unless I made a typo above - I'll check that and correct it if I screwed up.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|