acer

32333 Reputation

29 Badges

19 years, 320 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@sursumCorda The different qualities of data structures can lend them to different kinds of good use.

For example, use of a list has been highly optimized within the Maple kernel/engine, in terms of memory management, especially for lightweight creation at small sizes. But it's not actually a mutable data structure and should not be used as such.

As an indexable, mutable data structure that can store numeric data in contiguous memory blocks (and thus allow no-copy transfer to externally linked code) the rtable (Matrix/Vector/Array) is great. It has "growable" functionality, but not in the same class as the mutable table hashed data structure.

The uniquification functionality of the set is also tuned.

These different data structures provide quite different functionality benefits, and suitability for different kinds of task. Unfortunately, I'm not aware of any good book or documentation chapter which focuses primarily on this through close explanation accompanied by example.

One of the few logical duplications is the (lowercase) table-based matrix & vector. The last-name-evaluation allowed for in-place (no copy) semantics when being passed as argument in a procedure call. The overlap with more modern Matrix/Vector is less evident, due to deprecation.

ps. There are several other additional data structures available for use in Maple. I just wanted to mention these basic & commonly used ones, to help illustrate a point.

ps. Mma also has more than one flavour of data structure. It's packed array shares some qualities with Maple's rtable, allowing for no-copy access by external functions. But it too has some optimal use-cases that are non-trivial in general, eg. use of ToPackackedArray, NumericArray. In fact Mathematica has many flavours of data structure, and knowing which to use optimally, and how, is also complicated.

@Anthrazit We all have such moments, now and then.

@Danish Toheed I asked whether your NM procedure can actually do root-finding sucessfully because it's not clear to me that it has been correctly implemented.

If there are no starting values (ie, x0) for which it converges to the roots (say, when the funciton is x^3-1) then won't it be problematic to try and use it for computing basins of attraction?

Please consider that an addition to my previously list of queries above. In my opinion those are still germane to the goal of plotting basins of attraction.

@Danish Toheed Can you demonstrate that your NM procedure can actually be used to return approximations of the three complex roots of k^3-1 ?

Please don't start a duplicate Question thread for this.

If you have revisions to your code you can attach them in Replies here.

@Danish Toheed You've repeated much of the information you had previously given, but you haven't answered my queries, and you haven't added the missing, crucial, details. Your latest Reply hasn't really provided additional information.

You may have noticed that your iterated augmentation of sol_coordinates is muddled up and not working properly. Your code has an outer loop, (for i from 1 to nIteration do...). Now, I don't think that you understand what I meant before by "inner loop". There is an inner loop, in the lines,
   sols := [op(sol_coordinates), x];
   for sol in sols do
      sol_coordinates := [op(sol_coordinates), [sol, 0]];
   end do;

And it's not clear what you're hoping that inner loop would accomplish. It seems its purpose is to form the final numeric point data for the plot. But, as written, it's creating a muddled structure rather than well structured actual numeric data points (eg. a list of lists of numeric pairs). In order to fix it, we should be told the exact goal for it. Your code has no comments that might make the intended structure clear. 

You use the plot command, which is for 2D plots. So, what do you intend that the horizontal/vertical data pairs will represent, at each plotted point -- if constructing sol_coordinates were actually successful?

For example, are the horiz/vertical point pairs just going to be the i and x values in the outer loop?  If so, then why did you you write the inner loop?! What do you think that your inner loop would do?

Also, your code appears to use a single intial value, x0, and then iterate. How would using a single initial value be a way to construct a plot of a basin of attraction?

Moving on... are you trying to make Newton's method work in the complex plane? It seems so, to me, judging by your phrase, "rectangle D ∈ C of size [−2, 2] × [−2, 2]". But I don't see that in your code, or your choice initial point x0, or your attempt at assembling data from the iterations, etc. Please clarify.

ps. Why differentiate to obtain the expression assigned to df, if it's not going to be used?

I'm afraid that if you cannot answer these queries I would not be able to help you.

@Saha Duplicate queries against this example/problem will be flagged as such, and may be deleted.

@Saha To apply the sin command to x you need to enter it as,

   sin(x)

without spaces between the "sin" and the "(" if you are using 2D Input mode.

@Danish Toheed What are you trying to plot? I mean, what are the coordinates in some point-plot supposed to represent? The plotted point should each have two coordinate values -- for the horizontal and vertical positions.

It's not clear what your code is trying to accomplish. What's the purpose of the inner do-loop?

Your attachment seems to have been last saved in Maple 2021, but earlier you indicated that you were using Maple 18. Which do you use?

Why have you written,
   sin (x)
with a space, in 2D Input mode, instead of,
   sin(x)
?

Are you trying to copy some code written elsewhere? If so, was it in 1D plaintext, or 2D Input? If the former, then I suggest you use the same mode of entry.

@Saha Let's start again.

Now you've entered,
    sin (x)
which gets parsed as  sin * x , ie. a multiplication.

Again, did you intend the more usual,
   sin(x)
?

@jmakinde In your second attempt you did not load odeplot from the plots package (nor call it by its full name, plots:-odeplot).

You changed Tom's code, where he loaded the plots package.

Let's start off slow, with some basic syntax.

Did you intend
   sin(x)
where you had entered (in 2D Math mode)
   sin x
?

@Axel Vogt Nicely done.

@pik1432 The other answers all used your additional helper equation eq_Dx, whereas the answer I gave did not need it. (I was supposing that you might have created that additonal equation manually.)

But, given your additional eq_Dx, then your target can be obtained by,

subs((rhs=lhs)(eq_Dx),eq_K1_m4)

K__1 = E__q0*(R__T*E__B*sin(delta)+X__Td*E__B*cos(delta))/Dx+(X__q-X__dp)*i__q0*(X__Tq*E__B*sin(delta)-R__T*E__B*cos(delta))/Dx

First 69 70 71 72 73 74 75 Last Page 71 of 591