text:
# commons-dev mailing list archives

##### Site index · List index
Message view
Top
From sebb <seb...@gmail.com>
Subject Re: [pool] 1.5-RC2 available for review
Date Mon, 01 Jun 2009 17:06:10 GMT
```On 01/06/2009, sebb <sebbaz@gmail.com> wrote:
> On 01/06/2009, sebb <sebbaz@gmail.com> wrote:
>  > On 01/06/2009, sebb <sebbaz@gmail.com> wrote:
>  >  > On 01/06/2009, Phil Steitz <phil.steitz@gmail.com> wrote:
>  >  >  > Phil Steitz wrote:
>  >  >  >
>  >  >  > > sebb wrote:
>  >  >  > >
>  >  >  > > > On 31/05/2009, sebb <sebbaz@gmail.com> wrote:
>  >  >  > > >
>  >  >  > > >
>  >  >  > > > > On 31/05/2009, Phil Steitz <phil.steitz@gmail.com>
wrote:
>  >  >  > > > >  > sebb wrote:
>  >  >  > > > >  >
>  >  >  > > > >  > > On 31/05/2009, Phil Steitz <phil.steitz@gmail.com>
wrote:
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  > > > sebb wrote:
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > > On 31/05/2009, Phil Steitz <phil.steitz@gmail.com>
wrote:
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > > Thanks to all who provided
feedback on RC1.
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >  Changes in RC2
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >  * Fixed copyright date in
NOTICE.txt
>  >  >  > > > >  > > > > >  * Restored development reports
>  >  >  > > > >  > > > > >  * Improved thread-safety
and timing/reliability in GOP,
>  >  >  > GKOP tests
>  >  >  > > > >  > -
>  >  >  > > > >  > > > > > thanks, sebb!
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > Unfortunately not enough, see below...
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > >  * Added link to release javadoc
in site.xml
>  >  >  > > > >  > > > > >  * Fixed xml errors in changes.xml
>  >  >  > > > >  > > > > >  * Added test for ErodingPerKeyKeyedObjectPool
>  >  >  > > > >  > > > > >  * Changed clirr comparison
version from 1.3 to 1.4
>  >  >  > > > >  > > > > >  * Added missing attributes
to sources jar manifest
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >  The files are here:
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > http://people.apache.org/~psteitz/commons-pool-1.5-RC2/
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > Source and binary archives agree
with each other; hashes and
>  >  >  > sigs OK.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > Unfortunately, I got a new test
failure with Java 1.4.2 and
>  >  >  > Maven:
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  >
>  >  >  > testEvictorVisiting(org.apache.commons.pool.impl.TestGenericKeyedObjectPool)
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >  Time elapsed: 0.063 sec  <<<
FAILURE!
>  >  >  > > > >  > > > > junit.framework.AssertionFailedError
>  >  >  > > > >  > > > >       at
>  >  >  > junit.framework.Assert.fail(Assert.java:47)
>  >  >  > > > >  > > > >       at
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > junit.framework.Assert.assertTrue(Assert.java:20)
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >       at
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > junit.framework.Assert.assertTrue(Assert.java:27)
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >       at
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  >
>  >  >  > org.apache.commons.pool.impl.TestGenericKeyedObjectPool.checkEvictorVisiting(TestGenericKeyedObjectPool.java:947)
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >       at
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  >
>  >  >  > org.apache.commons.pool.impl.TestGenericKeyedObjectPool.testEvictorVisiting(TestGenericKeyedObjectPool.java:810)
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > > I tried re-running the test, and
it was OK. Tried rebuild and
>  >  >  > retest -
>  >  >  > > > >  > OK.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > As far as I can tell, that particular
test does not use
>  >  >  > threads or
>  >  >  > > > >  > > > > timers as part of the test case,
so that suggests that there
>  >  >  > might be
>  >  >  > > > >  > > > > a timing/threading issue in the
main pool code.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > I'll try re-running the test case
a few more times to see if
>  >  >  > I can get
>  >  >  > > > >  > > > > it to go wrong again.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > Also, clearly the failure message
needs to be enhanced to
>  >  >  > show which
>  >  >  > > > >  > > > > of the following checks failed:
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > assertTrue(visitCount >= cycleCount
&&
>  >  >  > > > >  > > > >                           visitCount
<= cycleCount + 1);
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > Unfortunately a lot of the assertions
fail to provide any
>  >  >  > details of
>  >  >  > > > >  > > > > what has gone wrong, which make
debugging a lot harder.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >  Thanks for finding and looking into
this.  Should not be
>  >  >  > happening.
>  >  >  > > > >  > Sorry
>  >  >  > > > >  > > > the tests in general and this one in
particular are so cryptic.
>  >  >  >  What
>  >  >  > > > >  > this
>  >  >  > > > >  > > > one is doing is verifying that the evictor
visits idle
>  >  >  > instances in the
>  >  >  > > > >  > > > keyed pools in oldest-to-youngest order
and does not
>  >  >  > systematically miss
>  >  >  > > > >  > > > any.  What would be good to know at
the time of the failure
>  >  >  > above is the
>  >  >  > > > >  > > > values of the local variables visitCount,
cycleCount and
>  >  >  > totalInstances.
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > >
>  >  >  > > > >  > > Probably also the values of the enclosing
loop counts.
>  >  >  > > > >  > > It would perhaps be useful to not fail on
the first such error,
>  >  >  > but
>  >  >  > > > >  > > only fail when all the objects have been
checked, so one could
>  >  >  > see how
>  >  >  > > > >  > > many objects are not visited the expected
number of times.
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  > > > What is going on in this part of the
test is that  there are
>  >  >  > three keyed
>  >  >  > > > >  > > > pools randomly generated containing
a total of totalInstances
>  >  >  > idle
>  >  >  > > > >  > objects.
>  >  >  > > > >  > > > The evictor is run a random number of
times (between 10 and 60)
>  >  >  > and what
>  >  >  > > > >  > we
>  >  >  > > > >  > > > expect is that each instance in the
combined pool will be
>  >  >  > "visited"
>  >  >  > > > >  > either
>  >  >  > > > >  > > > cycleCount or cycleCount +1 times, where
>  >  >  > > > >  > > >  cycleCount = (runs *
>  >  >  > pool.getNumTestsPerEvictionRun())
>  >  >  > > > >  > /
>  >  >  > > > >  > > > totalInstances.  That is the assertion
that is failing.   I
>  >  >  > don't see
>  >  >  > > > >  > off
>  >  >  > > > >  > > > the top of my head how this can be timing
or
>  >  >  > concurrency-related.
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > >
>  >  >  > > > >  > > Could there be an issue with checking the
age?
>  >  >  > > > >  > > I don't know how the ages are compared, but
Java time resolution
>  >  >  > means
>  >  >  > > > >  > > multiple objects can be created in the same
time slot.
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  >  Not in this case.  The test that is failing is
not looking at age
>  >  >  > or
>  >  >  > > > >  > "evicting" instances because of age.  It is just
validating idle
>  >  >  > objects in
>  >  >  > > > >  > the pool (testWhileIdle = true).
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > > Could the evictor be visiting items in the wrong order?
>  >  >  > > > >  Perhaps favouring one object over another?
>  >  >  > > > >
>  >  >  > > > >  I guess we'd need to validate all the counts before
failing in order
>  >  >  > > > >  to find out.
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  > > > I will
>  >  >  > > > >  > > > also look into this and see if I can
get it to fail.  Thanks
>  >  >  > again for
>  >  >  > > > >  > your
>  >  >  > > > >  > > > help on this.
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > >
>  >  >  > > > >  > > In case it helps, my DOS script for this
is:
>  >  >  > > > >  > >
>  >  >  > > > >  > > call mvn compiler:testCompile
>  >  >  > > > >  > > echo Start >>testn.log
>  >  >  > > > >  > > :LOOP0
>  >  >  > > > >  > > echo %DATE% %TIME% >>testn.log
>  >  >  > > > >  > > call mvn -Dtest=TestGenericKeyedObjectPool
>  >  >  > surefire:test
>  >  >  > > > >  > > goto LOOP%ERRORLEVEL%
>  >  >  > > > >  > > :LOOP1
>  >  >  > > > >  > > type target\surefire-reports\*.txt >>testn.log
>  >  >  > > > >  > > call bell
>  >  >  > > > >  > >
>  >  >  > > > >  > > If you are not using Windows, it should be
easy to change
>  >  >  > accordingly
>  >  >  > > > >  > >
>  >  >  > > > >  > > I have also just seen the following error:
>  >  >  > > > >  > >
>  >  >  > > > >  > > Running
>  >  >  > > > >  >
>  >  >  > org.apache.commons.pool.impl.TestGenericKeyedObjectPool
>  >  >  > > > >  > > java.util.NoSuchElementException: Timeout
>  >  >  > waiting for
>  >  >  > > > >  > idle object
>  >  >  > > > >  > >        at
>  >  >  > > > >  >
>  >  >  > org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1139)
>  >  >  > > > >  > >        at
>  >  >  > > > >  >
>  >  >  > > > >  > >
>  >  >  > > > >  > > I'm working on improving the reporting for
this as well (at
>  >  >  > present
>  >  >  > > > >  > > the stack trace only goes to stderr; it would
be useful if it was
>  >  >  > > > >  > > added to the surefire report).
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  >  Thanks.  That one could be timing.  Pls go ahead
and commit your
>  >  >  > > > >  > improvements so we can be looking at the same
traces.
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > > OK, done.
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > Just had another fail:
>  >  >  > > >
>  >  >  > > >
>  >  >  > testEvictorVisiting(org.apache.commons.pool.impl.TestGenericKeyedObjectPool)
>  >  >  > > >  Time elapsed: 0.094 sec  <<< FAILURE!
>  >  >  > > > junit.framework.AssertionFailedError: i 0 j 0 k 20
>  >  >  > visitCount 0
>  >  >  > > > cycleCount 1 totalInstances 70 Length 21
>  >  >  > > >    at junit.framework.Assert.fail(Assert.java:47)
>  >  >  > > >    at junit.framework.Assert.assertTrue(Assert.java:20)
>  >  >  > > >    at
>  >  >  > org.apache.commons.pool.impl.TestGenericKeyedObjectPool.checkEvictorVisiting(TestGenericKeyedObjectPool.java:949)
>  >  >  > > >    at
>  >  >  > org.apache.commons.pool.impl.TestGenericKeyedObjectPool.testEvictorVisiting(TestGenericKeyedObjectPool.java:812)
>  >  >  > > >
>  >  >  > > > Line 949 is the same as previous 947 (added 2 imports)
>  >  >  > > >
>  >  >  > > > Do the extra details of the numbers help?
>  >  >  > > >
>  >  >  > > >
>  >  >  > > Yes!  I think I have found the problem.  I think the change in
r776085 to
>  >  >  > address POOL-125 inadvertently changed the order of the elements in
the
>  >  >  > evictioncursor when the pool is operating in FIFO mode (why I asked
>  >  >  > the line number above).  I have been able to reproduce the failure
using jdk
>  >  >  > 1.4.  I am working on a fix.  Strange that it does not seem to show
up using
>  >  >  > 1.6.  Must be a PRNG artifact.
>  >  >  > >
>  >  >  >  The modified code looks correct.  Could be a test bug.  Still
>  >  >  > investigating...
>  >  >
>  >  >
>  >  > I've noticed that k == (twoLength - 1) i.e. it is always the last
>  >  >  entry that fails the check, and it seems to always be 1 less than
>  >  >  expected.
>  >  >
>  >  >  I've added some code to my working copy to print out the visit counts
>  >  >  for the other entries on failure; if that works OK I'll commit it.
>  >  >
>  >
>  >
>  > Committed the code.
>  >
>  >  One example failure is:
>  >
>  >  Tests run: 43, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
>  >  28.672 sec <<< FAILURE!
>  >
>  > testEvictorVisiting(org.apache.commons.pool.impl.TestGenericKeyedObjectPool)
>  >
>  >  Time elapsed: 0.031 sec  <<< FAILURE!
>  >  junit.framework.AssertionFailedError: TWO Visits:2 2 2 2 2 2 2 2 2 2 2
>  >  2 2 2 2 1  runs=52 lifo=false i=0 j=0 k=15 visitCount=1 cycleCount=2
>  >  totalInstances=52 Lengths=10,26,16
>  >
>  >         at junit.framework.Assert.fail(Assert.java:47)
>  >
>  >         at org.apache.commons.pool.impl.TestGenericKeyedObjectPool.checkEvictorVisiting(TestGenericKeyedObjectPool.java:962)
>  >
>  >         at org.apache.commons.pool.impl.TestGenericKeyedObjectPool.testEvictorVisiting(TestGenericKeyedObjectPool.java:812)
>  >
>  >
>  > This shows that all the visitCounts are OK apart from the last.
>  >  Perhaps an off-by-one error somewhere?
>  >
>  >  Two more fails:
>  >
>  >  junit.framework.AssertionFailedError: TWO Visits:2 2 2 2 2 2 2 2 2 2 2
>  >  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1  runs=59 lifo=false i=0 j=0 k=26
>  >  visitCount=1 cycleCount=2 totalInstances=59 Lengths=17,15,27
>  >
>  >  junit.framework.AssertionFailedError: TWO Visits:1 1 1 1 1 1 1 1 1 1 1
>  >  1 1 1 1 1 0  runs=23 lifo=false i=0 j=0 k=16 visitCount=0 cycleCount=1
>  >  totalInstances=46 Lengths=17,12,17
>  >
>
>
> I just tried using the fixed numbers from a failed run (instead of
>  using random ones), and it fails every time with the following
>  settings:
>
>  runs=26
>  Lengths=12,12,28
>
>  So it's clearly some kind of logic error - looks like it occurs where
>  "runs" is an exact multiple of "totalInstances".

s/multiple/divisor/

As an experiment, I tried switching the order of the entries in the
smallPrimes array to 3,2,5,7.

I expected the test to fail on the second loop, but it did not fail.

I think this must mean that pool.clear() does not reset the pool fully.

>
>  >
>  >
>  >  >  >  Phil
>  >  >  >
>  >  >  >
>  >  >  > >
>  >  >  > > Cryptic as they may be, I am happy to see that the unit tests
picked up
>  >  >  > this little bug :)
>  >  >  > >
>  >  >  > > Thanks!
>  >  >  > >
>  >  >  > > Phil
>  >  >  > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > > > >  >  Phil
>  >  >  > > > >  >
>  >  >  > > > >  >
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  > > >  Phil
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > > ==
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > Not sure if this is a problem,
but the RELEASE-NOTES etc
>  >  >  > refer to
>  >  >  > > > >  > 1.5-RC2.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > The OSGI versions likewise include
the RC2.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > Does that mean there will need
to be another build and vote
>  >  >  > before
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > release?
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >  Yes.  I will roll a "final" candidate
with the artifact name
>  >  >  > changed
>  >  >  > > > >  > (but
>  >  >  > > > >  > > > tag name still RC-) and we will VOTE
on that.
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > >  The tag is here:
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  >
>  >  >  > http://svn.apache.org/repos/asf/commons/proper/pool/tags/POOL_1_5_RC2/
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > I used "Last Changed Rev: 780316"
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > The differences between the xml
files have now disappeared;
>  >  >  > not sure
>  >  >  > > > >  > > > > what went wrong before.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > Also the only difference between
the tag and the source
>  >  >  > archives are
>  >  >  > > > >  > > > > doap and release notes, as expected.
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > >  Thanks!
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >  Phil
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  >
>  >  >  > ---------------------------------------------------------------------
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > >  To unsubscribe, e-mail:
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > dev-unsubscribe@commons.apache.org
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > > >  For additional commands,
e-mail:
>  >  >  > dev-help@commons.apache.org
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  >
>  >  >  > ---------------------------------------------------------------------
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > > To unsubscribe, e-mail:
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > dev-unsubscribe@commons.apache.org
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > > > For additional commands, e-mail:
dev-help@commons.apache.org
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  >
>  >  >  > ---------------------------------------------------------------------
>  >  >  > > > >  > > >  To unsubscribe, e-mail:
>  >  >  > > > >  > dev-unsubscribe@commons.apache.org
>  >  >  > > > >  > > >  For additional commands, e-mail: dev-help@commons.apache.org
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > > >
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  >
>  >  >  > ---------------------------------------------------------------------
>  >  >  > > > >  > > To unsubscribe, e-mail:
>  >  >  > > > >  > dev-unsubscribe@commons.apache.org
>  >  >  > > > >  > > For additional commands, e-mail: dev-help@commons.apache.org
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  > >
>  >  >  > > > >  >
>  >  >  > > > >  >
>  >  >  > > > >  >
>  >  >  > ---------------------------------------------------------------------
>  >  >  > > > >  >  To unsubscribe, e-mail:
>  >  >  > dev-unsubscribe@commons.apache.org
>  >  >  > > > >  >  For additional commands, e-mail: dev-help@commons.apache.org
>  >  >  > > > >  >
>  >  >  > > > >  >
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > ---------------------------------------------------------------------
>  >  >  > > > To unsubscribe, e-mail:
>  >  >  > dev-unsubscribe@commons.apache.org
>  >  >  > > > For additional commands, e-mail: dev-help@commons.apache.org
>  >  >  > > >
>  >  >  > > >
>  >  >  > > >
>  >  >  > >
>  >  >  > >
>  >  >  >
>  >  >  >
>  >  >  > ---------------------------------------------------------------------
>  >  >  >  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >  >  >  For additional commands, e-mail: dev-help@commons.apache.org
>  >  >  >
>  >  >  >
>  >  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org


text:
## LiamMcBay one year ago In this lesson you learned to check the sign of a polynomial’s leading coefficient. If the coefficient is negative, you can factor out -1 (negative one) first. Then you can factor the rest of the expression more easily. After factoring the polynomial, how do you determine which values of the variable make the original expression undefined? Give an example of a polynomial expression, not from the textbook, that has at least one undefined value and show it in factored form.

1. anonymous

What is your question and why are you asking it? (I'm playing just tell me what you're asking). |dw:1441705022287:dw|

2. LiamMcBay

how do you determine which values of the variable make the original expression undefined? Give an example of a polynomial expression, not from the textbook, that has at least one undefined value and show it in factored form.

3. anonymous

Oh I don't think I can actually do this answer. Sorry! :-) Well actually let me think about it first and I will answer the question for you in a PM ok?

4. anonymous

This will take some time for me to figure out....

5. LiamMcBay

k

6. anonymous

Thanks! :-)

7. anonymous

Hmm I think a polynomial is always well defined, it's exponents can take any value of whole number {0,1,2,3,....} $p(x)=-\frac{5}{29}x^4+77x^3+\sqrt{34}x^2-\frac{1}{2^{\frac{1}{3}}}x-\sqrt{163}$ Like this you can think many other polynomials of x, no real value of x for these can make them undefined (I'm not exactly sure but that should be the case)

8. anonymous

You've got your answer! No need for me! :-)

9. anonymous

I'm not 100% sure @160UTurn

format: plain


text:
# Reference for the exponential decay of Legendre coefficients

In Short: I look for a reference to the proof that the spectral coefficients in the Legendre (or Jacobi) expansion are of exponential decay rate.

Longer: If $p_n$ is the $n$-th Legendre polynomial, and the Legendre expansion of a real function $f$ is $f(x) = \sum\limits_{n=0}^{\infty} \hat{f}(n) p_n (x)$, where $\hat{f} (n) = \int\limits_{-1}^1 p_n (x) f(x) dx$, it is a standard result that you find in a lot of textbooks (Szego, Davis, Funaro), in various forms and degrees of formality, that

1. If $f\in C^{2n+1}$, then $E_n (f) :=\|f- \sum\limits_{n=0}^{N} \hat{f}(n) p_n (x)\|_2 \sim \frac{1}{C^{2n+1}}$ for $C>1$.
2. If $f\in C^{2n+1}$, then $\lim_{n\to \infty} \frac{\hat{f} (n)}{C^{2n+1}} = O(1)$.

However, if $f\in C^{\infty}$ is analytic in $[-1,1]$, we'd expect $\hat{f}(n)\sim e^{-n}$, or, conversely, $E_n (f) \sim e^{-n}~.$ I found this theorem both in Davis' Interpolation and Approximation (Thm 13.2.2), and Szego's Orthogonal Polynomials (Thm 9.1.1), both without proofs, and references either missing or in German.


text:
## Calculus (3rd Edition)

$\frac{\sqrt{5}}{2}$
Assume that $\cos\theta =\frac{2}{3}$, then by solving the triangle, we have: $$\tan \theta=\frac{\sqrt{5}}{2}.$$ Now, since $\theta =\cos^{-1}\frac{2}{3}$, we have $$\tan(\cos^{-1}\frac{2}{3})=\tan\theta=\frac{\sqrt{5}}{2}.$$


text:
Join us for MBA Spotlight – The Top 20 MBA Fair      Schedule of Events | Register

 It is currently 05 Jun 2020, 12:19

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# M70-39

Author Message
TAGS:

### Hide Tags

Math Expert
Joined: 02 Sep 2009
Posts: 64314

### Show Tags

04 Sep 2018, 01:44
00:00

Difficulty:

45% (medium)

Question Stats:

63% (02:06) correct 38% (01:38) wrong based on 16 sessions

### HideShow timer Statistics

A praline box contained 10 milk chocolate pralines, 6 bitter chocolate pralines and 4 white chocolate pralines. To this amount were added x pralines, out of which $$y\%$$ were milk chocolate. Of the new amount of pralines, are more than half milk chocolate?

(1) $$x=8$$

(2) $$y=60$$

_________________
Math Expert
Joined: 02 Sep 2009
Posts: 64314

### Show Tags

04 Sep 2018, 01:44
Official Solution:

We’ll go for LOGICAL because that is our first choice in Data Sufficiency.

The question asks us about the new percentage of milk chocolate pralines, so we’ll start by finding the original percentage: $$\frac{10}{10 + 6 + 4}=\frac{10}{20}=\frac{1}{2}= 50\%$$. So, we are being asked whether the new pralines increased the milk chocolate percentage. (1) Knowing the number of pralines added without knowing their composition doesn’t help us determine the new percentage. (A) and (D) are eliminated. (2) If the percentage of milk chocolate in the added pralines is greater than the percentage in the original amount, the new amount must have an increased percentage. (C) and (E) are eliminated.

_________________
Intern
Joined: 18 Jul 2019
Posts: 2

### Show Tags

07 Aug 2019, 22:33
The answer will change if you put x as 5 or x as 10. so, 2 is not sufficient for the conclusion
Re: M70-39   [#permalink] 07 Aug 2019, 22:33

# M70-39

Moderators: chetan2u, Bunuel


text:
It is currently 16 Dec 2018, 20:34

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# The ratio of 16 to g is equal to the ratio of g to 49.

Author Message
TAGS:
GMAT Club Legend
Joined: 07 Jun 2014
Posts: 4750
GRE 1: Q167 V156
WE: Business Development (Energy and Utilities)
Followers: 93

Kudos [?]: 1664 [0], given: 396

The ratio of 16 to g is equal to the ratio of g to 49. [#permalink]  19 Aug 2018, 03:02
Expert's post
00:00

Question Stats:

33% (01:13) correct 66% (00:32) wrong based on 9 sessions
The ratio of 16 to g is equal to the ratio of g to 49.

 Quantity A Quantity B g $$28$$

A) Quantity A is greater.
B) Quantity B is greater.
C) The two quantities are equal.
D) The relationship cannot be determined from the information given.
[Reveal] Spoiler: OA

_________________

Sandy
If you found this post useful, please let me know by pressing the Kudos Button

Try our free Online GRE Test

GRE Instructor
Joined: 10 Apr 2015
Posts: 1246
Followers: 47

Kudos [?]: 1138 [0], given: 7

Re: The ratio of 16 to g is equal to the ratio of g to 49. [#permalink]  21 Aug 2018, 11:26
Expert's post
sandy wrote:
The ratio of 16 to g is equal to the ratio of g to 49.

 Quantity A Quantity B g $$28$$

A) Quantity A is greater.
B) Quantity B is greater.
C) The two quantities are equal.
D) The relationship cannot be determined from the information given.

GIVEN: The ratio of 16 to g is equal to the ratio of g to 49.
In other words, 16/g = g/49
Cross multiply to get: g² = (16)(49) [Let's not find this product yet. You'll see why shortly]

Notice that 16 = 4² and 49 = 7²
So, we get: g² = (4²)(7²)

We have a nice rule that says (a^x)(b^x) = (ab)^x

So we can write: g² = 28²

IMPORTANT: Many people will conclude (incorrectly) that g must equal 28
However, we should also note that (-28)² = 28², so g could also equal -28

If g = 28, then Quantity A EQUALS Quantity B
If g = -28, then Quantity B is GREATER THAN Quantity B

Cheers,
Brent
_________________

Brent Hanneson – Creator of greenlighttestprep.com

Re: The ratio of 16 to g is equal to the ratio of g to 49.   [#permalink] 21 Aug 2018, 11:26
Display posts from previous: Sort by


text:
# Finding the number of poisoned bottles

This is a well-known problem (discussed here and here), but I am adding a twist to it.

A king has 100 bottles of wine and poisons $$K$$ of them, where $$0 \leq K \leq 100$$. You have a supply of rats and need to determine how many of the bottles are poisoned. You are not interested in finding the actual poisoned bottles and you only want to find the value of $$K$$. You can get a rat to drink a mix of wine taken from different bottles. If the mix contains any poisoned wine then the rat will die after 1 hour. What is the minimum number of rats required to conclusively identify the value of $$K$$ in the general case (not any specific $$K$$)?

I only know the obvious solution that uses 100 rats, so I am very interested in seeing if better solutions exist! Note I am leaving this puzzle open to either adaptive (rats can be reused, but longer wait time) or non-adaptive (rats cannot be reused, but just 1 hour wait time) strategies. I am interested in both types of solutions.

P.S. No rats were harmed in the making of this puzzle :)

• rot13 Vf gurer nal orarsvg gb zvkvat nf bccbfrq gb frdhragvnyyl qevaxvat guebhtu gur vaqvivqhny obggyrf? Vs abar bs gurfr obggyrf vf cbvfbarq lbh pna erhfr gur fnzr eng naq vg jvyy yvir nsgre grfgvat rnpu ovggyr vaqvivqhnyyl be gur zvk, fb bhgpbzr naq vasb tnvarq ner gur fnzr. Vs gurer vf n cbvfbarq obggyr gur eng jvyy qvr va rvgure pnfr bayl jvgu vaqvihny obggyrf lbh jvyy trg n ovg zber vasb. – Paul Panzer Aug 11 at 3:28
• @PaulPanzer the solutions in the links explain how mixing is beneficial for the case of finding the one/two poisoned bottles. I am not sure if mixing helps in this particular puzzle. – Dmitry Kamenetsky Aug 11 at 3:32
• But that's a clear trade-off. Let's take the one out of 1000 bottles poisoned example. You can find it either killing a single rat but potentially having to wait 1000 hours, or getting there faster (10 hours) but killing up to 10 rats. – Paul Panzer Aug 11 at 3:38
• True, there is a clear trade-off. I am interested in seeing solutions with both strategy types (see my update). – Dmitry Kamenetsky Aug 11 at 3:42
• How many times can a bottle be sampled before it is empty? If I empty all the bottles, the number of bottles that still have poison is zero, but have I answered the puzzle? – Ross Presser Aug 11 at 13:20

I'm pretty sure the minimum is

100, or n for any value n such that 0 <= K <= n

If we consider the worst case scenario:

All n bottles are poisoned. In this situation any value less than n will leave some ambiguity where any value between the number tested and n would be a possible solution. In the worst case scenario, every bottle must be independently tested.

• Let $K = 0$ and your answer would allow $n = 0$, but of course it is impossible to determine how many bottles have poison with 0 rats, even if there are 0 poison bottles. You must have $n > K$ unless $K = 100$. – Dapianoman Aug 11 at 5:36
• @Dapianoman I think $n$ is meant to be an upper bound for $K$ that is known a priori. If you are told that $0\leq K\leq 0$, you can indeed determine $K$ without the use of any rats whatsoever. – ManfP Aug 11 at 15:58

If I...

...allow one rat to drink one bottle, wait all the time it takes to be sure that bottle isn't poisoned, and then send the same rat to drink the next bottle, until it dies from poisoning and I need the next rat...

...then...

...the minimum number of rats required to conclusively identify the value of $$K$$ is $$K+1$$.

...unless...

...$$K=100$$, in which case the minimum number of rats required to conclusively identify the value of $$K$$ is $$K$$, as pointed in other answer.

What is the minimum number of rats required to conclusively identify the value of K?

The answer is 1 rat.

It just might happen to not always be the maximum number required.

• That is only true for K=1, but not for any K in general. – Dmitry Kamenetsky Aug 11 at 13:35
• @DmitryKamenetsky Actually, it's true for K=0 (mix all bottles and feed to one rat) and K=1 (individual give the rat 1 bottle at a time and hope the last one is the poisoned one). But it's still the minimum as per your question. Your question doesn't say "what is the fewest number of rats that can solve all possible combinations". I'll be honest... I am being very pedantic about your wording with my answer. I stand by it though, a good puzzle is only as good as it's written. – musefan Aug 11 at 13:43
• yes you are right my wording wasn't specific enough. I tried to modify it. – Dmitry Kamenetsky Aug 11 at 14:01
• This answer is valid, you may need more than 1 rat to conclusively identify the value of K but the minimum number is 1 since you can't conclude anything with less than 1 rat. Unless the answer allows you to use chickens. – Iuri Guilherme Aug 26 at 19:35

The minimum is $$K + 1$$ or 100, whichever is smaller. The only way to tell if a bottle has poison is if it kills a rat, and if a rat is killed it cannot be used to test any other bottles. So in the case of $$K = 100$$ you need 100 rats to die. For $$K = 0,\dots,99$$ once the $$K$$th rat dies you are guaranteed to have found all the bottles, and the last rat survives.

• "The only way to tell if a bottle has poison is if it kills a rat, and if a rat is killed it cannot be used to test any other bottles." is not strictly true. You are allowed to mix liquids from more than one bottle together. You could imagine using a rat to determine that there is at least one poisoned bottles among a subset of the bottles, and use clever combinations to get a lower number of rats. At least, your answer does not prove that it isn't possible. You have only proven that K+1 rats is sufficient; not that it is the minimum. – Stef Aug 11 at 12:29
• It is not that hard. Suppose J<K rats got killed. Ignore all the bottles that a rat tested and survived. Among the remaining bottles pick for each rat the the last bottle it drank from. These J bottles can be poisoned. And not other bottle needs to be. – Florian F Aug 11 at 14:26
• >"use clever combinations to get a lower number of rats" Like what combinations? It's impossible to determine that a bottle has poison unless it has killed a rat. That's practically by definition, after all. What is poison but that which kills? – Dapianoman Aug 13 at 5:59
• @Florian F If you let J < K, and only J bottles are poisoned, then you arrive at a contradiction, because K is DEFINED as exactly the number of bottles which are poisoned (thus J = K => K < K is a contradiction). – Dapianoman Aug 13 at 6:01
• J is the number of rats killed. I showed that you cannot determine the value of K without killing at least K rats. If the number of rats killed, J, is less than K, then you cannot exclude that only J bottles are poisoned. – Florian F Aug 14 at 7:07

Looking at the benefit of mixing...

...(without it I don't think you can do better than 100 rats because feeding a single unmixed bottle to a rat only tells the status of that single bottle.), trying a binary search, if in the worst case you have K=100 poisoned bottles and split it into two 50 bottle groups, then mixing each group and feeding it causes the rat to die (since all bottles are poisoned) which forces us to split that group again; it doesn't tell us the number of poisoned bottles in that group. So we have to keep splitting until we can't anymore, i.e. until we have 100 single-bottle groups, which we then give to 100 rats respectively, and then we know the number in those groups and the total number K. Which means we've gone through more than 100 rats, which is worse than the naive approach. So a binary-search approach using mixing doesn't seem to be better than the naive approach.

My gut feeling is

that nothing will beat the naive approach, as my hunch is that mixing multiple bottles still only gives you definite knowledge about one more bottle at the cost of one more rat, the same thing you get when you do the naive approach of one rat per bottle.

If I...

...mix all 100 bottles and give that mix to the first rat, wait all the time it takes to be sure that mix isn't poisoned, and in the event of rat dying, I give a mix of 99 bottles to the next rat, and so on until the rats stop dying...

...I have isolated all the bottles without any poison. Let that be $$n$$ for $$0≤n≤100$$. It already took me $$101-n$$ rats unless $$n=0$$ in which case it already took 100 rats. Let that number be $$r$$...

...so now I have to make sure there aren't any bottles without poison in the bottles I discarded. I had put them all in an organized row while I was discarding them so I'll start from the first I discarded. I'll give one by one to the rats just like my other answer. Therefore I will need more $$s$$ rats where $$K-n>=s>=0$$ to determine the value of $$K$$, which is $$K=r+s$$.

That would be a very inefficient solution to the problem, unless...

...the rats stop dying very early or the first rat doesn't die.

So it's kind of a...

lottery of efficiency.

• Your sentence "...I have isolated all the bottles without any poison." in the second paragraph is not true (which you acknowledge in the third paragraph) – Stef Aug 11 at 12:22
• Could you combine your two answers into one please. – Dmitry Kamenetsky Aug 11 at 14:12
• If you mean to remove one bottle at a time from the mix, then, when the rats stop dying you have identified a single poisoned bottle, the last one you removed from the mix. And that at the cost of possibly many rats. You should better test one bottle at a time. – Florian F Aug 12 at 11:11
• @DmitryKamenetsky but this is a different approach, my other answer tries to isolate the poisoned bottles (easier) while this one tries to isolate the non poisoned bottles (harder, probably kills more rats). – Iuri Guilherme Aug 26 at 19:36
• @Stef I mean I have isolated the bottles without any poison because I discarded all the bottles that could have poison. The process in the first paragraph explains how I will come to the conclusion that I have made a batch of isolated bottles that are guaranteed not to have poison. The second and third paragraph go about finding out which bottles are poisoned in the discarded batch (the ones not in the isolated "good bottles" batch). – Iuri Guilherme Aug 26 at 19:41

Testing several bottles together instead of letting a rat drink from the first, second etc bottle until it dies or survives all the bottles never gains more information, so it is pointless.

Now to find the number of bottles: Assume the king who never lies tells you that he picked one bottle, poisoned the other 99, and then either poisoned the last bottle or not. So you know the answer is 99 or 100.

Mixing two or more bottles is pointless, because you know the rat is going to do, no information gained at all. So you can only give each rat in turn a bottle to drink, until one survives or all 100 rats are dead. If the king poisoned all the bottles or you and the rats are unlucky and the unpoisoined bottle is the last one, all 100 rats die.

• why is testing several bottles together pointless? – Dmitry Kamenetsky Aug 13 at 0:51


text:
# NCERT solution for class 10 maths quadratic equations ( Chapter 4)

#### Solution for Exercise 4.1

Q1.Check whether the following are Quadratic Equations.
(i)$$(x + 1)^2 = 2(x - 3)$$
(ii)$$x^2 - 2x = (?2) (3 ? x)$$
(iii)$$(x ? 2) (x + 1) = (x ? 1) (x + 3)$$
(iv)$$(x ? 3) (2x + 1) = x (x + 5)$$
(v)$$(2x ? 1) (x ? 3) = (x + 5) (x ? 1)$$
(vi)$$x^2 + 3x + 1 = (x - 2)^2$$
(vii)$$(x + 2)^3 = 2x(x^2 - 1)$$
(viii)$$x^3 - 4x^2 - x + 1 = (x - 2)^3$$

(i)$$(x + 1)^2 = 2(x - 3)$$
Using identity $$(a + b)^2 = a^2 + 2ab + b^2$$
=>$$x^2 + 1 + 2x = 2x - 6$$
=>$$x^2 + 7 = 0$$
Hence it is a quadratic equation since the degree is degree 2.
(ii)$$x^2 - 2x = (?2) (3 ? x)$$
=>$$x^2 - 2x = -6 + 2x$$
=>$$(x^2 - 2x - 2x + 6 = 0$$
=>$$x^2 - 4x + 6 = 0$$
Hence it is a quadratic equation with degree 2.
(iii)$$(x ? 2) (x + 1) = (x ? 1) (x + 3)$$
=>$$x^2 + x - 2x - 2 = x^2 + 3x - x - 3$$
=>$$x^2 + x - 2x - 2 - x^2 + 3x - x - 3 = 0$$
=>$$(x^2 - 2x - 2 -3x + x + 3 = 0$$
=>$$-3x + 1 = 0$$
Hence it is a not quadratic equation since the degree is 1.
(iv)$$(x ? 3) (2x + 1) = x (x + 5)$$
=>$$2x^2 + x - 6x - 3 = x^2 + 5x$$
=>$$(2x^2 + x - 6x - 3 - x^2 + 5x = 0$$
=>$$x^2 - 10x - 3 = 0$$
Hence it is a quadratic equation since the degree ish degree 2.
(v)$$(2x ? 1) (x ? 3) = (x + 5) (x ? 1)$$
=>$$2x^2 - x - 6x + 3 = x^2 - x + 5x - 5$$
=>$$(2x^2 - 7x + 3 - x^2 + x - 5x + 5 = 0$$
=>$$x^2 - 10x - 3 = 0$$
Hence it is a quadratic equation since the degree is degree 2.
(vi)$$x^2 + 3x + 1 = (x - 2)^2$$
Using identity $$(a - b)^2 = a^2 - 2ab + b^2$$
=>$$x^2 + 3x + 1 = x^2 - 4x + 4$$
=>$$(x^2 + 3x + 1 - x^2 + 4x - 4 = 0$$
=>$$7x - 3 = 0$$
Hence it is a not quadratic equation since the degree is 1
(vii)$$(x + 2)^3 = 2x(x^2 - 1)$$
Using identity $$(a + b)^3 = a^3 + b^3 + 3ab(a + b)$$
=>$$x^3 + 2^3 + 3(x)(2)(x + 2) = 2x(x^2 - 1)$$
=>$$x^3 + 8 + 6x(x + 2) = 2x^2 - 2x$$
=>$$2x^3 - 2x - x^3 - 8 - 6x^2 - 12x = 0$$
=>$$x^3 - 6x^2 - 14x - 8 = 0$$
Hence it is a not quadratic equation since the degree is 3
(viii)$$x^3 - 4x^2 - x + 1 = (x - 2)^3$$
Using identity $$(a + b)^3 = a^3 + b^3 + 3ab(a + b)$$
=>$$x^3 - 4x^2 - x + 1 = x^3 - 2^3 - 3(x)(2)(x-2)$$
=>$$-4x^2 - x + 1 = -8 - 6x^2 + 12x$$
=>$$2x^2 - 13x + 9 = 0$$
Hence it is a quadratic equation since the degree is 2

Represent the following situations in the form of Quadratic Equations:
(i) The area of rectangular plot is 528 $$m^2$$. The length of the plot (in metres) is one more than twice its breadth. We need to find the length and breadth of the plot
(ii) The product of two consecutive numbers is 306. We need to find the integers.
(iii) Rohan’s mother is 26 years older than him. The product of their ages (in years) after 3 years will be 360. We would like to find Rohan’s present age.
(iv) A train travels a distance of 480 km at uniform speed. If, the speed had been 8km/h less, then it would have taken 3 hours more to cover the same distance. We need to find speed of the train.

(i) A rectangular plot with area 528 $$m^2$$ is given.
Let breadth of rectangular plot be x metres
Length is one more than twice its breadth.
Therefore, length of rectangular plot is $$2x + 1$$ metres
Area of rectangle = length × breadth
=> $$528 = x (2x + 1)$$
=> $$528 = 2x^2 + x$$
=>$$2x^2 + x – 528 = 0$$
(ii) Let two consecutive numbers be x and (x + 1).
It is given that $$x (x + 1) = 306$$
=>$$x^2 + x = 306$$
=>$$x^2 + x – 306 = 0$$
(iii) Let present age of Rohan = x years
Let present age of Rohan’s mother = $$x + 26$$ years
Age of Rohan after 3 years = $$x + 3$$ years
Age of Rohan’s mother after 3 years = $$x + 26 + 3 = (x + 29)$$ years
According to given condition:
$$(x + 3) (x + 29) = 360$$
=>$$x^2 + 29x + 3x + 87 = 360$$
=>$$x^2 + 32x - 273 = 0$$
(iv) Let speed of train be x km/h
Time taken by train to cover 480 km = 480x hours
If, speed had been 8km/h less then time taken would be $$(480x?8)$$ hours
According to given condition, if speed had been 8km/h less then time taken is 3 hours less.
Therefore, $$480x – 8 = 480x + 3$$
=>$$480 (1x – 8 ? 1x) = 3$$
=>$$480 (x – x + 8) (x) (x - 8) = 3$$
=>$$480 × 8 = 3 (x) (x - 8)$$
=>$$3840 = 3x^2 - 24x$$
=>$$3x^2 - 24x - 3840 = 0$$
Dividing equation by 3, we get
=>$$x^2 - 8x - 1280 = 0$$

#### Solution for Exercise 4.2

Q1. Find the roots of the following Quadratic Equations by factorization.
1.$$x^2 - 3x - 10 = 0$$
2.$$2x^2 + x - 6 = 0$$
3.$$\sqrt{2}x^2 + 7x + 5\sqrt{2} = 0$$
4.$$2x^2 - x + {{1} \over 8} = 0$$
5.$$100x^2 - 20x + 1 = 0$$

1. $$x^2 - 3x - 10 = 0$$
=> $$x^2 - 3x - 10 = 0$$
=> $$x^2 - 5x + 2x - 10 = 0$$
=> $$x(x - 5) + 2 (x - 5) = 0$$
=> $$(x - 5) (x + 2) = 0$$
=> $$x = 5, -2$$

2. $$2x^2 + x - 6 = 0$$
=> $$2x^2 + x - 6 = 0$$
=> $$2x^2 + 4x - 3x - 6 = 0$$
=> $$2x(x + 2) - 3(x + 2) = 0$$
=> $$(2x - 3) (x + 2) = 0$$
=> $$x = {{3} \over 2}, -2$$

3. $$\sqrt{2}x^2 + 7x + 5\sqrt{2} = 0$$
=> $$\sqrt{2}x^2 + 7x + 5\sqrt{2} = 0$$
=> $$\sqrt{2}x^2 + 2x + 5x + 5\sqrt{2} = 0$$
=> $$\sqrt{2}x^2(x + \sqrt{2}) + 5(x + \sqrt{2}) = 0$$
=> $$(\sqrt{2}x + 5) (x + \sqrt{2}) = 0$$
=> $$x = {{-5} \over \sqrt{2}}, -\sqrt{2}$$
=> $$x = {{-5} \over \sqrt{2}} × {{\sqrt{2}} \over \sqrt{2}}, -\sqrt{2}$$
=> $$x = {{-5\sqrt{2}} \over 2}, -\sqrt{2}$$

4. $$2x^2 - x + {{1} \over 8} = 0$$
=> $${{16x^2 - 8x + 1} \over 8} = 0$$
=> $$16x^2 - 8x + 1 = 0$$
=> $$16x^2 - 4x - 4x + 1 = 0$$
=> $$4x(4x - 1) - 1(4x - 1) = 0$$
=> $$(4x - 1) (4x - 1) = 0$$
=> $$x = {{1} \over 4}, {{1} \over 4}$$

5. $$100x^2 - 20x + 1 = 0$$
=> $$100x^2 - 20x + 1 = 0$$
=> $$100x^2 - 10x - 10x + 1 = 0$$
=> $$10x(10x - 1) - 1(10x - 1) = 0$$
=> $$(10x - 1) (10x - 1) = 0$$
=> $$x = {{1} \over 10}, {{1} \over 10}$$

Q2. Solve the following problems given:
1.$$x^2 - 45x + 324 = 0$$
2.$$x^2 - 55x + 750 = 0$$

1. $$x^2 - 45x + 324 = 0$$
=> $$x^2 - 45x + 324 = 0$$
=> $$x^2 - 36x - 9x - 324 = 0$$
=> $$x(x - 36) - 9 (x - 36) = 0$$
=> $$(x - 9) (x - 36) = 0$$
=> $$x = 9, 36$$

2. $$x^2 - 55x + 750 = 0$$
=> $$x^2 - 55x + 750 = 0$$
=> $$x^2 - 25x - 30x + 750 = 0$$
=> $$x(x - 25) - 30 (x - 25) = 0$$
=> $$(x - 25) (x - 30) = 0$$
=> $$x = 25, 30$$

Q3. Find two numbers whose sum is 27 and product is 182.

Ans.Let first number be x and let second number be (27 - x)
According to given condition, the product of two numbers is 182.
Therefore,
$$x(27 - x) = 182$$
=> $$27 - x^2 = 182$$
=> $$x^2 - 27x + 182 = 0$$
=> $$x^2 - 14x + 13x + 182 = 0$$
=> $$x(x - 14) - 13(x - 14) = 0$$
=> $$(x - 14) (x - 13) = 0$$
=> $$x = 14, 13$$
Therefore, the first number is equal to 14 or 13
And, second number is = 27 – x = 27 – 14 = 13 or Second number = 27 – 13 = 14
Therefore, two numbers are 13 and 14.

Q4. Find two consecutive positive integers, sum of whose squares is 365.

Ans.Let first number be x and let second number be (x + 1)
According to given condition,
$$x^2 + (x + 1)^2 = 365$$
We know, $$(a+b)^2 = a^2 + b^2 + 2ab$$
=> $$x^2 + x^2 + 1 + 2x = 365$$
=> $$2x^2 + 2x -364 = 0$$
Dividing equation by 2
=> $$x^2 + x - 182 = 0$$
=> $$x^2 + 14x - 13x - 182 = 0$$
=> $$x(x + 14) - 13(x + 14) = 0$$
=> $$(x + 14) (x - 13) = 0$$
=> $$x = -14, 13$$
Therefore, first number = 13 (We discard -14 because it is negative number)
Second number = x + 1 = 13 + 1 = 14
Therefore, two consecutive positive integers are 13 and 14 whose sum of squares is equal to 365.

Q5.The altitude of right triangle is 7 cm less than its base. If, hypotenuse is 13 cm. Find the other two sides.

Ans.Let base of triangle be x cm and let altitude of triangle be (x ? 7) cm
It is given that hypotenuse of triangle is 13 cm
According to Pythagoras Theorem,
$$13^2 = x^2 + (x - 7)^2$$
We know, $$(a+b)^2 = a^2 + b^2 + 2ab$$
=> $$169 = x^2 + x^2 + 49 - 14x$$
=> $$169 = 2x^2 - 14x + 49$$
=> $$2x^2 - 14x - 120 = 0$$
Dividing equation by 2
=> $$x^2 - 7x - 60 = 0$$
=> $$x^2 - 12x + 5x - 60 = 0$$
=> $$x(x - 12) + 5(x - 12) = 0$$
=> $$(x - 12) (x + 5) = 0$$
=> $$x = -5, 12$$
We discard x = -5 because length of side of triangle cannot be negative.
Therefore, base of triangle = 12 cm
Altitude of triangle = (x -7) = 12 – 7 = 5 cm.

Q6. A cottage industry produces a certain number of pottery articles in a day. It was observed on a particular day that cost of production of each article (in rupees) was 3 more than twice the number of articles produced on that day. If, the total cost of production on that day was Rs. 90, find the number of articles produced and the cost of each article.

Ans. Let cost of production of each article be Rs x
We are given total cost of production on that particular day = Rs 90
Therefore, total number of articles produced that day = $${{90} \over x}$$
According to the given conditions,

$$x = 2 ({{90} \over x}) + 3$$
=> $$x = {{180} \over x} + 3$$
=> $$x = {{180 + 3x} \over x}$$
=> $$x^2 = 180 + 3x$$
=> $$x^2 - 3x - 180 = 0$$
=> $$x^2 - 15x + 12x - 180 = 0$$
=> $$x(x - 15) + 12(x - 15) = 0$$
=> $$(x - 15) (x + 12) = 0$$
=> $$x = 15, -12$$
Cost cannot be in negative, therefore, we discard x = -12
Therefore, x = Rs 15 which is the cost of production of each article.
Number of articles produced on that particular day = $${{90} \over 15}$$ = 6

#### Solution for Exercise 4.3

Q1. Find the roots of the following quadratic equations if they exist by the method of completing square.
(i) $$2x^2 - 7x + 3 = 0$$
(ii) $$2x^2 + x - 4 = 0$$
(iii) $$4x^2 + 4\sqrt{3}x + 3 = 0$$
(iv) $$2x^2 + x + 4 = 0$$

(i) $$2x^2 - 7x + 3 = 0$$
First step is to make coefficient of $$x^2 = 1$$
So on dividing equation by 2
$$x^2 - {{7}\over{2}}x + {{3}\over{2}} = 0$$
On dividing the middle term of the equation by 2x:
$$({{7}\over{2}}x)({{1}\over{2}}x) = {{7}\over{4}}$$
On adding and subtracting square of $${{7}\over{4}}$$ from the equation $$x^2 - {{7}\over{2}}x + {{3}\over{2}} = 0$$
$$x^2 - {{7}\over{2}}x + {{3}\over{2}} + ({{7}\over{4}})^2 - ({{7}\over{4}})^2 = 0$$
$$x^2 + ({{7}\over{4}})^2 - {{7}\over{2}}x + {{3}\over{2}} - ({{7}\over{4}})^2 = 0$$
Using identity {$$(a-b)^2 = a^2 + b^2 -2ab$$}
$$(x - {{7}\over{4}})^2 + {{24 - 49}\over{16}} = 0$$
$$(x - {{7}\over{4}})^2 = {{49 - 24}\over{16}}$$
On taking square root both sides:
$$x - {{7}\over{4}} = {{5}\over{4}}$$ and $${{-5}\over{4}}$$
$$x = {{5}\over{4}} + {{7}\over{4}} = {{12}\over{4}} = 3$$ and $${{-5}\over{4}} - {{7}\over{4}} = {{2}\over{4}} = {{1}\over{2}}$$
Hence, $$x = {{1} \over {2}} , 3$$

(ii) $$2x^2 + x - 4 = 0$$
First step is to make coefficient of $$x^2 = 1$$
So on dividing equation by 2
$$x^2 + {{x}\over{2}} - 2 = 0$$
On dividing the middle term of the equation by 2x:
$$({{x}\over{2}})({{1}\over{2}}x) = {{1}\over{4}}$$
On adding and subtracting square of $${{1}\over{4}}$$ from the equation $$x^2 + {{x}\over{2}} - 2 = 0$$
$$x^2 + {{x}\over{2}} - 2 + ({{1}\over{4}})^2 - ({{1}\over{4}})^2 = 0$$
$$x^2 + ({{1}\over{4}})^2 + {{x}\over{2}} - 2 - ({{1}\over{16}}) = 0$$
Using identity {$$(a+b)^2 = a^2 + b^2 + 2ab$$}
$$(x + {{1}\over{4}})^2 - {{33}\over{16}} = 0$$
$$(x + {{1}\over{4}})^2 = {{33}\over{16}}$$
On taking square root both sides:
$$x + {{1}\over{4}} = {{\sqrt{33}}\over{4}}$$ and $${{-\sqrt{33}}\over{4}}$$
$$x = {{\sqrt{33}}\over{4}} - {{1}\over{4}} = {{\sqrt{33} - 1}\over{4}}$$ and $${{-\sqrt{33}}\over{4}} - {{1}\over{4}} = {{2}\over{4}} = {{-\sqrt{33} - 1}\over{4}}$$
Hence, $$x = {{\sqrt{33} - 1}\over{4}} , {{-\sqrt{33} - 1}\over{4}}$$

(iii) $$4x^2 + 4\sqrt{3}x + 3 = 0$$
First step is to make coefficient of $$x^2 = 1$$
So on dividing equation by 4
$$x^2 + \sqrt{3}x + {{3} \over {4}} = 0$$
On adding and subtracting square of $${{\sqrt{3}}\over{2}}$$ (half of the middle term) from the equation $$x^2 + {{x}\over{2}} - 2 = 0$$
$$x^2 + \sqrt{3}x + {{3} \over {4}} + ({{\sqrt{3}}\over{2}})^2 - ({{\sqrt{3}}\over{2}})^2 = 0$$
$$x^2 + ({{3}\over{4}})^2 - \sqrt{3}x + {{3} \over {4}} - ({{3}\over{4}}) = 0$$
Using identity {$$(a+b)^2 = a^2 + b^2 + 2ab$$}
$$(x + {{\sqrt{3}}\over{2}})^2 = 0$$
$$(x + {{\sqrt{3}}\over{2}}) (x + {{\sqrt{3}}\over{2}}) = {{33}\over{16}}$$
On taking square root both sides:
$$x + {{\sqrt{3}}\over{2}} = 0$$ and $$x + {{\sqrt{3}}\over{2}} = 0$$
$$x = -{{\sqrt{3}}\over{2}}$$ and $$x = -{{\sqrt{3}}\over{2}}$$

(iv) $$2x^2 + x + 4 = 0$$
First step is to make coefficient of $$x^2 = 1$$
So on dividing equation by 2
$$x^2 + {{x}\over{2}} + 2 = 0$$
On dividing the middle term of the equation by 2x:
$$({{x}\over{2}})({{1}\over{2}}x) = {{1}\over{4}}$$
On adding and subtracting square of $${{1}\over{4}}$$ from the equation $$x^2 - {{7}\over{2}}x + {{3}\over{2}} = 0$$
$$x^2 + {{x}\over{2}}x + 2 + ({{1}\over{4}})^2 - ({{1}\over{4}})^2 = 0$$
$$x^2 + ({{1}\over{4}})^2 + {{x}\over{2}} + 2 - ({{1}\over{4}})^2 = 0$$
Using identity {$$(a + b)^2 = a^2 + b^2 -2ab$$}
$$(x + {{1}\over{4}})^2 + 2 - {{1}\over{16}} = 0$$
$$(x + {{1}\over{4}})^2 = {{1}\over{16}} - 2 = {{1 - 32}\over{16}}$$
On taking square root both sides:
Right hand side does not exist since square root of negative number does not exist.
Therefore, there is no solution.

Q2. Find the roots of the following Quadratic Equations by applying quadratic formula.
(i) $$2x^2 - 7x + 3 = 0$$
(ii) $$2x^2 + x - 4 = 0$$
(iii) $$4x^2 + 4\sqrt{3}x + 3 = 0$$
(iv) $$2x^2 + x + 4 = 0$$

Ans.(i) $$2x^2 - 7x + 3 = 0$$
The general form of equation is $$ax^2 + bx + c = 0$$
Quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{7 ± \sqrt{(-7)^2 - 4(2)(3)}} \over {(2)(2)}}$$
=>$$x = {{7 ± \sqrt{49 - 24}} \over {4}}$$
=>$$x = {{7 ± 5} \over {4}}$$
=>$$x = {{7 + 5} \over {4}} , {{7 - 5} \over {4}}$$
=>$$x = 3 , {{1} \over {2}}$$

(ii) $$2x^2 + x - 4 = 0$$
The general form of equation is $$ax^2 + bx + c = 0$$
Quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{-1 ± \sqrt{(1)^2 - 4(2)(-4)}} \over {(2)(2)}}$$
=>$$x = {{-1 ± \sqrt{33}} \over {4}}$$
=>$$x = {{-1 + \sqrt{33}} \over {4}} , {{-1 - \sqrt{33}} \over {4}}$$

(iii) $$4x^2 + 4\sqrt{3}x + 3 = 0$$
The general form of equation is $$ax^2 + bx + c = 0$$
Quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{-4\sqrt{3} ± \sqrt{(4\sqrt{3})^2 - 4(4)(3)}} \over {(2)(4)}}$$
=>$$x = {{-4\sqrt{3} ± \sqrt{0}} \over {8}}$$
=>$$x = {{-\sqrt{3}} \over {2}} , {{-\sqrt{3}} \over {2}}$$

(iv) $$2x^2 + x + 4 = 0$$
The general form of equation is $$ax^2 + bx + c = 0$$
Quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{-1 ± \sqrt{(1)^2 - 4(2)(-4)}} \over {(2)(2)}}$$
=>$$x = {{-1 ± \sqrt{-31}} \over {4}}$$
since square root of negative number does not exist.
Therefore, there is no solution.

Q3.Find the roots of the following equations:
(i) $${{x} - {{1}\over {x}}} = 3, x ? 0$$
(ii) $${{1} \over {x + 4}} - {{1} \over {x - 7}} = {{11} \over {30}}, x ? -4,7$$

Ans.(i)$${{x} - {{1}\over {x}}} = 3$$ where x is not equal to 0
=>$${{x^2 - 1} \over {x}} = 3$$
=>$$x^2 - 1 = 3x$$
=>$$x^2 -3x - 1 = 0$$
The general form of equation is $$ax^2 + bx + c = 0$$
Quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{3 ± \sqrt{(3)^2 - 4(1)(-1)}} \over {(2)(1)}}$$
=>$$x = {{3 ± \sqrt{13}} \over {2}}$$
=>$$x = {{3 + \sqrt{13}} \over {2}} , {{3 - \sqrt{13}} \over {2}}$$

(ii)$${{1} \over {x + 4}} - {{1} \over {x - 7}} = {{11} \over {30}}, x ? -4,7$$
=>$${{(x - 7) - (x + 4)} \over {(x - 4)(x - 7)}} = {{11} \over {30}}$$
=>$${{-11} \over {(x - 4)(x - 7)}} = {{11} \over {30}}$$
=>$$-30 = x^2 - 7x + 4x -28$$
=>$$x^2 -3x + 2 = 0$$
The general form of equation is $$ax^2 + bx + c = 0$$
Quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{3 ± \sqrt{(3)^2 - 4(1)(2)}} \over {(2)(1)}}$$
=>$$x = {{3 ± \sqrt{1}} \over {2}}$$
=>$$x = {{3 + \sqrt{1}} \over {2}} , {{3 - \sqrt{1}} \over {2}}$$
=>$$x = 2,1$$

Q4. The sum of reciprocals of Rehman’s ages (in years) 3 years ago and 5 years from now is 13. Find his present age.

Ans.Let present age of Rehman = x years
Age of Rehman 3 years ago = (x - 3) years.
Age of Rehman after 5 years = (x + 5) years
According to the given condition:
$${{1} \over {x - 3}} + {{1} \over {x + 5}} = {{1} \over {3}}$$
=>$${{(x + 5) + (x - 3)} \over {(x - 3)(x + 5)}} = {{1} \over {3}}$$
=>$$3 (2x + 2) = (x - 3) (x + 5)$$
=>$$6x + 6 = x^2 - 3x + 5x -15$$
=>$$x^2 - 4x - 15 - 6 = 0$$
=>$$x^2 - 4x -21 = 0$$
Comparing quadratic equation $$x^2 - 4x -21 = 0$$ with general form $$ax^2 + bx + c = 0$$,
We get a = 1, b = ?4 and c = ?21
Using quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{4 ± \sqrt{(4)^2 - 4(1)(-21)}} \over {(2)(1)}}$$
=>$$x = {{4 ± \sqrt{16 + 84}} \over {2}}$$
=>$$x = {{4 + 10} \over {2}} , {{4 - 10} \over {2}}$$
=>$$x = 7, -3$$
We discard x=-3. Since age cannot be in negative.
Therefore, present age of Rehman is 7 years.

Q5. In a class test, the sum of Shefali’s marks in Mathematics and English is 30. Had she got 2 marks more in Mathematics and 3 marks less in English, the product of their marks would have been 210. Find her marks in the two subjects.

Ans.Let Shefali’s marks in Mathematics = x
Let Shefali’s marks in English = 30 - x
If, she had got 2 marks more in Mathematics, her marks would be = x + 2
If, she had got 3 marks less in English, her marks in English would be = 30 – x - 3 = 27 - x
According to given condition:
$$(x + 2) (27 - x) = 210$$
=>$$27x - x^2 + 54 - 2x = 210$$
=>$$x^2 - 25x + 156 = 0$$
Comparing quadratic equation $$x^2 - 25x + 156 = 0$$ with general form $$ax^2 + bx + c = 0$$,
We get a = 1, b = ?25 and c = 156
Applying Quadratic Formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{25 ± \sqrt{(25)^2 - 4(1)(156)}} \over {(2)(1)}}$$
=>$$x = {{25 ± \sqrt{625 - 624}} \over {2}}$$
=>$$x = {{25 + 1} \over {2}} , {{25 - 1} \over {2}}$$
=>$$x = 13, 12$$
Therefore, Shefali’s marks in Mathematics = 13 or 12
Shefali’s marks in English = 30 – x = 30 – 13 = 17
Or Shefali’s marks in English = 30 – x = 30 – 12 = 18
Therefore, her marks in Mathematics and English are (13, 17) or (12, 18).

Q6. The diagonal of a rectangular field is 60 metres more than the shorter side. If, the longer side is 30 metres more than the shorter side, find the sides of the field.

Ans.Let shorter side of rectangle = x metres
Let diagonal of rectangle = (x + 60) metres
Let longer side of rectangle = (x + 30) metres
According to pythagoras theorem,
$$(x + 60)^2 = (x + 30)^2 + x^2$$
=>$$x^2 + 3600 + 120x = x^2 + 900 + 60x + x^2$$
=>$$x^2 - 60x - 2700 = 0$$
Comparing equation with $$x^2 - 60x - 2700 = 0$$ standard form $$ax^2 + bx + c = 0$$,
We get a = 1, b = ?60 and c = ?2700
Applying quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{60 ± \sqrt{(60)^2 - 4(1)(-2700)}} \over {(2)(1)}}$$
=>$$x = {{60 ± \sqrt{3600 + 10800}} \over {2}} = {{60 ± \sqrt{14400}} \over {2}}$$
=>$$x = {{60 + 120} \over {2}} , {{60 - 120} \over {2}}$$
=>$$x = 90,-30$$
We ignore –30. Since length cannot be in negative.
Therefore, x = 90 which means length of shorter side = 90 metres
And length of longer side = x + 30 = 90 + 30 = 120 metres
Therefore, length of sides are 90 and 120 in metres.

Q7. The difference of squares of two numbers is 180. The square of the smaller number is 8 times the larger number. Find the two numbers.

Ans.Let smaller number = x and let larger number = y
According to condition:
=>$$y^2 - x^2 = 180$$… (1)
Also, we are given that square of smaller number is 8 times the larger number.
=>$$x^2 = 8y$$ … (2)
Putting equation (2) in (1), we get
$$y^2 - 8y = 180$$
=>$$y^2 - 8y - 180 = 0$$
Comparing equation $$y^2 - 8y - 180 = 0$$ with general form $$ax^2 + bx + c = 0$$,
We get a = 1, b = ?8 and c = ?180
Using quadratic formula = $$y = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$y = {{8 ± \sqrt{(-8)^2 - 4(1)(-180)}} \over {(2)(1)}}$$
=>$$y = {{8 ± \sqrt{64 + 720}} \over {2}} = {{60 ± \sqrt{784}} \over {2}}$$
=>$$y = {{8 + 28} \over {2}} , {{8 - 28} \over {2}}$$
=>$$y = 18,-10$$
Using equation (2) to find smaller number:
$$x^2 = 8y$$
=>$$x^2 = 8y = (8)(18) = 144$$
=>$$x = ±12$$
And, = $$x^2 = 8y = (8)(-10) = -80$$ {No real solution for x}
Therefore, two numbers are (12, 18) or (-12, 18)

Q8. A train travels 360 km at a uniform speed. If, the speed had been 5 km/hr more, it would have taken 1 hour less for the same journey. Find the speed of the train.

Ans.Let the speed of the train = x km/hr
If, speed had been 5 km/hr more, train would have taken 1 hour less.
So, according to this condition
$${{360} \over {x}} = {{360} \over {x + 5}} + 1$$
=>$$360 ( {{1}\over{x}} - {{1}\over {x + 5}}) = 1$$
=> $$360 ( {{x + 5 - x}\over{x(x + 5)}}) = 1$$
=>$$(360)(5) = x^2 + 5x$$
=>$$x^2 + 5x - 1800 = 0$$
Comparing equation $$x^2 + 5x - 1800 = 0$$ with general equation $$ax^2 + bx + c = 0$$,
We get a = 1, b = 5 and c = -1800
Applying quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{-5 ± \sqrt{(5)^2 - 4(1)(-1800)}} \over {(2)(1)}}$$
=>$$x = {{-5 ± \sqrt{25 + 7200}} \over {2}} = {{-5 ± \sqrt{7225}} \over {2}}$$
=>$$x = {{-5 + 85} \over {2}} , {{-5 - 85} \over {2}}$$
=>$$x = 40,-45$$
Since speed of train cannot be in negative. Therefore, we discard x = -45
Therefore, speed of train = 40 km/hr

Q9. Two water taps together can fill a tank $${9}{\dfrac{3}{8}}$$in hours. The tap of larger diameter takes 10 hours less than the smaller one to fill the tank separately. Find the time in which each tap can separately fill the tank.

Ans.Let time taken by tap of smaller diameter to fill the tank = x hours
Let time taken by tap of larger diameter to fill the tank = (x – 10) hours
It means that tap of smaller diameter fills $${{1} \over {x}} th$$ part of tank in 1 hour.… (1)
And, tap of larger diameter fills $${{1} \over {x - 10}} th$$ part of tank in 1 hour. … (2)
When two taps are used together, they fill tank in 758 hours.
In 1 hour $${{8} \over {75}} th$$, they fill part of tank $${{1} \over {{{75} \over {8}}}} = {{8} \over {75}}$$… (3)
From (1), (2) and (3),
=>$${{1}\over{x}} + {{1}\over {x - 10}} = {{8} \over {75}}$$
=> $${{x - 10 + x}\over{x(x - 10)}} = {{8} \over {75}}$$
=>$$75 (2x - 10) = 8 (x^2 - 10x)$$
=> $$150x – 750 = 8x^2 - 80x$$
=>$$8x^2 - 80x - 150x +750 = 0$$
=>$$4x^2 - 115x + 375 = 0$$
Comparing equation $$4x^2 - 115x + 375 = 0$$ with general equation $$ax^2 + bx + c = 0$$,
We get a = 4, b = -115 and c = 375
Applying quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{115 ± \sqrt{(-115)^2 - 4(4)(375)}} \over {(2)(4)}}$$
=>$$x = {{115 ± \sqrt{13225 - 6000}} \over {8}} = {{115 ± \sqrt{7225}} \over {8}}$$
=>$$x = {{115 + 85} \over {8}} , {{115 - 85} \over {8}}$$
=>$$x = 25,3.75$$
Time taken by larger tap = x – 10 = 3.75 – 10 = -6.25 hours
Time cannot be in negative. Therefore, we ignore this value.
Time taken by larger tap = x – 10 = 25 – 10 = 15 hours
Therefore, time taken by larger tap is 15 hours and time taken by smaller tap is 25 hours.

Q10. An express train takes 1 hour less than a passenger train to travel 132 km between Mysore and Bangalore (without taking into consideration the time they stop at intermediate stations). If, the average speed of the express train is 11 km/h more than that of the passenger train, find the average speed of two trains.

Ans.Let average speed of passenger train = x km/h
Let average speed of express train = (x + 11) km/h
Time taken by passenger train to cover 132 km = $${{132} \over {x}}$$ hours
Time taken by express train to cover 132 km = $${{132} \over {x + 11}}$$ hours
According to the given condition,
$${{132} \over {x}} = {{132} \over {x + 11}} + 1$$
=>$$132({{1} \over {x}} - {{1} \over {x + 11}}) = 1$$
=>$$132({{x + 11 - x} \over {x(x + 11)}}) = 1$$
=> $$132 (11) = x (x + 11)$$
=>$$1452 = x^2 + 11x$$
=>$$x^2 + 11x -1452 = 0$$
Comparing equation $$x^2 + 11x -1452 = 0$$ with general quadratic equation $$ax^2 + bx + c = 0$$, we get a = 1, b = 11 and c = ?1452
Applying quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{-11 ± \sqrt{(11)^2 - 4(1)(-1452)}} \over {(2)(1)}}$$
=>$$x = {{-11 ± \sqrt{121 + 5808}} \over {2}} = {{-11 ± \sqrt{5929}} \over {2}}$$
=>$$x = {{-11 + 77} \over {2}} , {{-11 - 77} \over {2}}$$
=>$$x = 33, -44$$
As speed cannot be in negative. Therefore, speed of passenger train = 33 km/h
And, speed of express train = x + 11 = 33 + 11 = 44 km/h

Q11. Sum of areas of two squares is 468 $$m^2$$. If, the difference of their perimeters is 24 metres, find the sides of the two squares.

Ans.Let perimeter of first square = x metres
Let perimeter of second square = (x + 24) metres
Length of side of first square = $${{x} \over {4}}$$ metres {Perimeter of square = 4 × length of side}
Length of side of second square = $${{x + 24} \over {4}}$$ metres
Area of first square = side × side = $${{x} \over {4}} × {{x} \over {4}} = {{x^2} \over {16}} m^2$$
Area of second square = $$({{x + 24} \over {4}})^2$$
According to given condition:
$${{x^2} \over {16}} + ({{x + 24} \over {4}})^2 = 468$$
=>$${{x^2} \over {16}} + {{x^2 + 576 + 48x} \over {16}} = 468$$
=>$${{x^2 + x^2 + 576 + 48x} \over {16}} = 468$$
=> $$2x^2 + 576 + 48x = (468)(16)$$
=> $$2x^2 + 576 + 48x = 7488$$
=>$$2x^2 + 48x - 6912 = 0$$
=>$$x^2 + 24x - 3456 = 0$$
Comparing equation $$x^2 + 24x - 3456 = 0$$ with standard form $$ax^2 + bx + c = 0$$,
We get a = 1, b =24 and c = -3456
Applying quadratic formula = $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$
=>$$x = {{-24 ± \sqrt{(24)^2 - 4(1)(-3456)}} \over {(2)(1)}}$$
=>$$x = {{-24 ± \sqrt{576 + 13824}} \over {2}} = {{-24 ± \sqrt{14400}} \over {2}}$$
=>$$x = {{-24 + 120} \over {2}} , {{-24 - 120} \over {2}}$$
=>$$x = 48, -72$$
Perimeter of square cannot be in negative. Therefore, we discard x=-72.
Therefore, perimeter of first square = 48 metres
And, Perimeter of second square = x + 24 = 48 + 24 = 72 metres
=> Side of First square = $${{Perimeter} \over {4}} = {{48} \over {4}} = 12$$ m
And, Side of second Square = $${{Perimeter} \over {4}} = {{72} \over {4}} = 18$$ m

#### Solution for Exercise 4.4

Q1. Find the nature of the roots of the following quadratic equations. If the real roots exist, find them.
(i)$$2x^2 - 3x + 5 = 0$$
(ii)$$3x^2 -4 \sqrt{3} x + 4 = 0$$
(iii)$$2x^2 - 6x + 3 = 0$$

Ans.(i)$$2x^2 - 3x + 5 = 0$$
Comparing this equation with general equation $$ax^2 + bx + c$$,
We get a = 2, b = ?3 and c = 5
Discriminant = $$b^2 - 4ac = (-3)^2 - 4(2)(5) = 9 – 40 = ?31$$
Discriminant is less than 0 which means equation has no real roots.

(ii)$$3x^2 -4 \sqrt{3} x + 4 = 0$$
Comparing this equation with general equation $$ax^2 + bx + c$$,
We get a = 3, b = $$-4 \sqrt{3}$$ and c = 4 Discriminant = $$b^2 - 4ac = (-4 \sqrt{3})^2 - 4(3)(4) = 48 – 48 = 0$$
Discriminant is equal to zero which means equations has equal real roots.
Applying quadratic $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$ to find roots,
=>$$x = {{4 \sqrt{3} ± \sqrt{0}} \over {6}} = {{2 \sqrt{3}} \over {3}}$$
Because, equation has two equal roots, it means x = $${{2 \sqrt{3}} \over {3}} ,{{2 \sqrt{3}} \over {3}}$$

(iii)$$2x^2 - 6x + 3 = 0$$
Comparing this equation with general equation $$ax^2 + bx + c$$,
We get a = 2, b = ?6, and c = 3
Discriminant =$$b^2 - 4ac = (-6)^2 - 4(2)(3) = 36 – 24 = 12$$
Value of discriminant is greater than zero.
Therefore, equation has distinct and real roots.
Applying quadratic $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$ to find roots,
$$x = {{6 ± \sqrt{12}} \over {4}} = {{6 ± 2 \sqrt{3}} \over {4}} = {{3 ± \sqrt{3}} \over {2}}$$ $$x = {{3 + \sqrt{3}} \over {2}} , {{3 - \sqrt{3}} \over {2}}$$

Q2. Find the value of k for each of the following quadratic equations, so that they have two equal roots.
(i) $$2x^2 + kx + 3 = 0$$
(ii) $$kx (x - 2) + 6 = 0$$

Ans.(i)$$2x^2 + kx + 3 = 0$$
We know that quadratic equation has two equal roots only when the value of discriminant is equal to zero.
Comparing equation with $$2x^2 + kx + 3 = 0$$ general quadratic equation $$ax^2 + bx + c = 0$$, we get a = 2, b = k and c = 3
Discriminant $$b^2 - 4ac = k^2 - 4 (2) (3) = k^2 - 24$$
Putting discriminant equal to zero
$$k^2 - 24= 0$$
$$k^2 = 24$$
$$k = ± \sqrt{2} = ± 2 \sqrt{6}$$

(ii)$$kx (x - 2) + 6 = 0$$
$$kx^2 - 2kx + 6 = 0$$
Comparing quadratic equation $$kx (x - 2) + 6 = 0$$ with general form $$ax^2 + bx + c = 0$$, we get a = k, b = ?2k and c = 6
Discriminant $$b^2 - 4ac = (-2k)^2 - 4 (k) (6) = 4k^2 - 24k$$
We know that two roots of quadratic equation are equal only if discriminant is equal to zero.
Putting discriminant equal to zero
$$4k^2 - 24k = 0$$
$$4k (k - 6) = 0=> k = 0, 6$$
The basic definition of quadratic equation says that quadratic equation is the equation of the form $$ax^2 + bx + c = 0$$, where a ? 0.
Therefore, in equation , we cannot have k = 0.
Therefore, we discard k = 0.
Hence the answer is k = 6.

Q3. Is it possible to design a rectangular mango grove whose length is twice its breadth, and the area is 800$$m^2$$. If so, find its length and breadth.

Ans.Let breadth of rectangular mango grove = x metres
Let length of rectangular mango grove = 2x metres
Area of rectangle = length × breadth = $$x × 2x = 2x^2 m^2$$
According to given condition:
$$2x^2 = 800$$
$$2x^2 - 800 = 0 => x^2 - 400 = 0$$
Comparing equation $$x^2 - 400 = 0$$ with general form of quadratic equation $$ax^2 + bx + c = 0$$ ,
we get a = 1, b = 0 and c = -400
Discriminant = $$b^2 -4ac = (0)^2 - 4 (1) (-400) = 1600$$
Discriminant is greater than 0 means that equation has two distinct real roots.
Therefore, it is possible to design a rectangular grove.
Applying quadratic formula,$$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$ to solve equation,
$$x = {{0 ± \sqrt{1600}} \over {2(1)}}$$ = ± {{40} \over {2} } = ± 20\)
x = 20, -20
We discard negative value of x because breadth of rectangle cannot be in negative.
Therefore, x = breadth of rectangle = 20 metres
Length of rectangle = 2x = 40 metres

Q4.Is the following situation possible? If so, determine their present ages.
The sum of the ages of two friends is 20 years. Four years ago, the product of their ages in years was 48.

Ans. Let age of first friend = x years and let age of second friend = (20 - x) years
Four years ago, age of first friend = (x - 4) years
Four years ago, age of second friend = (20 - x) - 4 = (16 - x) years
According to given condition,
$$(x - 4) (16 - x) = 48$$
=>$$16x - x^2 - 64 + 4x = 48$$
=>$$20x - x^2 - 112 = 0$$
=>$$x^2 - 20x + 112 = 0$$
Comparing equation , $$x^2 - 20x + 112 = 0$$ with general quadratic equation $$ax^2 + bx + c = 0$$,
we get a = 1, b = -20 and c = 112
Discriminant = $$b^2 - 4ac = (-20)^2 - 4 (1) (112) = 400 – 448 = -48 < 0$$
Discriminant is less than zero which means we have no real roots for this equation.
Therefore, the give situation is not possible.

Q5. Is it possible to design a rectangular park of perimeter 80 metres and area 400 $$m^2$$. If so, find its length and breadth.

Ans. Let length of park = x metres
We are given area of rectangular park = 400 $$m^2$$
Therefore, breadth of park = $${{400} \over {x}}$$ metres{Area of rectangle = length × breadth}
Perimeter of rectangular park = 2 (length + breath) = $$2 ( x + {{400} \over {x}})$$ metres
We are given perimeter of rectangle = 80 metres
According to condition:
$$2 ( x + {{400} \over {x}}) = 80$$
$$2 ( {{x^2 + 400} \over {x}})$$
$$2x^2 + 800 = 80x$$
$$2x^2 - 80x + 800 =0$$
$$x^2 - 40x + 400 = 0$$
Comparing equation, $$x^2 - 40x + 400 = 0$$ with general quadratic equation $$ax^2 + bx + c = 0$$,
we get a = 1, b = -40 and c = 400
Discriminant = $$b^2 - 4ac = (-40)^2 - 4 (1) (400) = 1600 – 1600 = 0$$
Discriminant is equal to 0.
Therefore, two roots of equation are real and equal which means that it is possible to design a rectangular park of perimeter 80 metres and area 400 $$m^2$$.
Using quadratic formula $$x = {{-b ± \sqrt{b^2 - 4ac}} \over {2a}}$$ to solve equation,
$$x = {{40 ± \sqrt{0}} \over {2}} = {{40} \over {2}} = 20$$
Here, both the roots are equal to 20.
Therefore, length of rectangular park = 20 metres
Breadth of rectangular park = $${{400} \over {x}} = {{400} \over {20}} = 20 m$$


text:
# zbMATH — the first resource for mathematics

A generalization of Čech-complete spaces and Lindelöf $$\Sigma$$-spaces. (English) Zbl 1289.54085
Summary: The class of $$s$$-spaces is studied in detail. It includes, in particular, all Čech-complete spaces, Lindelöf $$p$$-spaces, metrizable spaces with the weight $$\leq 2^{\omega }$$, but countable non-metrizable spaces and some metrizable spaces are not in it. It is shown that $$s$$-spaces are in a duality with Lindelöf $$\Sigma$$-spaces: $$X$$ is an $$s$$-space if and only if some (every) remainder of $$X$$ in a compactification is a Lindelöf $$\Sigma$$-space [A. V. Arhangel’skii, Fundam. Math. 220, No. 1, 71–81 (2013; Zbl 1267.54024)]. A basic fact is established: the weight and the networkweight coincide for all $$s$$-spaces. This theorem generalizes the similar statement about Čech-complete spaces. We also study hereditarily $$s$$-spaces, provide various sufficient conditions for a space to be a hereditarily $$s$$-space, and establish that every metrizable space has a dense subspace which is a hereditarily $$s$$-space. It is also shown that every dense-in-itself compact hereditarily $$s$$-space is metrizable.

##### MSC:
 54D40 Remainders in general topology 54B05 Subspaces in general topology 54A25 Cardinality properties (cardinal functions and inequalities, discrete subsets)
Full Text:


text:
# Introduction

Inspired by Dyalog Ltd.'s 2016 student competition. The challenge there is to write good APL code, but this is a and it is open to all languages. Derived from this closed challenge.

The real challenge here is to combine the various (quite trivial) parts of the problem in a byte-efficient way by reusing values and/or algorithms.

If you find this challenge interesting and you use Dyalog APL (free download here), you may also want to participate in the original competition, but note that the objective there is to submit quality code – not necessarily short code. If you are a student, you can win USD 100 for Phase I. Phase II (not related to this code golf challenge) can win you up to USD 2000 and a free trip to Scotland!

Take two strings (of any 7-bit ASCII characters) by any means and order (but please include input format in your answer). You may take them as separate arguments/inputs or as a single list of strings. One string contains the delimiters in the other. E.g. given ',;/' and 'hello,hello;there;my/yes/my/dear,blue,world', the sub-strings are ['hello', 'hello', 'there', 'my', 'yes', 'my', 'dear', 'blue', and 'world'].

You will do some statistics and ordering based on the lengths of those sub-strings that are not duplicated in the input. (You may chose to consider casing or not.) In the example given, those are ['there', 'yes', 'dear', 'blue', 'world'].

Give (by any means) a list of four elements in the overall structure [Number_1, Number_2, [List_3], [[List_4_1], [List_4_2]]]:

1. The mean of the lengths of the non-duplicated strings. In our example, that is 4.2
2. The median of the lengths of the non-duplicated strings. In our example, that is 4.
3. The mode(s) of the lengths of the non-duplicated strings. In our example, that is [4, 5].
4. The original sub-strings (including duplicates), divided into two lists; the first are those that are not one of the above mode lengths, and the second are those that are. In our example: [['my', 'my', 'yes'], ['dear', 'blue', 'hello', 'hello', 'there', 'world']]

The combined final answer of our example case is: [4.2, 4, [4, 5], [['my', 'my', 'yes'], ['dear', 'blue', 'hello', 'hello', 'there', 'world']]]

# Considerations

1. Don't forget to reuse code and values. E.g. the median is the average of the 1 or 2 middle elements, and you'll need the mode(s) to reorder the original list.

2. Watch out for division by zero; an empty input means one string with length zero, so the mean length is zero. If there are no non-unique sub-strings, return zero for both mean and median, an empty list for modes, and put all original sub-strings onto the non-mode list.

3. The list of modes, and the sub-lists of non-mode-length strings, and mode-length strings, do not need to be sorted in any way.

4. If all non-duplicated sub-strings have different lengths, then all the lengths are considered modes.

5. Wherever the term list is used, you may use any collection of multiple data pieces that your language supports, e.g. tuples, arrays, dictionaries, etc.

6. The numeric values only need to be within 1% of the actual value.

# Example cases

### Example A

',;/' 'hello,hello;there;my/yes/my/dear,blue,world'
gives
[4.2, 4, [4, 5], [['my', 'my', 'yes'], ['dear', 'blue', 'hello', 'hello', 'there', 'world']]

### Example B

'+|' ''
gives
[0, 0, [0], [[], ['']]]

Note: while there are two delimiter characters, none of them occur in the data string, so this is just one empty string. Mean, median, and mode are therefore zero There are no strings in the non-mode list and just the single empty string in the mode list.

### Example C

'' 'ppcg.se.com'
gives
[11, 11, [11], [[], ['ppcg.se.com']]]

Note: no delimiters, so the entire input is one string.

### Example D

',;' ',math,,math;'
gives
[0, 0, [], [['', 'math', '', 'math', ''], []]]

Note: there are three empty sub-strings, and since all sub-strings have at least one duplicate, the mean and median default to zero, as per Considerations, above.

### Example E

',;' 'new,math,math;!;'
gives
[1.333, 1, [0,1,3], [['math', 'math'], ['new', '!', '']]]

Note: there is only one of each length among the non-duplicated sub-strings, so all three lengths are modes.

You can verify my explicit permission to post this challenge here by contacting the author of the original competition.

• I presume the delimiters are always single characters? And that when you say "list" you also include tuples, in particular for the sake of strongly typed languages which require all elements of a list to have the same type? – Peter Taylor Aug 11 '16 at 10:41
• @PeterTaylor The inputs are two plain strings, so the delimiters can only be single characters. I'm not sure I understand what the problem about tuples vs lists. But if you want to use tuples instead of lists, go ahead. – Adám Aug 11 '16 at 10:48
• Ugh. The additional handling required for supporting empty substrings (like Example D) is brutal. :-/ – AdmBorkBork Aug 11 '16 at 16:30
• The first number of Example A should be 4 – Leaky Nun Aug 11 '16 at 17:55
• @TimmyD It is 2 not 3 – Leaky Nun Aug 11 '16 at 18:12

## PowerShell v4+, 453455435427 417 bytes

param([char[]]$a,$b)if(!$b){0;0;0;'','';exit}$a|%{$b=$b-split$_};$c=@{};if($z=($b|group|?{$_.count-eq1}).Name){$z|%{$m+=$c[$_]=$_.length}}if($l=$c.count){$c=$c.GetEnumerator()|sort v}else{$l=2}$m/$l;if($l%2){$c[[math]::Floor($l/2)].Value}else{($c[$l/2].value+$c[$l/2-1].value)/2}if($x=($c|group value|sort c -des)|%{if($_.count-ge$i){$i=$_.count;$_.name}}){$m=$b|?{$_.length-in$x}}else{$m=@()}$x;($b|?{$_-notin$m}),$m  (Saved 7 bytes by eliminating $d and reusing $c instead. Saved 13 21 31 bytes thanks to @Joey) What a mess. Below is a slightly more readable version, broken down into sections. I also included -join on the two potentially-array outputs to make the output more clear visually, as well as surrounding the last one in distinct delimiters #-> and <-# to indicate the sub-arrays. I did this since PowerShell's Write-Output for multiple array return values can get a little confusing when just looking at them on the console. param([char[]]$a,$b)if(!$b){0;0;0;'','';exit}$a|%{$b=$b-split$_}
$c=@{} if($z=($b|group|?{$_.count-eq1}).Name){$z|%{$m+=$c[$_]=$_.length}} if($l=$c.count){$c=$c.GetEnumerator()|sort v}else{$l=2}
$m/$l
if($l%2){$c[[math]::Floor($l/2)].Value}else{($c[$l/2].value+$c[$l/2-1].value)/2} if($x=($c|group value|sort c -des)|%{if($_.count-ge$i){$i=$_.count;$_.name}}){$m=$b|?{$_.length-in$x}}else{$m=@()}$x-join','
"#->" + ((($b|?{$_-notin$m})-join','),($m-join',')-join'<-# #->') + "<-#"

Takes input $a and $b (separators and string), and explicitly casts $a right away as a char-array. The if(!$b) clause handles the special case where $b is an empty string - it dumps zeros and empty strings onto the pipeline and exits. Otherwise we loop through $a with $a|%{...}, each loop -splitting $b by the current character and re-saving into $b. The next line sets $c as an empty hashtable. This is used as the temporary storage location for the non-duplicated values in $b and their corresponding lengths. That's the next line. We take $b, pump it through Group-Object to put like words together, pipe that to Where-Object to select only those where the .count is -equal to 1. We then take the .Name of those (here's where the v4+ requirement comes into play), and store those .Names (i.e., the words) into $z. We then take the .count of that, and that number forms our if clause -- so long as it's non-zero (i.e., we have at least one unique word), we pump those words through a loop. Each iteration we accumulate $m by, and also store into $c, the corresponding word's .length. Next line sorts $c on lengths (that's the |sort value in the middle) and stores that back to $c, but we need to have some logic to account for cases where $z was empty (i.e., every word is a duplicate). If that's the situation, $c is already an empty hashtable, but we set $l equal to 2 to handle the mean calculation later.

Now, we're to our outputs. The first $m/$l just calculates the average length. The next line calculates the median based on either taking the exact middle value of $c, or taking the two above and below the middle and splitting the difference. The next line is very complicated, and was where the longest troubleshooting was. It's calculating the mode. We start by Grouping $c based on value (i.e., the word lengths), then Sort-Object them by their count in -descending order (i.e., the most-common lengths will be first). That list is fed into a loop. Each iteration, if the current item's $_.count is greater-than-or-equal-to $i (which initializes to $null or 0, here), meaning that we've got a length that's the most-common, set $i equal to how many of that length there are, and add the length ($_.name) to the pipeline. That resulting array of most-common lengths is stored into $x.

Provided that we have at least one most-common length, the if triggers and we pipe $b through another Where-Object. This time, we're selecting all of the words where the .length is -in $x (i.e., all of the words that have a length that's in the mode), and store them into $m (yes, I reused a variable name). Else, we don't have a most-common length, so the strings of the mode is empty. The next line $x-join',' outputs the lengths of the mode. Then, the words in $b that aren't in $m and the words in $m, as two sub-arrays. ### Test suite PS C:\Tools\Scripts\golfing> @(@(',;/','hello,hello;there;my/yes/my/dear,blue,world'),@('+|',''),@('','ppcg.se.com'),@(',;',',math,,math;'),@(',;','new,math,math;!;'))|%{"Testing: '"+$_[0]+"' '"+$_[1]+"'";.\fun-with-strings.ps1$_[0] \$_[1];"---------------------------------------------------------------------------------------"}
Testing: ',;/' 'hello,hello;there;my/yes/my/dear,blue,world'
4.2
5
4,5
#->my,yes,my<-# #->hello,hello,there,dear,blue,world<-#
---------------------------------------------------------------------------------------
Testing: '+|' ''
0
0
0

---------------------------------------------------------------------------------------
Testing: '' 'ppcg.se.com'
11
11
11
#-><-# #->ppcg.se.com<-#
---------------------------------------------------------------------------------------
Testing: ',;' ',math,,math;'
0
0

#->,math,,math,<-# #-><-#
---------------------------------------------------------------------------------------
Testing: ',;' 'new,math,math;!;'
1.33333333333333
1
3,1,0
#->math,math<-# #->new,!,<-#
---------------------------------------------------------------------------------------

• I can't really tell the structure from your output. Does the output have four or five parts? – Adám Aug 11 '16 at 20:44
• Give (by any means) a list of four elements: The fifth point on that list was supposed to be under Considerations (fixed now), but your 4th and 5th need to be two elements of one list in order to be fully compliant with the specs. – Adám Aug 11 '16 at 20:55
• @Adám Easy enough to fix, at the cost of two parens and changing a ; to a ,. Updated. – AdmBorkBork Aug 12 '16 at 13:30
• @Joey Oh yeah. But don't need the * since it's unambiguous anyway. – AdmBorkBork Aug 12 '16 at 18:42
• You do, since neither c nor v match a property; the wildcards do. – Joey Aug 12 '16 at 18:50

# Pyth, 63 bytes

Ju.ncRHGQ]E.OKlMfq1/JTJ.O<.<S*2KtlK2=N
S{.x.M/KZKY=Y
f}lTNJ.-JY

Test suite.

• I can't really tell the structure from your output. Does the output have four or five parts? – Adám Aug 11 '16 at 20:44
• Denote your format to be [A, B, C, [D, E]]. My output is A↵B↵C↵D↵E – Leaky Nun Aug 12 '16 at 2:03
• Done, but I'd accept A↵B↵C↵DE if that's a natural list format for Pyth. However, A↵B↵C↵D↵E doesn't quite follow the specs. – Adám Aug 12 '16 at 5:06
• @Adám Oh, so you moved the goalpost – Leaky Nun Aug 12 '16 at 5:14
• How so? According to the revision history, the very first version said Give (by any means) a list of four elements:. – Adám Aug 12 '16 at 5:48

# Python 3, 341 chars, 343 bytes

from statistics import*
def f(d,s,l=len):
w=sorted(''.join(x if not x in d else'ÿ'for x in s).split('ÿ'),key=l)
L=[l(x)for x in w if w.count(x)<2]
if L==[]:return 0,0,L,[s,L]
a,q=mean(L),median(L)
D={x:L.count(x)for x in L}
m=[x for x in D if D[x]==max(D.values())]
i=[l(x)for x in w].index(m[0])
return a,q,m,[w[:i],w[i:]]

As built-ins are not forbidden, using the statistics module is fine for mean and median, but its mode does not allow multiples.

• Edit1: check for non-uniqueness
• Edit2: shorter list comprehension on m
• Edit3: l=len and L==[]
• Edit4: for the empty L case, use it instead of []
• Edit5: figured empty strings were not handled well, introduced non-7-bit-ASCII sentinel ÿ

## JavaScript (ES2017), 346 bytes

f=(p,q,a=p?q.split(p[0]):[q])=>p[1]?f(p.slice(1),a.join(p[1])):(s=a.filter(e=>a.indexOf(e)==a.lastIndexOf(e)).map(e=>e.length).sort((a,b)=>a-b),t=l=0,r=[],s.map(e=>r[t+=e,l++,e]=-~r[e]),[l&&t/l,l&&(s[l>>1]+s[l-1>>1])/2,[...m=new Set(s.filter(e=>r[e]==Math.max(...Object.values(r))))],[a.filter(e=>!m.has(e.length)),a.filter(e=>m.has(e.length))]])

For ES6 replace Object.values(r) with Object.keys(r).map(k=>r[k]) at a cost of 11 bytes. Explanation:

f=(p,q,a=p?q.split(p[0]):[q])=>         split on first seprator
p[1]?f(p.slice(1),a.join(p[1])):       recurse for each separator
(s=a.filter(e=>                       search through list for
a.indexOf(e)==a.lastIndexOf(e))    unique strings only
.map(e=>e.length)                   get lengths of each string
.sort((a,b)=>a-b),                  sort lengths into order
t=l=0,                               total and length
r=[],                                frequency table
s.map(e=>r[t+=e,l++,e]=-~r[e]),      build frequency table and total
[l&&t/l                              mean = total / length
,l&&(s[l>>1]+s[l-1>>1])/2            median = mean of middle elements
,[...m=new Set(s.filter(e=>r[e]==    unique elements matching
Math.max(...Object.values(r))))]    maximum length frequency
,[a.filter(e=>!m.has(e.length))      filter on non-modal length
,a.filter(e=>m.has(e.length))]])    filter on modal length

# q/kdb+, 134 bytes

Solution:

{(avg;med;{:M::(&)m=max m:(#:)@/:(=)x};{(y(&)(~)C;y(&)C:((#:)@/:y)in M)}[;a])@\:(#:)@/:(&)1=(#:)@/:(=)a:"\000"vs?[any y=/:x;"\000";y]}

Examples:

q)/assign function to 'f' to make this tidier
q)f:{(avg;med;{:M::(&)m=max m:(#:)@/:(=)x};{(y(&)(~)C;y(&)C:((#:)@/:y)in M)}[;a])@\:(#:)@/:(&)1=(#:)@/:(=)a:"\000"vs?[any y=/:x;"\000";y]}
q)f[",;/";"hello,hello;there;my/yes/my/dear,blue,world"]
4.2
4f
5 4
(("my";"yes";"my");("hello";"hello";"there";"dear";"blue";"world"))
q)f["+|";""]
0f
0f
,0
(();,"")
q)f["";"ppcg.se.com"]
11f
11f
,11
(();,"ppcg.se.com")
q)f[",;";",math,,math;"]
()
()
()
(("";"math";"";"math";"");())
q)f[",;";"new,math,math;!;"]
1.333333
1f
3 1 0
(("math";"math");("new";,"!";""))

Explanation:

Ungolfed version. Can likely be golfed down a fair bit more.

f:{(avg;                                           / built-in average
med;                                           / built-in median
{:M::where m=max m:count each group x};        / get max counts for group, save to global M
{
(y where not C;                               / y is original list,
y where C:(count each y) in M)               / so these are ones that match the modes (M)
}[;a]                                          / pass parameter a to the function
)
@\:                                            / apply each-left with items on the right
count each                                     / get the lengths of each string
where 1=count each group                       / remove the duplicates
a:"\000" vs                                    / split on NUL and save in a
?[any y=/:x;"\000";y]}                         / replace any occurance of delimiter with NUL


text:
## How to increase the sillage!!

Ok, just a little story:
yesterday i woke up, took a shower and sprayed 2 sprays of my fuel on me.. usually when i spray my neck i get so used to the smell and can not notice any sillage at all.
But i had to walk down town cos of some things, and it was a cold and windy day, so when i came back home one hour later, i was so frozen i just jumped in a hot shower.

It was then i noticed that the whole shower started smelling the most beutifull smell ever (dryed down fuel for men ). I thought that it was strange, but when i dressed up again, i sprayed my usually sprays and let it dry for some minutes, then i put my hand under the water and just tapped some drops, only a few on my neck and just above where i sprayed so it would slide over the sprayed area.

And guess what, for at least four hours later i became almost dizzy, i was embarrassed when i went out again cos i felt like i had oversprayed with 10 sprays or something.. Im serious, a constant cloud of smell that i smelled on my self for so long, thats insane!

Tonight im gonna try it with a perfume with bad longlivety and sillage, hope it will work with John Varvatos! coz with dk fuel, i really dont need it.

Peace out =)


text:
Q

# Find the time period and rate for each. A sum taken for 2 years at 4 percent per annum compounded half yearly.

Find the time period and rate for each.

2.    A sum taken for 2 years at 4% per annum compounded half yearly.

Views

Since the sum taken is compounded half yearly:

$\\Since\ the\ sum\ taken\ is\ compounded\ half\ yearly:\\ Time\ period=2\times 2\\ Time\ period=4\\ Rate=\frac{4}{2}=2\%$

Time period = 4 half years.

Rate = 2% per half year

Exams
Articles
Questions


text:
Waring's problem for matrices - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-22T04:34:13Z http://mathoverflow.net/feeds/question/20874 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/20874/warings-problem-for-matrices Waring's problem for matrices Portland 2010-04-09T23:45:35Z 2010-04-10T00:27:17Z
Probably a well-know question, but I haven't solved it, so I'll ask.

I can show that every matrix in \$M_2(\mathbb{R})\$ is the sum of two squares of matrices in \$M_2(\mathbb{R})\$. If \$n>2\$, I can also show that every matrix in \$M_n(\mathbb{R})\$ is the sum of three squares of matrices in \$M_n(\mathbb{R})\$.

So my question is : Is every matrix in \$M_n(\mathbb{R})\$ is the sum of two squares of matrices in \$M_n(\mathbb{R})\$ (n>2)?
 http://mathoverflow.net/questions/20874/warings-problem-for-matrices/20876#20876 Answer by Bjorn Poonen for Waring's problem for matrices Bjorn Poonen 2010-04-10T00:27:17Z 2010-04-10T00:27:17Z
The answer is YES if \$n\$ is even. But if \$n\$ is odd, then the answer is NO since \$-I\$ is not a sum of two squares. See

Griffin and Krusemeyer, Matrices as sums of squares, Linear and Multilinear Algebra 5 (1977/78), no. 1, 33-44

for the proofs of these facts and generalizations.