acer

20777 Reputation

29 Badges

15 years, 55 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Carl Love In my Answer I used a nontrivial example instead, in which there is a possibility of optimization in computing the entry values. For a Matrix return (in the Maple language) the optimize option does not act, but it does for a listlist. And for both kinds of Maple structure the Matlab return structure is of the same kind. And so there can indeed be merit to passing the option.

@tomleslie Your comment is also about a situation related to need of local declaration, but a different situation, that is quite different from that of the OP which is primarily about the status of procedure parameters.

I just happened to make an aside, in my Answer, about an unused local and which of nm's two procs was "better". But IMO that really wasn't the central topic of the Question. (Joe's Answer also is about unused locals which -- while checking for such relates to the latter, lesser part of the Question in a roundabout causal way -- otherwise doesnt explain the primary Question asked, IMO.)

You can put your other examples in a Comment or Reply or addendum to the original Question.

Don't delete the original!

@mmcdara Equation labels can appear on output of "executable 2D Math". I believe that the OP knows this, and has instead asked for convenient labeling of non-executable (inlined) 2D Math. So, I don't see how your comment relates to the request.

It might suffice (as far as the OP is concerned) to output expressions protected against values being assigned to any unknowns, and also with input suppressed. That's possible, but awkward to explain.

@chelchax It was clear upon first read that the code you posted was muddled about the roles of h and N (with initial point a and target end-point b also supplied).

Those four quantities are related mathematically. You cannot (logically) force your own choice for all four of them at once. At least one of them needs to depend formulaically upon the others.

You subsequently added a followup Comment/Reply stating that you intended to force values for h the stepsize. That's quite natural, IMO, and a common way to code this task. Hence I revised the procedure RK4 so that -- given a supplied stepsize h and end points a,b -- it would compute an N that fit closest to target b without going past. It doesn't matter whether N is computed in the body of RK4, or in the call to it. What matters is here is that N depends on h,a, and b. It also doesn't matter much to this aspect of the argument whether you take the floor gettting almost up to b, or take the ceil to get just past b.

The image of the code that you now show does it the other way. It computes the stepsize h depending on a,b and N. That's not wrong, though IMO it looks a little awkward. It's a trivial adjustment to the code and you ought to be able to accomplish it. But you should realize that you would subsequently utilize the ensuing procedure by forcing (supplying, passing) a value for N rather than for h (since it really doesn't seem useful to have the end-point b be dependent and not specified by you). That contradicts your earlier stated requirement of intending to specify h the stepsize.

Does all that make sense?

Which do you prefer?

You could even have code that did it either way (dependent h, or dependent N), according to some option passed to the procedure. But you can't logically specify forced values for all of a,b,h, and N together.

@Trebron Here is one way to get to your new goal:

T:=table([.6, 1.2, 2.0, 3.3, 4.1, 5.0, 5.5, 5.8]):

plot([seq([i, T[i+1]], i=0..nops([entries(T)])-1)]);
plot([seq([i, T[i+1]], i=0..nops([entries(T)])-1)], style=point);

(I don't understand why you did not provide all additional information when you first asked the Question.)

[edit] The code above is, in my opinion, quite straightforward and should be understandable to a beginner in Maple. There are many other ways to accomplish the given task, including some with very fancy/slick functional programming -- which I don't think is best for a beginner in Maple.

@chelchax Please don't repost duplicates of this. Duplicates will be flagged as such, and may be deleted.

Followup details are useful, and can be placed here (as Comment/Reply on the Question or one of its Answers).

You may need to have a little patience.

What progress have you made so far, on this?

If it's really a table then it has indices as well as entries. What are they?

If it's not actually a table (ie. a list or something else) then please show the details. You can upload a worksheet here using the green up-arrow in the Mapleprimes editor.

Please make sure to explain what kind of plot you want to produce.

@Kitonum I did consider whether to present exact values. I chose on purpose to compute with floating-point values.

I also chose deliberately to show several more steps than necessary.

It's often difficult to gauge what some particular Asker will find more useful and instructive, based only on a few lines of a Question.

 

@raj2018 Please don't repost this in other Question threads.

@dglevitt

This is a link.

@rlopez The simplify command attains the desired result directly in my Maple 2019.{0,1,2},  and Maple 2020.1, without the assumption that rho__m is real.

@Kitonum The expand command does it directly in Maple 2018.2 (and also in Maple 2020.1, as I showed in my Answer).

The evalc command assumes the unknown rho__m is real, but that is not a necessary condition.

@9009134 You could do it by writing your definition for it here, in words.

You need to tell us what you want.

1 2 3 4 5 6 7 Last Page 1 of 442