The following warnings occurred:
Warning [2] Undefined array key 5987 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 5993 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 6010 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 6017 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 6046 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 6046 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





Re: Some data on where HP users are



#6

> Yes, I also found 5743, and the number of CD's dave > Ordered seemed more realistic. But I was astonnished too > of the
> coincidence of same 7 shipments...


It seems I'm missing something.
I tried to compute that number
with the following assumption:

let Ni=X*Pi,
where X = unknown total CDs number,
Pi=(percentual of CDs sent to the country i)/100,
Ni=number of CDs sent to the country i,
then X should satisfy the condition

abs(round(Ni) - Ni) <= epsilon

for every i, because every calculated Ni should be close to
an integer value.

That way, with epsilon=1e-3 I get:
X = 851, already found by other posters, and
X = 1,702.
No other results have been found allowing the algorithm to run
up to 40,000+.
The result 5,743 has not been found by the algorithm.

With an higher value for epsilon, 1e-2, I get:

X = 851
X = 1,702
X = 2,553
X = 3,404
X = 4,255
X = 5,106
X = 5,957
X = 6,808
etc.

but the 5,743 value is still not found.

It's also possible to impose a tolerance on the sum
of the abs(round(Ni) - Ni) terms so that X should satisfy the
following condition:

sigma(abs(round(Ni) - Ni)) <= epsilon, where Ni=X*Pi as above.

That way with epsilon=.01 I get only X = 851.
With epsilon=.1 the results are again
X = 851
X = 1,702
X = 2,553
X = 3,404
etc.

but the 5,743 value is still not found.
Infact sigma(5,743) > 11, so that seems not to be
a valid solution at all.

Well, I gave it a try because this problem seems to be a bit tricky, or maybe I'm just out of exercise...

--


#7

> X should satisfy the condition

>

> abs(round(Ni) - Ni) <= epsilon

No, no, that condition doesn't need to be satisfied at all. Dave calculated his percentages to two decimal digits, regardless of whether your condition is satisfied or not.

What is satistied is the following. Let:

Ki=round(X*Pi)

Pi'=round(10000*Ki/X)

then Pi' should equal 10000*Pi exactly.

This works for 851 and its integer multiples; the first non-trivial solution that I found is 5743. After that, solutions become more frequent; in fact, according to my calculations that last integer that is not a solution is 9939. Starting with 9940, all integers appear to be solutions. All the while, your epsilon can be a very large number, since abs(round(Ni)-Ni) can be anything up to 0.5.


Viktor


#8

> No, no, that condition doesn't need to be satisfied at > all. Dave calculated his percentages to
> two decimal digits, regardless of whether your condition > is satisfied or not.


Thank you for your explanation, but I was not able
to make it work.
Anyway I don't understand why a valid solution for X
shouldn't verify the condition

abs(round(Ni) - Ni) <= epsilon
for any i (where Ni=Pi*X).

Even if my previous results were incorrect
because of an improper copy&paste so that some
percentuals were missing in my data file,
851 and 1,702 are confirmed: with the correct
set of data, imposing an epsilon=0.1
my algorithm gives

X = 851 (already found by other posters)
X = 1,702 (already found by my algorithm)
X = 8,298
X = 9,149

X = 10,000
X = 10,851
X = 11,702
X = 18,298
X = 19,149

X = 20,000
X = 20,851
X = 21,702
X = 28,298
X = 29,149

X = 30,000
X = 30,851
X = 31,702
X = 38,298
X = 39,149

X = 40,000
and so forth.

But the value 5,743 is still missing. :)

--


#9

Rupert,

Your condition doesn't need to be satisfied because that's not how Dave calculated his percentages. Dave didn't say, "I'll calculate the percentages to as many decimal digits as needed, so that abs(round(Ni) - Ni) <= epsilon"); he simply calculated his percentages to two decimals, regardless of the consequences on precision.

