mmcdara

5989 Reputation

17 Badges

7 years, 266 days

MaplePrimes Activity


These are answers submitted by mmcdara

The integrand (10)vanishes extremely fast far from 0:

eval((10), t=2)
                                       -101
                    8.74207704900475 10    
eval((10),  t=5)
                                       -1450
                    9.27406195293248 10     

and is symmetric.

If you are really interested in getting an approximation of the integral look at this

ff := (11):
L := [seq(0.2..2.0, 0.2)]:
for l in L do
  printf("Range = %1.1f..%1.1f  Int = %a\n", -l, l, 2*evalf(Int(ff, t=0..l)));
end do;

Range = -0.2..0.2  Int = .953869585255756e-1
Range = -0.4..0.4  Int = .998942521814238e-1
Range = -0.6..0.6  Int = .999002157052540e-1
Range = -0.8..0.8  Int = .999002158581252e-1
Range = -1.0..1.0  Int = .999002158581254e-1
Range = -1.2..1.2  Int = .999002157052540e-1
Range = -1.4..1.4  Int = .999002158581252e-1
Range = -1.6..1.6  Int = .999002158581252e-1
Range = -1.8..1.8  Int = .999002158581252e-1
Range = -2.0..2.0  Int = .999002158581252e-1

You have an almost true value (error ~ 1e-15)  as soon as the half integration range goes beyond than 1.4.
Given that most of the integration methods do not accept a value of Digitslarger than 15, it seems useless to me to expect a more accurate value of the integral.

Now if you really want to integrate over -oo..+oo for some reason, I propose you to transform this integration range into a finite one.
A classical transformation is t = arctanh(tau) (the integration range is now tau=-1..+1).
The result is almost instaneous

with(IntegrationTools):
J    := Int(ff, t=-infinity..+infinity):
Jtau := Change(J, t=arctanh(tau), tau):
Jtau := op(1, Jtau)*Int(GetIntegrand(Jtau), tau=GetRange(op(-1, Jtau)), method=_Gquad):

Digits := 15:
CodeTools:-Usage(evalf(Jtau));
memory used=6.23MiB, alloc change=0 bytes, cpu time=67.00ms, real time=90.00ms, gc time=0ns
                       0.0999002158581254

OverflowError_mmcdara.mw



EDITED

The desired primes in the range 104.. 10are found in 2.3 seconds.


 

restart


Range 10^4..10^6

ithprime(10^5)

1299709

(1)

t0 := time():

N1 := 10^4:
N2 := 10^5:

P  := CodeTools:-Usage( [seq(ithprime(k), k=1..N2)] ):
B1 := ListTools:-BinaryPlace(P, N1)+1;
B2 := ListTools:-BinaryPlace(P, 10*N2-1);

memory used=216.44MiB, alloc change=46.01MiB, cpu time=1.64s, real time=1.64s, gc time=95.80ms

 

1230

 

78498

(2)

count := proc(n)
  local e := StringTools:-Explode(sprintf("%d", n)):
  local s := {e[]}:
  if numelems(s) in {2, 3} then
    map(u -> ListTools:-Occurrences(u, e), [s[]]);
    if has(%, 4) then
      return n
    end if:
  end if:
end proc:
 

ok := count~(P[B1..B2]):

time()-t0

2.312

(3)

ok;

