acer

32333 Reputation

29 Badges

19 years, 322 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

You have omitted showing us any proper example of your current process of reading the external data file and importing it into a Maple data structure.

It should be clear that (evan a small) representative example of your actual current process and data would properly help in providing a sensible commentary on how you might proceed.

Who has changed and corrupted two questions by the member?

It is not helpful or constructive to omit any examples which show what has happened unexpectedly, and side comments to describe what you wanted.

So far, we don't know precisely what you did. We don't even know whether you were acting within a procedure, or at the top-level, or making using of lexical scoping, or passing arguments in procedure calls, or some mix of those, etc.

Stop submitting duplicate question threads for this.

Stop submitting duplicate question threads for this.

Stop submitting multiple Question threads that relate to your trying to get started on this platform.

Stop submitting multiple Question threads that relate to your trying to get started on this platform.

 

@RohanKarthik As I mentioned in my Answer, tou can enter and execute plaintext 1D Maple Notation code within an Execution Group or a Code Edit Region.

For example -- even within a Document -- you can obtain either of those from the "Insert" drop-menu from Maple's main menubar.

From a Worksheet one has Execution Groups as a the default mechanism for entering and executing code. The F5 key toggles between 1D and 2D input modes (as do Ctl-m and Ctl-r respectively)

This is all documented in the Help system. Start with the Help Topics,
    worksheet,documenting
    worksheet,documenting,executiongroups
    worksheet,documenting,2DMath

The platform (Windows, OS X, Unix, Linux) is not relevant to your question.

What may be relevant is the number of the "old" version, and the particular .m file. You didn't bother to provide either.

@opus64 And now you are missing the full details of what came before, in your session/worksheet. (See my Answer's last paragraph, which might describe parts of the cause.)

Guessing at problems is a "huge waste of time."

@Scot Gould The single left-quotes are so-called name-quotes. Here they denote that the word is being used in its operator form (with brackets and a sequence of arguments).

It is a documented part of the Maple language, and during parsing helps avoid amibiguity with the keyword if that occurs in if...then...end. There are a number of similar patterns like this in the language.

This syntax helps with some particular programming cases, and is not uncommonly used. It is not an obscure oddity.

[edit] It also allows for additional functional programming, useful for convenience and efficiency.

What do you mean, you "make an User interface"?

Do you mean you build it from Embedded Components, or Maplets? By hand from the palette, or fully programmatically?

You've omitted the key details.

@Scot Gould 

There can be a few purposes for a 'procname'(args) return, say when the arguments are nonnumeric. For example to avoid various kinds of premature evaluation of the call. The technique is sometimes referred to a making an unevaluated return.

The reason I used it was that I was trying to convince the solver that I had an expression, rather than an operator. But I didn't want the call proc3(K,r) to evaluate up front when passed to Minimize (because I wanted the wrapping evalf to remain, and any local change of Digits to still be in play). I could have tried also passing 'proc3'(K,r) with uneval quotes, but I really wanted to ensure that it wouldn't evaluate in some preprocessing (I was suspicious about the creation of the Gradient).

I wasn't trying to indicate that an actual attempt at numeric integration failed, by the unevaluated return.

Moving to your next query: I suspect that you would run into trouble if dummy integration variable name x evaluates to some assigned value (numeric, say) at the higher scope at which the procedure is called. The procedure won't make such dummy variables of integration into a local automatically. Maple would have flagged the f1,f2 because they are used in the LHS of an assignment statement. If you want to see warnings about use/reference within a procedure of names as if they were global then see the mint utility (or maplemint command, though weaker).

Yes, it's generally sloppy to rely on an unprotected name being unassigned at the higher scope, if referenced in the procedure.

The syntax :-K refers to the global name, to distingush it from the procedure parameter K. Your expression df was defined at the top-level and contained the global :-K. So I substituted the values of parameter K in for the instance of global :-K within df. And similarly for r, say.

As for the unapply, it is complicated. By default evalf(Int...)) tries to find points of discontinuity at which it may have to split the integration, in part because most of its arsenal of numeric integrators rely on smoothness of the integrand (to attain some accuracy). Nobody wants wrong results. But there are few easy ways to disable such discontinuity checks, which may be quite expensive. Sometimes it can be done by specifying a NAG method (say, _d01ajc) but that's only for real-valued integrands with hardware precision. By changing the integrand expression into an integrand procedure it acts like a black box and doesn't get poked at for such checks. In severe cases the cost of using unapply for each integration call can be measurably less that the overhead of the check. I would really like an easy option for making this effect.

@Carl Love Yes, thanks. There is also a pair DDTTRFB/DDTTRSB in MKL for factoring and backsolving for diagonally dominant tridiagonal matrix. (That factorization returns no pivot list, only using dl,d,du. I do not know what it uses, eg. Thomas' algorithm.)

Like you I consider it worthwhile to be able to separate the factorization from the solving step (for a given RHS). For the LU with pivoting that might be possible as a special list return from LUDecomposition, from the other tridiagonal solver I described in my Answer. That prefactorization list might then be passed into LinearSolve. That's how it works now for Cholesky, QR, and LU (but not band LU). It's a little awkward, and all those routines have overhead as they figure out how to dispatch, whether it's a float or exact problem, etc.

As an alternative... perhaps it would be worthwhile to create BLAS and LAPACK packages, with all the in-place and other goodness. They could run hardware and software floats, as possible. But a goal would be low overhead. It would also offer some nice efficiencies like being able to specify by semaphore that a Matrix argument was to be taken as "transposed", without copying or computation cost, eg. solve A^%T . x = b, or multiply a*A^%T . B , etc. I wouldn't be surprised if much of the code could be auto-generated. Another benefit is that CodeGeneration[C] might be taught about it. For some time I've thought about this.

@Rouben Rostamian  Thanks.

And yes, indeed, for a different example I might have had to call frontend differently (which is a common phenomenon for many frontend uses...).

So Physics:-diff is a more general solution for this kind of task.

note. It's often a good idea to allow these (default expression types, {`+`,`*`}) through as unfrozen,

  frontend(diff, [x(t)^2 + sin(x(t)+y(t)), x(t)], [{`+`,`*`},{sin}]);
                            2 x(t) + cos(x(t) + y(t))

  frontend(diff, [x(t)^2 + sin(x(t)+y(t)), x(t)], [{`+`,`*`,specfunc(sin)},{}]);
                            2 x(t) + cos(x(t) + y(t))
As the examples gets more involved and confusing even targeted freeze/thaw starts to look somewhat attractive. Having to double-check every answer robs an approach of merit. I guess I ought to have mentioned Physics:-diff first.

First 182 183 184 185 186 187 188 Last Page 184 of 591