acer

32303 Reputation

29 Badges

19 years, 308 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Anthrazit Sorry. I added a basic template to my previous Reply.

I don't use the Maple Code Editor. I use a good editor in my OS.

I use the stand-alone mint utility in the Maple "bin" directory to check my source code. (It's much more flexible than the M.C.E. for syntax checking, and historically far less buggy.)

The storage and build process I've outlined is essentially how the module packages in Maple's own maple.mla Library are stored as source and built (for over 25 years now).

@Anthrazit There are other ways to get similar development functionality. (Recall that I had to guess as to what your actual objectives might be.)

My own strong preference is to use separate text files and the $include directive, which allows me to have a separate file for every local and export procedure of my module(s).

The basic structure of the module's top source file is,

M := module()
  export a,b,c;
  local f;
$include <path_to_a_source>
$include <path_to_b_source>
$include <path_to_c_source>​​​​​​​
$include <path_to_f_source>
  end module.

I can then call read on only that parent source, and then savelib or (my preference) LibraryTools:-Save. There are no top-level assignment side-effects for the procedures.

I would never store my precious plaintext source files only in something as fragile as a Maple workbook, and I'd never want to have two running duplicate locations for it all. I keep the individual plaintext files in a structured directory hierarchy. That also allows the huge benefit of being able to use a standard version control system to track my code revisions.

By using $include andactual text files I have no need for the side effect of creating a temporary top-level procedure like in your "lib/b", and no need for using ModuleLoad to copy that, and no protection issues. I also have the choice of running the Maple "build" commands in either a worksheet or a plaintext .mpl Maple file.

To address your bullet queries:

  • that is one way to make it work
  • that is one way to make it work
  • naturally, you can change the proc defn in "b" source, and rebuild.

@nm The parts that you see as (blue) 2D Input are so-called (Equation) Label References, and those are how Equation Label inputs/references appear if the GUI option is not set to render them as labels, ie. black ordinal within round brackets.

It's a flaw/bug that those cannot be directly copy&pasted properly (ie. to another worksheet, etc), even if the opened sheet is first re-executed.

@Paras31 I was curious they differ in a shorter time frame.

@Paras31 Do the contrary solutions (of this dynamical system that can exhibit chaotic behavior) start off similarly, and then diverge?

What solver is used for each, and what working precision, and what target accuracy?

@vv It can in fact still work, with Digits=15 at the top level and method=_d01akc (for oscillating integrand).

The various forced working precisions (the wrapping 'evalf[..]', digits=..., and even the evalf@Int tolerance epsilon) can be adjusted accordingly.

For example, Test_Int_fsolve_2.mw though I have not attemoted performance optimization because the target accuracy is as yet unstated.

In a severe case the integrand can also be unapplied with its own higher evalf[d] if necessary.

Note that your dsolve,numeric approach did not specify a final error tolerance, and the attained accuracy is as yet unshown. I'm not saying that it's less/more inaccurate, but I am saying that such would need to be established -- on both results -- before a thorough comparison is proper. (Some of the later entries in eqList are tougher than others...)

Note also that the OP has not (as yet) specified how much accuracy in the final results is desired.

@sija The first step is to change the undesirable
   Int( f(t), t=-4 .. t) = a
into something like,
   Int( f(t), t=-4 .. T) = a
or,
   Int( f(t), t=-4 .. x) = a
as vv had it. Otherwise it gets muddled up with name `t` serving two purposes.

Then I took rhs-lhs of the equations.

Then I used subsindets to replace the Int calls with a few options to force a fast hardware-float method and digits for the numeric quadrature, ie. when doing evalf(Int(...)).

Then I called fsolve, using unapply to turn the expressions into operator form with a forced evalf[15] to sidestep any Digits-raising by fsolve internally.

The numeric rootfinder fsolve has its own notions of accuracy and working precision, and so does evalf@Int. With one of these invoking the other then some case may be needed to balance the two (... the inner process producing at least as much accuracy --without cruft digits -- as the outer process expects, etc.)

@DJJerome1976 To be clear: for any axis you can always force your own custom tickmarks using a list of value=something items, some or all of which might be constructed conveniently using seq.

The lhs value of such items denotes where the tickmark label will appear. The rhs something denote what will appear there.

I only wrapped the something items in InertForm:-Display so that the fractions like -3*Pi/4 would not get rendered like -3/4*Pi which looks a bit awkward. That is to say, this doesn't look quite as nice:

plots:-polarplot(4, coordinateview = [0 .. 6,0 .. 2*Pi], thickness = 3,
                 axis[2]=[tickmarks=[seq(i*Pi/4=i*Pi/4-2*Pi,i=1..7),0=0],
                          gridlines=[8,subticks=2]]);

@DJJerome1976 

plots:-polarplot(4, coordinateview = [0 .. 6,0 .. 2*Pi], thickness = 3,
                 axis[2]=[tickmarks=[seq(i*Pi/4=InertForm:-Display(i*Pi/4-2*Pi),
                                         i=1..7), 0=0],
                          gridlines=[8,subticks=2]]);


Download polar_ticks_rev.mw

@emendes Yes, my Answer was submitted first. (I saw it alone, right after posting it.)

However, I do not care about votes, etc. Mark as "best" whichever you feel is best.

I have now seen another thread on this site in which later Answers appear at top (even without having more votes). It's a new bug in this forum itself.

@zenterix A few ways, for fun...

restart;

T := <1,2;3,4>;

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})

Q := copy(T):
Q[1,2] := K:
Q[2,1] := 700:
Q;

Matrix(2, 2, {(1, 1) = 1, (1, 2) = K, (2, 1) = 700, (2, 2) = 4})

Matrix(op(1,T),
       (i,j)->`if`([i,j]=[1,2],K,
                   `if`([i,j]=[2,1],700,T[i,j])));

Matrix(2, 2, {(1, 1) = 1, (1, 2) = K, (2, 1) = 700, (2, 2) = 4})

Matrix(op(1,T),
       (i,j)->piecewise([i,j]=[1,2],K,
                        [i,j]=[2,1],700,
                        T[i,j]));

Matrix(2, 2, {(1, 1) = 1, (1, 2) = K, (2, 1) = 700, (2, 2) = 4})

T;

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})

Download misc_mat.mw

Duplicate Question threads on solving this polynomial system F1=eval(ode,K) may be flagged as such and deleted.

You can put your followup queries (eg. about various options to solve, other techniques, post-processing and selection amongst solutions, etc) on solving this polynomial system here.

@salim-barzani I read that other mp3.mw attachment, and the .pdf file. It was a related query on the same underlying topic.

Please put such closely related followup queries in a single Question thread (or at the very least, utilize the Branch button to automatically link them). Wholly separate duplicate threads may get flagged as such and may be deleted.

ps. I have read all the (many) questions/worksheets by previous grad students asking for help on this topic on this forum, as well as all the responses.

@salim-barzani I have deleted yet another duplicate Question thread by you on this problem.

(I discussed this with the site admin a few days ago.)

I have deleted a duplicate Question thread of this.

If you have additional details or related queries on this example/task then please add them here instead of in a separate new Question.

First 30 31 32 33 34 35 36 Last Page 32 of 591