[10111, 11113, 11117, 11119, 11131, 11161, 11171, 11311, 11411, 16111, 22229, 23333, 31333, 33331, 33343, 33353, 33533, 38333, 44449, 47777, 49999, 59999, 67777, 71777, 76777, 77377, 77477, 77747, 77773, 77797, 77977, 79777, 79999, 88883, 94999, 97777, 98999, 99929, 99989, 99991, 100003, 101113, 101117, 101119, 101141, 101161, 101411, 101611, 103333, 107777, 109111, 110119, 110161, 110311, 110711, 111031, 111091, 111103, 111109, 111127, 111143, 111149, 111187, 111217, 111271, 111301, 111317, 111341, 111431, 111491, 111521, 111581, 111641, 111721, 111731, 111751, 111781, 111791, 111821, 111871, 111913, 111919, 112121, 112181, 113011, 113117, 113131, 113161, 113171, 114113, 114161, 114311, 115117, 115151, 115211, 115811, 116101, 116113, 116131, 116141, 116191, 116411, 116911, 117101, 117119, 117191, 117511, 117811, 117911, 118171, 118211, 118411, 119101, 119131, 119191, 119311, 119611, 121151, 121171, 121181, 121711, 128111, 131011, 131101, 131113, 131171, 131311, 131611, 131711, 133033, 133303, 133337, 133633, 133733, 134333, 136111, 136333, 137777, 139333, 139999, 140111, 141101, 141121, 141131, 141161, 141181, 141311, 141511, 141811, 142111, 143111, 143333, 149111, 151121, 151141, 151171, 152111, 154111, 155557, 161141, 161411, 161611, 161911, 166667, 166669, 167777, 169111, 170111, 170777, 171131, 171161, 171811, 173777, 176777, 177677, 177787, 177797, 179111, 179999, 181141, 181211, 181711, 182111, 184111, 187111, 191119, 191141, 191161, 191911, 191999, 196111, 199399, 199499, 199799, 199909, 200003, 200009, 211151, 211711, 211811, 212227, 217111, 218111, 221227, 222023, 222029, 222127, 222247, 222269, 222289, 222293, 222323, 222329, 222527, 222823, 223229, 224221, 225221, 225223, 225227, 228223, 229223, 232333, 233323, 233353, 236333, 239333, 239999, 242227, 252223, 255551, 266663, 272227, 272777, 274777, 277177, 277577, 277747, 277757, 277787, 282221, 282229, 289999, 290999, 292223, 293999, 298999, 299099, 299699, 299909, 299969, 299993, 300007, 301333, 303313, 303323, 303337, 308333, 310111, 310333, 311711, 313133, 313331, 313343, 313373, 313933, 317333, 317777, 322229, 323233, 323339, 323383, 323933, 325333, 328333, 329333, 329999, 330133, 330233, 330313, 330331, 330383, 330433, 331337, 331339, 332303, 332393, 332933, 333023, 333031, 333103, 333131, 333139, 333253, 333283, 333341, 333349, 333367, 333397, 333439, 333493, 333503, 333539, 333563, 333623, 333631, 333673, 333713, 333737, 333793, 333803, 333923, 333973, 334133, 334331, 334363, 334393, 335033, 335323, 335383, 335633, 335833, 336353, 336373, 336533, 337313, 337339, 337343, 337633, 338033, 338323, 338339, 338383, 339323, 339331, 339373, 339433, 341333, 343303, 343313, 343337, 343373, 343393, 343433, 343933, 352333, 353833, 355559, 356333, 361111, 362333, 363313, 363343, 363373, 363533, 363833, 364333, 365333, 367777, 371333, 373339, 373343, 373363, 373393, 373777, 374333, 377477, 377717, 377737, 377771, 377779, 379333, 379777, 379999, 380333, 383303, 383393, 383533, 383633, 383833, 386333, 389999, 391999, 392333, 393331, 393373, 393383, 399499, 399899, 399979, 399989, 400009, 404449, 409999, 411011, 411101, 411113, 411119, 411211, 411311, 411611, 413111, 415111, 419999, 430333, 433033, 433337, 433373, 433393, 433633, 440441, 440443, 441443, 441449, 442447, 444043, 444047, 444341, 444343, 444347, 444349, 444401, 444403, 444421, 444461, 444463, 444469, 444473, 444487, 444547, 444641, 444649, 444841, 445447, 446441, 446447, 447443, 447449, 449441, 455557, 464447, 474443, 475777, 477077, 477277, 477577, 477677, 477727, 477767, 477797, 477977, 479777, 484447, 493333, 494441, 494443, 496999, 497999, 499099, 499969, 499979, 500009, 505559, 511151, 511171, 511211, 511711, 511811, 515111, 522227, 522229, 523333, 529999, 530333, 532333, 533033, 533303, 533353, 533363, 533633, 535333, 538333, 545551, 550553, 551557, 552553, 555053, 555251, 555253, 555257, 555521, 555523, 555589, 555593, 555853, 555857, 555953, 556559, 557551, 565553, 565559, 571111, 571777, 572777, 575551, 575557, 575777, 577177, 577757, 578777, 585551, 588881, 598999, 599399, 599699, 599899, 599939, 599959, 599993, 611011, 611101, 611113, 611131, 611411, 616111, 616669, 617777, 619111, 619999, 626663, 633133, 633337, 633383, 633833, 635333, 644443, 644447, 646669, 655559, 659999, 660661, 661663, 663661, 664661, 664663, 664667, 664669, 666067, 666167, 666269, 666461, 666467, 666607, 666637, 666643, 666647, 666649, 666671, 666683, 666697, 666769, 669661, 669667, 670777, 671777, 676661, 677077, 677177, 677717, 677737, 677767, 677779, 679999, 686669, 688889, 691111, 694999, 695999, 697999, 699299, 700001, 704777, 707177, 707677, 707717, 707747, 707767, 707797, 709777, 710777, 711121, 711131, 711181, 711811, 715777, 717797, 721111, 724777, 727577, 727717, 727747, 727877, 730777, 731333, 733133, 733331, 733339, 733373, 733393, 733433, 737717, 737747, 737767, 737773, 737797, 739777, 743333, 743777, 746777, 747277, 747377, 747737, 747977, 748777, 755551, 757577, 757727, 761777, 767677, 767707, 767747, 767773, 769999, 770177, 770767, 770771, 771877, 772477, 772757, 772771, 773767, 773779, 774377, 774577, 774757, 774773, 774779, 774797, 775477, 775757, 775787, 776077, 776177, 776977, 777071, 777097, 777137, 777167, 777173, 777187, 777247, 777317, 777373, 777437, 777473, 777479, 777571, 777617, 777671, 777731, 777743, 777761, 777769, 777781, 777817, 777857, 777871, 777979, 778717, 778727, 779377, 779477, 779707, 779747, 779767, 779771, 779797, 781111, 782777, 785777, 787277, 787477, 787747, 787757, 787771, 791111, 793333, 793777, 793999, 794999, 796777, 797077, 797747, 797767, 797773, 797977, 799949, 799979, 799991, 799993, 803333, 811171, 811411, 811511, 817111, 817777, 818887, 822221, 822223, 822229, 828881, 828889, 833033, 833353, 833363, 833633, 833933, 838889, 839999, 844447, 858883, 868883, 874777, 877577, 877771, 878777, 880883, 882881, 882883, 883889, 884881, 885881, 885883, 885889, 888287, 888389, 888683, 888689, 888781, 888809, 888827, 888857, 888869, 888871, 888983, 888989, 890999, 892999, 893999, 898889, 899939, 900001, 900007, 901111, 904999, 905999, 907999, 909299, 909599, 909899, 911011, 911101, 911161, 911171, 911311, 913999, 916999, 919111, 919799, 919939, 919949, 919969, 919979, 920999, 922223, 923333, 929399, 931999, 932333, 932999, 933313, 933433, 935999, 937777, 939299, 939599, 939989, 939997, 941999, 949699, 949939, 949979, 949997, 953333, 956999, 959099, 959969, 966661, 967999, 969599, 969919, 969929, 969989, 970777, 970999, 971111, 973333, 974999, 976777, 977747, 979919, 979949, 979969, 980999, 989099, 989909, 989929, 989939, 989959, 990599, 990799, 990989, 991499, 991909, 991979, 993199, 993919, 993997, 994199, 994699, 994949, 994991, 994997, 995399, 995699, 995909, 995959, 995989, 996599, 996899, 996979, 997099, 997699, 997949, 997991, 998399, 998909, 998969, 998989, 999029, 999049, 999091, 999149, 999169, 999239, 999269, 999329, 999359, 999389, 999491, 999529, 999749, 999769, 999809, 999907, 999917, 999931, 999953, 999961, 999983]