This is best demonstrated through an example. Let's say there were 5743 sales, 230 of which went to Lower Tasmania. The percentage, then, would be 230/5743=4.0049%. But Dave only used two decimal digits, so he calculated 4%. 5743*0.04=229.72, so the difference, epsilon, in this case is 0.28. But Dave didn't care; he didn't add more digits to his percentage figure just to reduce the difference to something nicer, say 0.01. (In this case, he'd have had to use 3 decimal digits in his percentage figure, or 4.005%, to reduce epsilon below 0.28.)

To see this, you can create a spreadsheet with the following:

Let A1=5743 (or whatever other number it is that you're testing).

Let A2..A17 be the various percentages: 0.5546, 0.1022... 0.0012.

Let Bn=ROUND($A$1*An,0)

Let Cn=ROUND(Bn/$A$1,4)

For any number A1 for which An==Cn for all values of n, A1 is a solution. You can also compute $A$1*An-Bn (this is your epsilon) and see that it can become very high for many valid solutions.

Because of this, your algorithm misses many solutions. All integer multiples of 851 are solutions; so not only 1702 but 2553, 3404, etc. The first non-trivial solution is 5743, but after that, solutions become more frequent; in fact, ALL numbers above 9940 are solutions.

You might consider redefining epsilon as (round(Ni)-Ni)/Ni, but that's too lax a condition, producing many false results. Quite simply, you need to restate the problem; since Dave didn't compute to a specific PRECISION, he only selected an arbitrary number of digits (not even a specific number of significant digits; 0.12% has only two significant digits, whereas 55.46% has four) so any method that tries to deduce the correct number based on an assumption of the result's precision will by necessity produce misleading results.


Viktor


#10

> Because of this, your algorithm misses many solutions. > All integer multiples of 851 are solutions; so not only
> 1702 but 2553, 3404, etc.

In fact it is clearly displayed in the sigma(delta(i)) function graphics (they are all points of local minimum).
I should have had a look at the graphics before trying to find numerical solutions.

> since Dave didn't compute to a specific PRECISION,
> he only selected an arbitrary number of digits (not even a specific number of significant digits; 0.12% has only
> two significant digits, whereas 55.46% has four) so any

Thank you again for the explanation. Now I have understood the point.

--


Possibly Related Threads…
Thread Author Replies Views Last Post
  Sheet data importer for HP Prime Marek Russ 4 1,811 11-15-2013, 04:55 AM
Last Post: debrouxl
  [HP Prime] Typo in English Users Guide Timothy Roche 2 1,449 11-15-2013, 04:10 AM
Last Post: dg1969
  Entering,Saving,and Analysis /Fitting X Y Data on the Prime Harold A Climer 6 2,428 10-26-2013, 01:54 PM
Last Post: Tim Wessman
  HP PRIME: How to change the column headers and reset data Joseph Ec 5 2,140 10-18-2013, 02:26 PM
Last Post: Joseph Ec
  Explaination on How to Reset Caculator in Users guie: error Harold A Climer 5 2,516 10-15-2013, 02:11 AM
Last Post: cyrille de Brébisson
  Help me alert regular users to dangers to their calcs Bruce Larrabee 12 3,395 10-06-2013, 08:30 PM
Last Post: Bruce Larrabee
  HP Prime data sharing Alberto Candel 5 1,756 10-06-2013, 07:49 PM
Last Post: Alberto Candel
  [HP-Prime CAS] list[x,y,z], vector[x, y, z ] ... data type operation? CompSystems 1 1,175 08-22-2013, 03:30 PM
Last Post: Joe Horn
  Advanced User's Manual and solution to the ambiguity of data types [HP-Prime xCAS] CompSystems 15 5,402 08-20-2013, 03:37 PM
Last Post: Thomas Klemm
  How do you print a 'data' file on the HP 71B to the HP 2225B thinkjet? Geoff Quickfall 3 1,614 08-18-2013, 04:32 PM
Last Post: Geoff Quickfall

Forum Jump: