I hope to explain this accurately.
I have 12 dichotomous variables (yes/no) for which I want to compute a new variable that includes those who answered Yes to 3 or more of these 12 variables.
I'm a bit soft on my programming these days so am having difficulty constructing a statement (in the GUI - not as syntax).
Can anyone offer some help/guidance how I may accomplish this?
Thank you very much.
Compute threeplus = sum(x1 to x12) >= 3.
Related
Can anyone help with a formula / equation to help with my problem?
I'm trying to do (reverse) the following..........
I know the Base Price to be 250
The no. of orders are 8
Each order increases at scale of 1.5
=250*(1.5^7) = 4271.48 total
Im trying (and failing) to come up with a formula to reverse the above equation to provide me with the the Base Price (assuming I now know the total, in addition to the no of orders and the scale)
i.e what formula would I use to get the Base Price, assuming I know know the total is 4271.48 (based on the same 8 orders and scale of 1.5)
I've attached a quick spreadsheet to help describe my problem!
https://docs.google.com/spreadsheets/d/1hzHwvYbXWH8Pkpvf8K7GVyAFcgLWeRuTUcN9A1S52Hg/edit?usp=sharing
Thank you in advance :-)
Try this one. Use - in power.
=B17*(1.5^-7)
I'm trying to solve the recurrence f(n)=2f(n/2)+logn when f(1)=1 and n is a power of 2. I think that I should be able to do this using the master method. I've seen this before, but never with log. Can I get some help getting started, please?
One trick that’s often useful here is to replace the log n term with something that grows strictly faster or slower and to see what you get. For example, your recurrence is bounded from above and below, respectively, by these recurrences:
A(n) = 2A(n / 2) + √n.
B(n) = 2A(n / 2) + 1.
What do these solve to? What does that tell you about your recurrence?
What does the different symbols mean when coding? such as * < > != # and why are they needed? how do I know which ones to use. and Which words to use to begin a code like including a save option? I have read the course work downloaded additional Wiki docs. Python.org tutorials and I have not found any answers to my questions.
They are called operators, and they perform some operation on the values associated with them (known as operands). For example, 1 * 2 means to multiply (operator *) 1 and 2 (the operands) and return the product.
You should seek more intensive programming education before attempting to implement a save option. Your question is very basic and indicates that you are still learning the basics. Keep at it! The greatest writers of all time once had to spend time learning their ABC's and how to sound out words.
In my application I need to determine what the plates a user can load on their barbell to achieve the desired weight.
For example, the user might specify they are using a 45LB bar and have 45,35,25,10,5,2.5 pound plates to use. For a weight like 115, this is an easy problem to solve as the result neatly matches a common plate. 115 - 45 / 2 = 35.
So the objective here is to find the largest to smallest plate(s) (from a selection) the user needs to achieve the weight.
My starter method looks like this...
-(void)imperialNonOlympic:(float)barbellWeight workingWeight:(float)workingWeight {
float realWeight = (workingWeight - barbellWeight);
float perSide = realWeight / 2;
.... // lots of inefficient mod and division ....
}
My thought process is to determine first what the weight per side would be. Total weight - weight of the barbell / 2. Then determine what the largest to smallest plate needed would be (and the number of each, e.g. 325 would be 45 * 3 + 5 or 45,45,45,5.
Messing around with fmodf and a couple of other ideas it occurred to me that there might be an algorithm that solves this problem. I was looking into BFS, and admit that it is above my head but still willing to give it a shot.
Appreciate any tips on where to look in algorithms or code examples.
Your problem is called Knapsack problem. You will find a lot solution for this problem. There are some variant of this problem. It is basically a Dynamic Programming (DP) problem.
One of the common approach is that, you start taking the largest weight (But less than your desired weight) and then take the largest of the remaining weight. It easy. I am adding some more links ( Link 1, Link 2, Link 3 ) so that it becomes clear. But some problems may be hard to understand, skip them and try to focus on basic knapsack problem. Good luck.. :)
Let me know if that helps.. :)
I have been looking into a development issue that requires the use of pseudorandom number generation to allow the same set of random numbers to be generated for a given seed.
I have currently been looking at using long random(void) and void srandom(unsigned seed) for this (man page), and currently these are generating the same set of random numbers in a Mac app, an iOS app and an iOS app (64-bit) which is what I was hoping. The iOS tests were only in the simulator so I don't know whether this will affect the result.
My main concerns is that this algorithm could change at some point, making the applications we're developing effectively useless with old data. What are the chances of these algorithms changing / being different on a future device?
I'd say it's extremely likely they will change as the sequence is not guaranteed by any standard.
Why not use your own random number sequence? Even a simple linear congruential generator satisfies most statistical properties of randomness. Here is the formula for such a generator:
next_number = (a * current_number + b) % c
with
a = 1103515245
b = 12345
c = 4294967296
These values of a, b, c give you good statistical properties and are quite well known for building quick and dirty generators.
I don't have the slightest idea about the answer to the question you ask.
If a related question is "How can I be absolutely sure to have the same pseudo-random sequences generated in 10 years time ?", the answer to this question is : don't rely on an external library, write the code explicitly.
Bathsheba proposed this generator. You can google for "pseudo random generator algorithm". Here is a list of algorithms listed on wikipedia.
In fact, srandom did change since Mac OS X 10.7, according to this blog post. However, this was due
to the way srandom was implemented: it tried to access an uninitialized local variable, which
is undefined behavior in C. According to the post, the new compiler used since Mac
OS X 10.7 optimized out the uninitialized memory access, changing its behavior in subtle
ways.