(4)

eok := StringTools:-Explode~(sprintf~("%d", ok)):
eok := map(op, eok):
tok := sort(Statistics:-Tally(eok), key=(x -> lhs(x)))

["0" = 177, "1" = 938, "2" = 275, "3" = 926, "4" = 340, "5" = 257, "6" = 301, "7" = 902, "8" = 265, "9" = 859]

(5)

plots:-display(
  seq(
    plot([[k, 0], [k, rhs(tok[k+1])]], thickness=11, color=blue)
    , k=0..9
  )
)

 

 

 

Download Primes_corrected.mw

 


 

restart
rel :=  {x+abs(y+1)=1, y+abs(z+2)=1, z+abs(x-2)=1}
      {x + |y + 1| = 1, y + |z + 2| = 1, z + |x - 2| = 1}

# replace abs(u) by piecewise(u < 0, -u, u):

rel_2 := eval(rel, abs=(u -> piecewise(u < 0, -u, u))):
print~(rel_2):
            x + piecewise(y < -1, -y - 1, y + 1) = 1
            y + piecewise(z < -2, -z - 2, z + 2) = 1
            z + piecewise(x < 2, -x + 2, x - 2) = 1

solve(rel_2)
            {x = z + 1, y = -1 - z, -2 <= z, z <= 0}


The attached file contains a visual check of this solution
piecewised_relations.mw

For file T1.mw:
You have 7 equations and 3 unknowns and you can estimate yourself lucky to get a solution.

For file T2.mw:
You have 11 equations and 5 unknowns {d, a[1], b[1], c[1], c[2]}: thus there are all the reasons at world for you not getting a solution (unless your 11 equations are such that, by chance or by construction [compare EQ0 and EQ1 or EQ9 and EQ10] mutually dependent in some way.) 
Note that this is all the more true that you wrote

solve(Eqs, {a[0], a[1], b[1], c[1], c[2]})

instead of

solve(Eqs, {d, a[1], b[1], c[1], c[2]})

!!!

So let"s take only 5 equations out of the 11 ones (this can be done in 462 different ways) and look if all these 5-by-5 systems have a solution or not.
The attached file shows that 25 systems out of 462 do not have a solution.

Let's take anyone of them, for instance the system made of equations

{EQ[i], i in [0, 1, 3, 5, 7]}

Completing this set of equations by any non empty subset of this next set

{EQ[i], i in [2, 4, 6, 8, 9, 10]}

will give a new set of more than 5 equations which has no solution.
In particular the set

{EQ[i], i in [0, ..., 10]}

does not have a solution.

NULL

NULL

NULL

restart

with(student):

EQ[0] := -2*sinh(d)^2*b[1]*c[1]*c[2]/cosh(d)^2;

-2*sinh(d)^2*b[1]*c[1]*c[2]/cosh(d)^2

(1)

EQ[1] := -sinh(d)^2*b[1]*c[2]/cosh(d)^2;

-sinh(d)^2*b[1]*c[2]/cosh(d)^2

(2)

EQ[2] := 2*b[1]*(3*cosh(d)^4*c[1]*c[2]-cosh(d)^4-3*cosh(d)^2*c[1]*c[2]+cosh(d)^2+c[1]*c[2])/cosh(d)^4;

