Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
This is findind limit calculus one. This would be very easy but i never factor high degrees. can anyone show me how to factor it.
lim((x^5-32)/(x-2),x=2)
lim((x^5-2^5)/(x-2),x=2)
As John suggested in the comments above: when x-->2 we handle a limit of type 0/0. In order to calculate it we use the derivative of the numerator and a derivative of the denominator:
f'(X^5-2^5) = 5x^4
---------- ----
f'(x-2) = 1
if we'll substitute x with 2 we'll get:
5*2^4
----- = 80
1
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm creating a PostgreSQL DB where I'll store some users, so I need to know which is the exact size (MB) of each user.
This is my reasoning :
Profile picture : JPEG 15 Mb 75% = up to 1,8 MB
name + surname + work : 20 characters each so = 60 B
date of birth : timestamp = 8 B
bio : up to 500 characters = 500 B
For a total of (approximately) 2,5 MB.
So if I have 1 GB of available space on the DB I will store up to 400 users.
Is it right? Am I missing something?
I would not store the image binary data in the database, this is not a good idea. Store it in azure blob storage and just store the url to it. At least not in the database, make the database as small and fast as possible or you will get issues later down the line. e.g. indexing with large columns will make queries slow down in time.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have the following problem in dynamic programming.
A person has time machine and he can move in time either 1 year or 2. At the beginning he is at year 0 and he wants to reach year 100. Every step he does (1 or 2 years) he is paying some fixed fees. There is an array with 100 integers represents the fee he needs to pay if he went threw the specific year.
I need to find the minimum amount the person can pay to go from year 0 to year 100 using dynamic programming.
From what i have done so far i think that there should be something like
minCost(i) = min{A[i-1], A[i-2]}
and the base cases are years 1 and 2 which costs A[1], A[2] respectively. But i think this approach has more of greedy algorithm rather than dynamic programming.
I saw the bin packing algorithm of dynamic programming and i understood it and the matrix that represents it.
How should the matrix of the shown problem above look like?
And how should i build the function and the pseudo code for this problem?
You are almost there.
Think about how will you reach the i th year from i-1 th year and i-2 th year. There is a fee which you are forgetting to take into consideration.
MinCostToReachYear(i) = min( MinCostToReachYear(i-1) + fee(i-1), MinCostToReachYear(i-2) + fee(i-2) )
You already know the base cases year 1 and year 2. Can you think of extrapolating with the use of a for loop or more easily with a recursive function which you already know as mentioned above? I leave it as an exercise for you.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In 1.2.1 Mathematical Induction section, Knuth presents mathematical induction as a two steps process to prove that P(n) is true for all positive integers n:
a) Give a proof that P(1) is true;
b) Give a proof that "if all P(1), P(2),..., P(n) are true, then P(n+1) is also true";
I have serious doubt about that. Indeed, I believe that point b) should be:
b) Give a proof that "if P(n) is true, then P(n+1) is also true". The major difference here is that you are only assuming that P(n) is true, not P(n-1), etc.
However, these books are old and have been read by many people (most of them being much more clever than I am^^).
So what is my confusion here?
The entire point here is that the choice of n is arbitrary. Since P(n) implies P(n+1) is the conerstone of induction, then all the intermediate values between 1 and n will also hold under the assumption of P(n). You are supposed to show that if P(0) implies P(1) and P(n) implies P(n+1) then all conditions hold by the nature of n being arbitrary.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
---------------------
| AbstractPersister |
---------------------
^
/ \
---
|
------------------
| OrderPersister |
------------------
^
/ \
---
|
--------- ---------
| Offer |<>---| Item |
--------- ---------
The above is ascii art for a UML class diagram. I have a domain class called "offer" which contains items. E.g. an offer for a trip which costs 500 bucks and contains a bus ticket, a nights stay at a motel and a show.
When the customer checks out of the store, the offer is persisted to the database as an order containing order items.
Would it make sense in a pure object oriented design to make the offer inherit from an OrderPersister? The OrderPersister can get a connection to the database using its super class, the AbstractPersister. I want to add a method to OrderPersister called Book, which will create the order and its items in the database.
If this is a bad design, what alternatives are there? I want this to be as object oriented as possible please.
Before extending a class, you should ask this question: is a?
Is an Offer an OrderPersister? I say it's not.
You should take a look at the Data Mapper pattern. It will let you use domain objects that know nothing about persistence, and still be able to persist them.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I learn cryptography at my university, and I need to make an application for testing numbers as prime numbers.
I must to do it using Lehmann Test, but I don't know anything about it. Please, describe me the algorithm or give me an example (Java, C#, C++, etc). Thank you for helping.
Let's call PP your Potential Prime.
(1) Choose a random number a less than PP.
(2) Calculate a^(p-1)/2 mod PP.
(3) If a^(PP-1)/2 /= 1 or -1 (mod PP), then PP is not prime.
(4) If a^(PP-1)/2 = 1 or -1 (mod PP), then the probability that PP is not prime is less than 50%.