acer

32363 Reputation

29 Badges

19 years, 332 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Hopefully dissection by StringTools would be minimal, and the bulk of the parsing be done by sscanf.

But the ability to automatically grab and process tabular data from webpages is useful.

A case in point: the software Fathom has some of this functionality, which I suspect was in part what allowed them to become [1] one of the few pieces of commercial software to get broad licensing in some Ontario education boards (which Maple has not had since Maple V, if I recall).

acer

@Markiyan Hirnyk Of course I read that comment carefully, just as I also read carefully the comment from which this post was branched.

I knew that a multi-start approach could be attained by simply giving options to DirectSearch. The author of the comment you cite didn't mention it specifically, but here is how DirectSearch offers such functionality at present,

DirectSearch:-DataFit(F
                      , [a=0..10, b=-10..10, c=0..100, d=0..7, e=0..4]
                      , X, Y, x
                      , optimizer=globalsearch
                      , evaluationlimit=30000
                      , number=10
                      , timelimit=60
                              );

With such a calling sequence, the DataFit command does 10 repeated starts, and does its best to adhere to a 60 second timelimit. One difference (which is important to me, and might be to others) is that the repeater wrapper allows one to receive asynchronous status messages (in the commandline or Classic interfaces, or in a Worksheet of the Standard GUI). I have not seen how to make DirectSearch produce such messages, on its own. If I call the DataFit command with a 24 hour timelimit, then I would certainly like to know how well it is progressing in the interim.

Also this wrapper has a certain amount of genericity about it. So it might be reused for other tasks with somewhat similar behaviour. Improvements and comments are welcome. I posted this because it might help someone else not have to reinvent the wheel.

The GlobalOptimization package exports a useful command, GetLastSolution. I believe that it can be used to retrieve the best value even when the computation is interrupted, and not just timed out. That kind of functionality is another possible improvement to this wrapper, as I mentioned. I'd be happy to be shown how, but as yet I haven't seen how it can be done at present using DirectSearch (unless one makes the extra effort to modify the objective procedure to do its own retainment bookkeeping -- which also might make it unevalhf'able and possibly slower).

@sreid I don't understand what you mean about Y's 9th value.

As the code stands, it looks like the Fit command is going to receive a Vector X of length 8 and a Vector Y of length 9, and that (in itself) will generate a runtime error.

@sreid I don't understand what you mean about Y's 9th value.

As the code stands, it looks like the Fit command is going to receive a Vector X of length 8 and a Vector Y of length 9, and that (in itself) will generate a runtime error.

@Dragonsoul02 The problem seems to lie with the IC of a(0)=0.

How do you interpret the first system, with that setting?

Specifying a(0) just a small amount above 0.0 seems to do better.

@Dragonsoul02 The problem seems to lie with the IC of a(0)=0.

How do you interpret the first system, with that setting?

Specifying a(0) just a small amount above 0.0 seems to do better.

Maple 15 showed the double attractor nicely for your correction of the code, eg. with just a few more options to DEplot3d such as,

stepsize = .01, thickness=1, orientation=[90,70,135]

acer

Maple 15 showed the double attractor nicely for your correction of the code, eg. with just a few more options to DEplot3d such as,

stepsize = .01, thickness=1, orientation=[90,70,135]

acer

That doesn't look right. You've used  rhs(func(1)[2])*z(t) which is hard-coded to evaluate func at the point 1.

sol1:=dsolve({x(0)=.1,diff(x(t),t)=x(t)},numeric,output=listprocedure);
func := eval(x(t),sol1);
func(2);
sol:=dsolve({z(0)=.1,diff(z(t),t)=func(t)*z(t)}, numeric,known=[func]);
plots:-odeplot(sol,0..4);

Using output=listprocedure makes it a bit easier to understand (I think) than the following, which is more like the original form posed,

restart:
sol1 := dsolve({diff(x(t), t) = x(t), x(0) = 0.1}, numeric):
func := proc(q)
   if not type(q,numeric) then 'procname'(q);
   else rhs( op(2, sol1(q)) ); end if;
end proc:
sol:=dsolve({diff(z(t), t) = func(t) * z(t), z(0) = 0.1},numeric,known=func):
func(2);
plots:-odeplot(sol,0..4);

Perhaps the submitter might also like to know that it is not always necessary to dsolve for a procedural solution to x(t) separately from solving for z(t). For the example given, Maple can solve them together as a coupled system.

restart:
sol:=dsolve({diff(x(t),t)=x(t), x(0)=.1}
            union
            {diff(z(t),t)=x(t)*z(t), z(0)=0.1},
            numeric):
sol(2);
plots:-odeplot(sol,[t,z(t)],0..4);

acer

That doesn't look right. You've used  rhs(func(1)[2])*z(t) which is hard-coded to evaluate func at the point 1.

sol1:=dsolve({x(0)=.1,diff(x(t),t)=x(t)},numeric,output=listprocedure);
func := eval(x(t),sol1);
func(2);
sol:=dsolve({z(0)=.1,diff(z(t),t)=func(t)*z(t)}, numeric,known=[func]);
plots:-odeplot(sol,0..4);

Using output=listprocedure makes it a bit easier to understand (I think) than the following, which is more like the original form posed,

restart:
sol1 := dsolve({diff(x(t), t) = x(t), x(0) = 0.1}, numeric):
func := proc(q)
   if not type(q,numeric) then 'procname'(q);
   else rhs( op(2, sol1(q)) ); end if;
end proc:
sol:=dsolve({diff(z(t), t) = func(t) * z(t), z(0) = 0.1},numeric,known=func):
func(2);
plots:-odeplot(sol,0..4);

Perhaps the submitter might also like to know that it is not always necessary to dsolve for a procedural solution to x(t) separately from solving for z(t). For the example given, Maple can solve them together as a coupled system.

restart:
sol:=dsolve({diff(x(t),t)=x(t), x(0)=.1}
            union
            {diff(z(t),t)=x(t)*z(t), z(0)=0.1},
            numeric):
sol(2);
plots:-odeplot(sol,[t,z(t)],0..4);

acer

@OxidisedLizard Ah, you are using Maple 12.

Better to let us know this detail earlier. I will change the top-post to reflect this.

@OxidisedLizard Ah, you are using Maple 12.

Better to let us know this detail earlier. I will change the top-post to reflect this.

@jeffb Yes, of course that doesn't work.

It doesn't work for those two Matrices with your original code, either.

You cannot multiply a 2x3 Matrix by a 2x3 Matrix, in the usual way. Look at my question to you above, about checking whether the number of columns of A should match the number of rows of B.

@jeffb Yes, of course that doesn't work.

It doesn't work for those two Matrices with your original code, either.

You cannot multiply a 2x3 Matrix by a 2x3 Matrix, in the usual way. Look at my question to you above, about checking whether the number of columns of A should match the number of rows of B.

@Hyperian ...with the op command.

First 407 408 409 410 411 412 413 Last Page 409 of 592