2*b[1]*(3*cosh(d)^4*c[1]*c[2]-cosh(d)^4-3*cosh(d)^2*c[1]*c[2]+cosh(d)^2+c[1]*c[2])/cosh(d)^4

(3)

EQ[3] := ((-1+(a[1]+3*b[1])*c[2])*cosh(d)^4+(1+(-a[1]-3*b[1])*c[2])*cosh(d)^2+b[1]*c[2])/cosh(d)^4;

((-1+(a[1]+3*b[1])*c[2])*cosh(d)^4+(1+(-a[1]-3*b[1])*c[2])*cosh(d)^2+b[1]*c[2])/cosh(d)^4

(4)

EQ[4] := ((2*a[1]*c[1]*c[2]-6*b[1]*c[1]*c[2]-2*a[1]+4*b[1])*cosh(d)^4+(-2*a[1]*c[1]*c[2]+6*b[1]*c[1]*c[2]+4*a[1]-6*b[1])*cosh(d)^2-2*b[1]*c[1]*c[2]-2*a[1]+2*b[1])/cosh(d)^4;

((2*a[1]*c[1]*c[2]-6*b[1]*c[1]*c[2]-2*a[1]+4*b[1])*cosh(d)^4+(-2*a[1]*c[1]*c[2]+6*b[1]*c[1]*c[2]+4*a[1]-6*b[1])*cosh(d)^2-2*b[1]*c[1]*c[2]-2*a[1]+2*b[1])/cosh(d)^4

(5)

EQ[5] := ((2+(-3*a[1]-3*b[1])*c[2])*cosh(d)^4+(-2+(3*a[1]+3*b[1])*c[2])*cosh(d)^2+1+(-a[1]-b[1])*c[2])/cosh(d)^4;

((2+(-3*a[1]-3*b[1])*c[2])*cosh(d)^4+(-2+(3*a[1]+3*b[1])*c[2])*cosh(d)^2+1+(-a[1]-b[1])*c[2])/cosh(d)^4

(6)

EQ[6] := ((-6*a[1]*c[1]*c[2]+2*b[1]*c[1]*c[2]+4*a[1]-2*b[1])*cosh(d)^4+(6*a[1]*c[1]*c[2]-2*b[1]*c[1]*c[2]-6*a[1]+4*b[1])*cosh(d)^2-2*a[1]*c[1]*c[2]+2*a[1]-2*b[1])/cosh(d)^4;

((-6*a[1]*c[1]*c[2]+2*b[1]*c[1]*c[2]+4*a[1]-2*b[1])*cosh(d)^4+(6*a[1]*c[1]*c[2]-2*b[1]*c[1]*c[2]-6*a[1]+4*b[1])*cosh(d)^2-2*a[1]*c[1]*c[2]+2*a[1]-2*b[1])/cosh(d)^4

(7)

EQ[7] := ((-1+(3*a[1]+b[1])*c[2])*cosh(d)^4+(1+(-3*a[1]-b[1])*c[2])*cosh(d)^2+a[1]*c[2])/cosh(d)^4;

((-1+(3*a[1]+b[1])*c[2])*cosh(d)^4+(1+(-3*a[1]-b[1])*c[2])*cosh(d)^2+a[1]*c[2])/cosh(d)^4

(8)

EQ[8] := 2*a[1]*(3*cosh(d)^4*c[1]*c[2]-cosh(d)^4-3*cosh(d)^2*c[1]*c[2]+cosh(d)^2+c[1]*c[2])/cosh(d)^4;

2*a[1]*(3*cosh(d)^4*c[1]*c[2]-cosh(d)^4-3*cosh(d)^2*c[1]*c[2]+cosh(d)^2+c[1]*c[2])/cosh(d)^4

(9)

EQ[9] := -sinh(d)^2*a[1]*c[2]/cosh(d)^2;

-sinh(d)^2*a[1]*c[2]/cosh(d)^2

(10)

EQ[10] := -2*sinh(d)^2*a[1]*c[1]*c[2]/cosh(d)^2;

-2*sinh(d)^2*a[1]*c[1]*c[2]/cosh(d)^2

(11)

Eqs := {seq(EQ[i], i = 0 .. 10)}:

Sol := solve(Eqs, {a[0], a[1], b[1], c[1], c[2]})

indets(Eqs, name);

{d, a[1], b[1], c[1], c[2]}

(12)

11!/5!/6!

462

(13)

AllCombs := convert~(convert(convert~(combinat:-permute(11, 5), set), set), list):

AllCombs := map(OneComb -> OneComb-~1, AllCombs):

failures := 0:
for r in AllCombs do
  s := solve({seq(EQ[i], i in r)}, {d, a[1], b[1], c[1], c[2]}):
  if [s]=[] then
    printf("%a\n", r):
    failures := failures+1:
  end if:
end do:

[0, 1, 3, 5, 7]

[0, 2, 3, 5, 7]

[0, 3, 4, 5, 7]

[0, 3, 5, 6, 7]

[0, 3, 5, 7, 8]

[0, 3, 5, 7, 9]

[1, 2, 3, 5, 7]

