5284 Reputation

17 Badges

7 years, 122 days

MaplePrimes Activity

These are replies submitted by mmcdara


Both @tomleslie and I have already answered the same thing to a previous question
It seems that @JAMET ​ does not read the answers it's been provided.


I also notice, as @tomleslie pointed out recently, that yours questions never provide any worksheet, a remark that obviously did not change your attitude..
I find this latter contemptuous and would personally make it a point to never respond to you again.


By the way, it happens that one of the best book ever (IMO) on data mining, inference and prediction is freely avaliable:

In my paper version Chapter 13 is entirely devoted to Nearest-Neighbors methods.
Several algorithms (sometimes in pseudo code are provided too).

PCR is described in pp 79-80, PLS in pp 80-82 and, more generaly, regression methods in Chapter 3.

@Carl Love 

Yeah, it was indeed clustering.
I don't remember exactly what you did but KNN is just a particular type of clustering.
Maybe this could help @vs140580

@Delali Accolley 

I consider that I have spent enough time trying to explain to you why your problem is not correctly set.
You have obviously paid no attention to my arguments and keep getting the same error again and again.
Please consider me finished with you.
I hope you find a more conciliatory ear than mine.


once again no uploaded worksheet.

There are always guys like that who think that there will be a kind soul to deal with all their mess

@Delali Accolley 

I would have hoped that you would have solved the question about "v" yourself.
Some points you have missed:

  • I see you have removed the option "numeric in pdsolve, but do you really think that your equations can be solved formally?
  • In your case you do use the option"numeric" (that is not that simple that what I showed in my previous reply).
    Which mean you have to transform your system in a differential (delayed) equation (see the file below).
  • You need to define l(t, v) (more likely l(t))

There are things only you can do, in particular:

  • What is l(t)?
  • As I guess your problem reducesto solving a couple of delayed differential equations of order two, you need to specify additional IC or BC ob a(t) and c(t).


# Keep alpha unassigned to get a simpler set of equations
# alpha := .3306341:
# Keep delta unassigned to get a simpler set of equations
# delta := solve(1+0.4877489e-1 = exp(delta_a));
T := 1:

l0 := 42.375*(33.16667/(52*(24-9.95)*7));
L0 := l0*T:




IOR := .2093723865:

KOR := IOR/delta:

r0 := alpha/KOR-delta:
# Keep alpha unassigned to get a simpler set of equations
# rho := r0:

# This is useless
# fsolve({K0 = Y0*KOR, w0 = (1-alpha)*Y0/L0, alpha*exp(x0)*K0^(alpha-1)*L0^(1-alpha) = r0+delta}); # # assign(%);

C0 := -K0*delta+Y0:
c0 := C0/T:

# this expression is too complex to avoid a concise representation of eq2
# sigma := w0*(1-l0)/c0:

eq1 := diff(c(t), t) = (r(t)-rho)*c(t);

eq3 := isolate( r(t)*a(t)+w(t)*l(t) = c(t)+diff(a(t), t), diff(a(t), t));


eq2 := sigma*c(t) = w(t)*(1-l(t));

eq4 := Y(t) = exp(x(t))*K(t)^alpha*L(t)^(1-alpha);

eq5 := r(t)-delta = alpha*Y(t)/K(t);

eq6 := w(t) = (1-alpha)*Y(t)/L(t);

eq7 := K(t) = int(a(v), v = t-T .. t);

eq8 := L(t) = int(l(v), v = t-T .. t);

eq9 := x(t) = piecewise(t = 0, 0, t > 0, 0.1e-1);

eq1 := diff(c(t), t) = (r(t)-rho)*c(t)


eq3 := diff(a(t), t) = r(t)*a(t)+w(t)*l(t)-c(t)




eq2 := sigma*c(t) = w(t)*(1-l(t))


eq4 := Y(t) = exp(x(t))*K(t)^alpha*L(t)^(1-alpha)


eq5 := r(t)-delta = alpha*Y(t)/K(t)


eq6 := w(t) = (1-alpha)*Y(t)/L(t)


eq7 := K(t) = int(a(v), v = t-1 .. t)


eq8 := L(t) = int(l(v), v = t-1 .. t)


x(t) = piecewise(t = 0, 0, 0 < t, 0.1e-1)


SV := {a(0) = 0, c(0) = c0};

{a(0) = 0, c(0) = -K0*delta+Y0}


pdsolve(eq, SV, numeric, 'time' = t, 'range' = 0 .. T)

Error, (in pdsolve/numeric/process_PDEs) number of dependent variables and number of PDE must be the same


Given that the initial condition is set at time t=0 and that the differential equation are to be
verified on (0, +oo), there is no need to use a piecewise fnction to define x(t)

eq9 := x(t) =0.01

x(t) = 0.1e-1



"Simplification" of differential equation eq1


# Express r(t) (lhs of eq1) in terms of other quantities
# Note this expression contains l(t, v) which is never defined elsewhere.
# So you can expect to have problems.

expr_r := isolate(eval(eval(eval(eq5, eq4), [eq7, eq8]), eq9), r(t));

Eq1 := eval(eq1, expr_r);

r(t) = 1.010050167*alpha*(int(a(v), v = t-1 .. t))^alpha*(int(l(v), v = t-1 .. t))^(1-alpha)/(int(a(v), v = t-1 .. t))+delta