[1, 3, 4, 5, 7]

[1, 3, 5, 6, 7]

[1, 3, 5, 7, 8]
[1, 3, 5, 7, 9]

[1, 3, 5, 7, 10]

[2, 3, 4, 5, 7]

[2, 3, 5, 6, 7]

[2, 3, 5, 7, 9]

[2, 3, 5, 7, 10]

[3, 4, 5, 7, 8]

[3, 4, 5, 7, 9]
[3, 4, 5, 7, 10]

[3, 5, 6, 7, 8]
[3, 5, 6, 7, 9]
[3, 5, 6, 7, 10]

[3, 5, 7, 8, 9]

[3, 5, 7, 8, 10]
[3, 5, 7, 9, 10]

 

failures

25

(14)

 

NULL

Download T2_no_solution.mw

 

with(LinearAlgebra):

sys1   := [seq(Eq[i], i=1..4)]:
var1   := [seq(diff(v[i-1](t), t), i=1..4)]:
A1, B1 := GenerateMatrix(sys1, var1):
A1, B1 := GenerateMatrix(sys1, var1):

sys2   := [entries(B1, nolist)]:
var2   := [seq(v[i-1](t), i=1..4)]:
A2, B2 := GenerateMatrix(sys2, var2):
A2, B2 := GenerateMatrix(sys2, var2):

A1 &. <var1> = A2 &. <var2> - B2



Download MatrixForm.mw

Be carefull, this method doesn't handle correctly all the situations.

restart
alias (U=U(xi)):
Balance := proc(EQ)
  local eq   := eval(EQ, Diff=diff);
  local HODD := degree(eval(eval(eq, U=exp(__k*xi)), xi=0), __k);
  local HNLD := degree(eval(eq, U=__C), __C);
  M = solve(HNLD*M = HODD+M)
end proc:

eq := a*U+b*U^2+diff(U, xi$2)+diff(U, xi):
Balance(eq)
                             M = 2

eq := a*U+b*U^2+Diff(U, xi$2)+Diff(U, xi):
Balance(eq)

                             M = 2

eq := a*U+b*U^(-2)+diff(U, xi$5)+diff(U, xi$3)+c*U^3:
Balance(eq);
                                 5
                             M = -
                                 2

Let 

f := a -> x^3+a*x+1

a third degree polynom wrt x, parameterized by some real a.
In this simple case solve(f(a), x) doesn't return a list, nor a set, but a sequence:

f := a -> x^3+a*x+1solve(f(a), x):
whattype(%);
                            exprseq


If one defines a procedure sol this way

sol := a -> {solve(f(a), x)}:

one can easily verify that repeted executions of sol(a), where a is now assigned a numeric value, alwys returns theroots in the same order (defined by set):

  1. If the three roots are real the order is defined by '<', that is the smallest root is the first oneand largest the last one.
  2. If only one root is real and the two others are of the form p-q*I and  p+q*I (with q > 0), then the order is:
    1. the real root is the first,
    2. root  p-q*I is the second one,
    3. root  p+q*I is the last (third) one.

To avoid mixing the roots define the variable sola  this way:

sola := sol(a):

Then sola contains roots sorted according to the order given in points 1, 2, 3. This is because the formal result sol(a) contains a real root and two a priori conjugate complex roots (whoch might happento be both real for some values of a).

If you make a to vary in some real range, the first root in sola, which is assumed to be real, will take indeed real values, but also complex values, which means that its rank can take values 1, 2 or 3 depending on the value of a.
The plots in the attached file show how the rank of the three roots evolve as a ranges from -5 to +5.

To answer your question:

  • The order of roots depends on their expression (real, p-q*Ip+q*I) and then a root who was ranked first for some value of a, can be ranked 2 or 3 for a close value of a, giving the false impression of a "random" order returned by solve.
  • To understand (and control it?) this phenomenon you must "stuck" the roots, for example by doing sol := a -> {solve(f(a), x)}, and assign the roots a name, for instance
    R1, R2, R3 := sola[]:
    
    # check
    R1;
    R2;
    R3;
    Doing this will help you to track a given root as a evolves.

root_order.mw

restart:

for i from 1 to 1000 do

  # your own lines are replaced by a sleep of 0.01 second
  Threads:-Sleep(.01);

  if i mod 100 = 0 then
    DocumentTools:-Tabulate(
      [sprintf("%d", i)],
      'alignment'='left',
      'widthmode'='percentage',
      'width'=10
    )
  end if
end do

Download Counter.mw

An alternative: search on this site for "progression bar" 

I suggest you to solve the pde without any boundary condition, which will givea solution that contains integration constants, and next to evaluate these constants given the boundary condition.

If I'm not mistaken thesolution should be this one: laplacian_mmcdara.mw

Here is an example of compartmental model (4 compartments) and a way to assess its transition coefficients given some observations.
As I do not have any observation for this hypothetical model I used the classical technique wich consists in creating "pseudo-observations" which correspond to the value of this model at some times.
More precisely for a N-compartments model M(x1(t), ..., xN(t), t ; K) with transition matrix K  (K numeric), the "pseudo-observations" are mape of P (N+1)-tuples { (t, x[1](t), ..., x[N](t)), t in {t1, ..., tP} }.
The goal is then to recover blindly estimations of K by exploting some prior domain Dom(K).
Without observation noise this estimation should be equal to K provided the model is identifiable (which depends on K and of the observations).

The attached file presents the case of noise free observations and a noisy case.

Hope this will give you some idea to go further.
An_example.mw
An_example_edited.mw

For a 9-compartment model you have potentially 90 coefficients to assess (9^2 compartment-to-compartment coefficients plus 9 compartment-to-exterior coefficients) which is almost impossible with usual methods unless the 9-by-9 matrix K is very parse (by "usual methods" I mean optimization methods by contrast to neural network methods for instance)
Even with specific estimation methods it's very unlikely that the solution you get will be "numerically unique": it often happens that the estimation which minimizes some discrepancy between model predictions and observations is not a point but a variety of higher dimension or, even if this is indeed a single point, that large deviations in some directions around it (think to this point as a point in dimension 90 for instance) do not change significantly the value if the discrepancy.

So be extremely carefull in applying a minimization algorithm.
A preliminary analysis may help. For instance, for large times, the behavior of some xn(t) is generally governed by the largest coefficient kn, m: this is a trick which can enable assessing the values of the leading coefficients of each equation?

Without knowing your model it's not possible to say more (see @Carl Love's reply).

I assume the histograms you refer two are those created by the package Statistics?
If they come from package ImageTools what I say doesn't apply.

restart

with(Statistics):

N := 100:
K := 5:
S := Sample(Uniform(0, 1), N):

H := Histogram(S, maxbins=K):
plots:-display(H);

 

# Structure of H

op(H);

POLYGONS([[HFloat(0.011902069501241395), 0], [HFloat(0.20364021195311627), 0], [HFloat(0.20364021195311627), HFloat(1.0430892750001413)], [HFloat(0.011902069501241395), HFloat(1.0430892750001413)]], [[HFloat(0.20364021195311627), 0], [HFloat(0.39537835440499114), 0], [HFloat(0.39537835440499114), HFloat(0.9387803475001271)], [HFloat(0.20364021195311627), HFloat(0.9387803475001271)]], [[HFloat(0.39537835440499114), 0], [HFloat(0.587116496856866), 0], [HFloat(0.587116496856866), HFloat(0.8866258837501201)], [HFloat(0.39537835440499114), HFloat(0.8866258837501201)]], [[HFloat(0.587116496856866), 0], [HFloat(0.7788546393087409), 0], [HFloat(0.7788546393087409), HFloat(0.9909348112501342)], [HFloat(0.587116496856866), HFloat(0.9909348112501342)]], [[HFloat(0.7788546393087409), 0], [HFloat(0.9705927817606158), 0], [HFloat(0.9705927817606158), HFloat(1.3560160575001836)], [HFloat(0.7788546393087409), HFloat(1.3560160575001836)]], COLOUR(RGB, .24313725, .34117647, .54117647)), AXESSTYLE(BOX)

(1)

# H is made of K polygons (the K vertical bars)

g := [plottools:-getdata(H)];

g := [["polygon", [0.119020695012413951e-1 .. .203640211953116268, 0. .. 1.04308927500014126], Matrix(4, 2, {(1, 1) = 0.11902069501241395e-1, (1, 2) = .0, (2, 1) = .20364021195311627, (2, 2) = .0, (3, 1) = .20364021195311627, (3, 2) = 1.0430892750001413, (4, 1) = 0.11902069501241395e-1, (4, 2) = 1.0430892750001413}, datatype = float[8])], ["polygon", [.203640211953116268 .. .395378354404991139, 0. .. .938780347500127066], Matrix(4, 2, {(1, 1) = .20364021195311627, (1, 2) = .0, (2, 1) = .39537835440499114, (2, 2) = .0, (3, 1) = .39537835440499114, (3, 2) = .9387803475001271, (4, 1) = .20364021195311627, (4, 2) = .9387803475001271}, datatype = float[8])], ["polygon", [.395378354404991139 .. .587116496856865955, 0. .. .886625883750120081], Matrix(4, 2, {(1, 1) = .39537835440499114, (1, 2) = .0, (2, 1) = .587116496856866, (2, 2) = .0, (3, 1) = .587116496856866, (3, 2) = .8866258837501201, (4, 1) = .39537835440499114, (4, 2) = .8866258837501201}, datatype = float[8])], ["polygon", [.587116496856865955 .. .778854639308740881, 0. .. .990934811250134162], Matrix(4, 2, {(1, 1) = .587116496856866, (1, 2) = .0, (2, 1) = .7788546393087409, (2, 2) = .0, (3, 1) = .7788546393087409, (3, 2) = .9909348112501342, (4, 1) = .587116496856866, (4, 2) = .9909348112501342}, datatype = float[8])], ["polygon", [.778854639308740881 .. .970592781760615808, 0. .. 1.35601605750018361], Matrix(4, 2, {(1, 1) = .7788546393087409, (1, 2) = .0, (2, 1) = .9705927817606158, (2, 2) = .0, (3, 1) = .9705927817606158, (3, 2) = 1.3560160575001836, (4, 1) = .7788546393087409, (4, 2) = 1.3560160575001836}, datatype = float[8])]]