diff(c(t), t) = (1.010050167*alpha*(int(a(v), v = t-1 .. t))^alpha*(int(l(v), v = t-1 .. t))^(1-alpha)/(int(a(v), v = t-1 .. t))+delta-rho)*c(t)



"Simplification" of differential equation eq3


expr_w := isolate(eq2, w(t)):

Eq3 := eval(eq3, [expr_r, expr_w]):

# rewritten as (beta=alpha-1):

Eq3 := diff(a(t), t) = (1.010050167*alpha*(int(a(v), v = t-1 .. t))^beta*(int(l(v), v = t-1 .. t))^(1-alpha)+delta)*a(t)-sigma*c(t)*l(t)/(-1+l(t))-c(t):


Eq1 and Eq3 are a couple of integro-differential equations with unknowns "a" and "c".
(The question of what "l" is still open.)

Beyond the nature of "l": what are the integrals in the rhs of Eq1 and Eq3?

How to transform an integro-differential equation in to a delayed differential equation?

diff(u(t), t) = int(u(v), v = t-1 .. t);
diff(%, t);

diff(u(t), t) = int(u(v), v = t-1 .. t)


diff(diff(u(t), t), t) = u(t)-u(t-1)


Applying this strategy to (Eq1, Eq3) should potentially produce a couple of delayed
differential equations of order 2.

Until you solve the problem concerning l(t), the following remains theoretical.

Apply the principle above to Eq3 (for instance).

dEq3 := diff(Eq3, t):

isolate(Eq3, int(a(v), v = t-1 .. t)^beta):

int_a := isolate(Eq3, int(a(v), v = t-1 .. t)):
VisuallySimpler := rhs(int_a) = psi;

exp((-0.9999999949e-2+ln((sigma*c(t)*l(t)-1.*delta*a(t)*l(t)+c(t)*l(t)+(diff(a(t), t))*l(t)+delta*a(t)-1.*c(t)-1.*(diff(a(t), t)))*(int(l(v), v = t-1 .. t))^(-1.+alpha)/((-1.+l(t))*a(t)*alpha)))/beta) = psi


eval( eval(dEq3, int_a), VisuallySimpler);

diff(diff(a(t), t), t) = (1.010050167*alpha*psi^beta*beta*(a(t)-a(t-1))*(int(l(v), v = t-1 .. t))^(1-alpha)/psi+1.010050167*alpha*psi^beta*(int(l(v), v = t-1 .. t))^(1-alpha)*(1-alpha)*(l(t)-l(t-1))/(int(l(v), v = t-1 .. t)))*a(t)+(1.010050167*alpha*psi^beta*(int(l(v), v = t-1 .. t))^(1-alpha)+delta)*(diff(a(t), t))-sigma*(diff(c(t), t))*l(t)/(-1+l(t))+sigma*c(t)*l(t)*(diff(l(t), t))/(-1+l(t))^2-sigma*c(t)*(diff(l(t), t))/(-1+l(t))-(diff(c(t), t))


Here psi only contains a(t) and diff(a(t), t) meaning the equation above is a
delayed (highly non linear) differential equation.
Do the same for Eq1.

Once you have validated what I did ad fixed the "l(t) issue", come back again on this thread.


Very interesting and well done.

I would like to recommend this excellent site, unfortunately (for you?) in French, which gathers a lot of information about 2D and 3D curves and surfaces, polygons and polyhedra:

The stellated dodecahedron is here

@Carl Love 

I agree that "nolist" not being the default option is a nuisance.

@Carl Love 

Don't you mean 
plots:-display([entries(IP, nolist)])
plots:-display(entries(IP, nolist))

But maybe the 'nolist' option is the default choice in the newest Maple version


Your first case is treated here in a more complete way (two resampling methods and a lot of additional plots including confidence interval on the prediction)

Here is your second case.

BTW: I realized I didn't answer your two final questions :

  • Also, is there a command that returns the errors for the variaous fit parameters? (i.e. a,b,c,d)
    Answer is NO

  • Or at least, someone knows the methods and formulas to find them?
    Answer is YES, there exist methods to find them, but NO, there is no formula in the general case
    (unless you can find a transformation that linearizes the model w.r.t. the parameters)


Thanks @vv, I did nothing


It(s likely I didn't read the full question and focused on the many simplification attempts.


Here is an edited version of the worksheet I already sent you.

In particular you will see how to use Optimization:-Minimize for future needs.
The main problem comes from the fact that K is to be an integer and that NLPSolve doesn't handle integer variables.
So a strategy could be to find the minimum over (A, M) for any integervalue of K in some range 0...Kmax (see the file above).

Watchout, Optimization:-Minimize is extremely slow and I think that using it requires some preliminary simplifications of the function to minimize (if possible).

The error message seems quite clear (Maple 2015.2)

Error, (in pdsolve/numeric/process_PDEs) can only numerically solve PDE with two independent variables, got {r, t, z}

Your pde contains 3 independent variables t, r, an z and Maple can't handle this.

REMARK: event the stationnary problem (a Laplace equation in axi-symetric cylindrical coordinates) cannot be handled by Maple (2015.2) 
Error, (in pdsolve/numeric) unable to handle elliptic PDEs


And I've deleted mine.

Good point for seeing that it was volts.
I vote up

First 15 16 17 18 19 20 21 Last Page 17 of 113