(2)

# to get the "bins" you can
# (1) extract the K matrices from the list above

bins := map2(op, 3, g);

bins := [Matrix(4, 2, {(1, 1) = 0.11902069501241395e-1, (1, 2) = .0, (2, 1) = .20364021195311627, (2, 2) = .0, (3, 1) = .20364021195311627, (3, 2) = 1.0430892750001413, (4, 1) = 0.11902069501241395e-1, (4, 2) = 1.0430892750001413}, datatype = float[8]), Matrix(4, 2, {(1, 1) = .20364021195311627, (1, 2) = .0, (2, 1) = .39537835440499114, (2, 2) = .0, (3, 1) = .39537835440499114, (3, 2) = .9387803475001271, (4, 1) = .20364021195311627, (4, 2) = .9387803475001271}, datatype = float[8]), Matrix(4, 2, {(1, 1) = .39537835440499114, (1, 2) = .0, (2, 1) = .587116496856866, (2, 2) = .0, (3, 1) = .587116496856866, (3, 2) = .8866258837501201, (4, 1) = .39537835440499114, (4, 2) = .8866258837501201}, datatype = float[8]), Matrix(4, 2, {(1, 1) = .587116496856866, (1, 2) = .0, (2, 1) = .7788546393087409, (2, 2) = .0, (3, 1) = .7788546393087409, (3, 2) = .9909348112501342, (4, 1) = .587116496856866, (4, 2) = .9909348112501342}, datatype = float[8]), Matrix(4, 2, {(1, 1) = .7788546393087409, (1, 2) = .0, (2, 1) = .9705927817606158, (2, 2) = .0, (3, 1) = .9705927817606158, (3, 2) = 1.3560160575001836, (4, 1) = .7788546393087409, (4, 2) = 1.3560160575001836}, datatype = float[8])]

(3)

# (2) extract only the ranges
bins := map2(op, 2, g);

[[0.119020695012413951e-1 .. .203640211953116268, 0. .. 1.04308927500014126], [.203640211953116268 .. .395378354404991139, 0. .. .938780347500127066], [.395378354404991139 .. .587116496856865955, 0. .. .886625883750120081], [.587116496856865955 .. .778854639308740881, 0. .. .990934811250134162], [.778854639308740881 .. .970592781760615808, 0. .. 1.35601605750018361]]

(4)

# An other way is to use TallyInto:
# (note this method gives the counts)

epsilon := 1e-9:  # to catch the right end point

r := [seq((min..max+epsilon)(S), (max-min)(S)/K)]:
R := [seq(r[i]..r[i+1], i=1..K)]:

T := TallyInto(S, R)

[HFloat(0.011902069501241397) .. HFloat(0.203640212) = 20, HFloat(0.203640212) .. HFloat(0.3953783545) = 18, HFloat(0.3953783545) .. HFloat(0.587116497) = 17, HFloat(0.587116497) .. HFloat(0.7788546395) = 19, HFloat(0.7788546395) .. HFloat(0.970592782) = 26]

(5)

# If you want the frequencies do this

lhs~(T) =~ (rhs/N)~(T)
 

[HFloat(0.011902069501241397) .. HFloat(0.203640212) = 1/5, HFloat(0.203640212) .. HFloat(0.3953783545) = 9/50, HFloat(0.3953783545) .. HFloat(0.587116497) = 17/100, HFloat(0.587116497) .. HFloat(0.7788546395) = 19/100, HFloat(0.7788546395) .. HFloat(0.970592782) = 13/50]

(6)

 

Download HowToCatchTheBins.mw

In this kind of problem  the causality principle must hold: the Delta pulse is the cause of y(t), meaning that y(t) doesn't exist before Delta is applied.
So it doesn't matter to consider the limit of y(t) when t goes to 0 from the left.
The Laplace transform, for instance, is perfectly suited tosolve this (linear) problem:

restart
de := D(y)(t) + y(t)/tau = Dirac(t)/tau;
                             y(t)   Dirac(t)
                   D(y)(t) + ---- = --------
                             tau      tau   
with(inttrans):
lde := laplace(de, t, p)
                                   laplace(y(t), t, p)    1 
    p laplace(y(t), t, p) - y(0) + ------------------- = ---
                                           tau           tau
lde0 := eval(lde, y(0)=0):
ly := rhs(isolate(lde0, laplace(y(t), t, p))):
Y := unapply(invlaplace(ly, p, t), t)
        /   t \
     exp|- ---|
        \  tau/
t -> ----------
        tau    

Download laplace.mw

Two solutions:

restart:
with(LinearAlgebra):

sanity := proc()
  local A, __U, __S, __Vt;
  A :=RandomMatrix(3,10);
  __U, __S, __Vt := SingularValues(A, output=['U','S','Vt']);
end proc:

sanity():

or (IMO better for future use)

restart:
with(LinearAlgebra):

sanity := proc()
  local A;
  A :=RandomMatrix(3,10);
  SingularValues(A, output=['U','S','Vt']);
end proc:

U, VS, Vt := sanity():

The (A?) key to get a solution up to xi=0.25 is to use a continuation method (see here help(dsolve, numeric_bvp, advanced) ).
I wasn't capable to get a solution for higher values of xi.

Does this "critical" value of 0.25 means something to you?
If not you can try, as suggested by the error messages, to change the continuation strategy... but this likely require a lot of time that I have not to help you further.

secod_code_mmcdara.mw

in exponentials:

restart; with(plots); Digits := 10; L := 1; TT := 0.1e-2; l := 1/5; b[1] := .18; b[2] := 2*10^(-9); k[1] := 1.3*10^(-7); k[-1] := 24; k[2] := 7.2; p := .9997; d[1] := 0.412e-1; f := .2988*10^8; g := 2.02*10^7; s := 1.36*10^4; E[0] := 3.3*10^5; T1[0] := .5*10^9; C1[0] := 3.3*10^5; alpha[0] := 10^(-10); D1 := 10^(-6); D2 := 10^(-2); D3 := 10^(-6); d[4] := 1.155*10^(-2); t[0] := 1/D1; kappa := 10^4; k[3] := 300*(24*60); chi := 0; sigma := d[1]*t[0]; rho := f*t[0]*C1[0]/(E[0]*T1[0]); mu := k[1]*t[0]*T1[0]; eta := g/T1[0]; `&epsilon;` := t[0]*C1[0]*(p*k[2]+k[-1])/E[0]; omega := D3/D1; beta1 := b[1]*t[0]; beta2 := b[2]*T1[0]; phi := k[1]*t[0]*E[0]; lambda := t[0]*C1[0]*(k[-1]+k[2]*(1-p))/T1[0]; psi := t[0]*(k[-1]+k[2]); gamma1 := chi*alpha[0]/D1; delta := D2/D1; kappa := k[3]*t[0]*C1[0]/alpha[0]; xi := d[4]*t[0]; PDE1 := diff(u(y, t), t) = diff(u(y, t), y, y)-gamma1*(u(y, t)*(diff(theta(y, t), y, y))+(diff(u(y, t), y))*(diff(theta(y, t), y)))+sigma*piecewise(y <= l, 0, 1.)+rho*C(y, t)/(eta+T(y, t))-sigma*u(y, t)-mu*u(y, t)*T(y, t)+`&epsilon;`*C(y, t); PDE2 := diff(theta(y, t), t) = delta*(diff(theta(y, t), y, y))+kappa*C(y, t)-xi*theta(y, t); PDE3 := diff(T(y, t), t) = omega*(diff(T(y, t), y, y))+beta1*(1-beta2*T(y, t))*T(y, t)-phi*u(y, t)*T(y, t)+lambda*C(y, t); PDE4 := diff(C(y, t), t) = mu*u(y, t)*T(y, t)-psi*C(y, t); ICs := u(y, 0) = piecewise(0 <= y and y <= l, 0, 1-exp(-0.1e-2*(y-l)^2)), T(y, 0) = piecewise(0 <= y and y <= l, 1-exp(-0.1e-2*(y-l)^2), 0), C(y, 0) = piecewise(l-`&epsilon;` <= y and y <= l+`&epsilon;`, exp(-0.1e-2*(y-l)^2), 0), theta(y, 0) = 0; BCs := {(D[1](T))(0, t) = 0, (D[1](T))(1, t) = 0, (D[1](theta))(0, t) = 0, (D[1](theta))(1, t) = 0, (D[1](u))(0, t) = 0, (D[1](u))(1, t) = 0}; HA1 := [0]; AA := [red, green, blue, cyan, purple, black]

 

PDE := {PDE1, PDE2, PDE3, PDE4}; pds := pdsolve(PDE, {ICs, BCs[]}, numeric, spacestep = 1/50, timestep = 1/50)

{diff(C(y, t), t) = 65000000.00*u(y, t)*T(y, t)-31200000.0*C(y, t), diff(T(y, t), t) = diff(diff(T(y, t), y), y)+180000.00*(1-1.000000000*T(y, t))*T(y, t)-42900.00000*u(y, t)*T(y, t)+15841.42560*C(y, t), diff(theta(y, t), t) = 10000*(diff(diff(theta(y, t), y), y))+0.1425600000e28*C(y, t)-11550.00000*theta(y, t), diff(u(y, t), t) = diff(diff(u(y, t), y), y)+41200.0000*piecewise(y <= 1/5, 0, 1.)+59760.00000*C(y, t)/(0.4040000000e-1+T(y, t))-41200.0000*u(y, t)-65000000.00*u(y, t)*T(y, t)+31197840.00*C(y, t)}

 

_m4725937312

(1)

Plotsu := pds:-plot[plots:-display](u(y, t), t = TT, linestyle = "solid", labels = ["y", "u"], color = red, numpoints = 800); -1; plots:-display(Plotsu)

 

NULL

Download Num_PDE_mmcdara.mw

3 4 5 6 7 8 9 Last Page 5 of 51