19132 Reputation

29 Badges

14 years, 288 days

Social Networks and Content at

MaplePrimes Activity

These are replies submitted by acer

@mary120 In your Maple 11 the elementwise operation denoted by rhs~ would not work. You could try changing part of Tom's code to map the rhs command, instead.

In particular, this piece,

res:= Matrix( [ [ x, U1(x)],
                  seq( map(rhs,sol(j)[1..2]), j=0..20)

See revised attachment,

@tomleslie The Question was tagged as Maple 11 prior to your asking about it.

@Pemudahijrah01 You can follow the instruction in my Answer, to obtain an explicit solution. It will be huge.

If might be smaller if there were some conditions on the unknown parameters. Could you provide any?

What do you intend on doing with the solution?

@tomleslie As is indicated at the top of this thread, the OP is running Maple 11.

@NeillSmith That is why I asked (a few times) whether it would be adequate if only the D form were to be prettyprinted as you asked.

You can use the green up-arrow in the Mapleprimes editor to upload and attach files, and to inline .mw worksheets here.




convert( eval(diff(f(x),x), x=3), D )


eval(convert( Eval(diff(f(x),x), x=3), D ));


eqn := f(x)^2 = (diff(f(x),x) + 7)^2 + diff(f(x),x,x)/15;

f(x)^2 = (diff(f(x), x)+7)^2+(1/15)*(diff(diff(f(x), x), x))

convert( eval(eqn, x=3), D );

f(3)^2 = ((D(f))(3)+7)^2+(1/15)*((D@@2)(f))(3)

eval(convert( Eval(eqn, x=3), D ));

f(3)^2 = ((D(f))(3)+7)^2+(1/15)*((D@@2)(f))(3)



I realize that you also want f(x) to display as is. That's a concession, when using Suppress(f(x)) . I have a way to get both the D(f)(3) form as well as f(x) to print as you want, while not suppressing the argument in the printing of f(x), but it involves a (re)implementation of `print/D` which maybe too dodgy.

@Al86 Use the plots:-display command to put multiple plots together.

You can simply put three plot calls inside that, each with its own values for A,B,C. (There are other ways, but that way you don't have the burden of understanding and remembering even more syntax.)

Are you going to clarify your earlier syntax, to let me know whether I got its meaning close to right? There's also the matter of scale, units, and accuracy.

@rlopez Yes, that's why I was asking whether the OP would be OK with just the D form working. It wasn't clear to me whether he really needed eval(diff(f(x),x),x=0) or its inert Eval form to also work, since both appeared in his worksheet.

But I suspect that you intended,
instead of,
[edit] Those both prettyprint the same, in the form that was requested. But only the first of them makes proper sense in the context of the Question.

@DarkMath The solve command is a little quirky with regard to assumptions.


  assuming -3/2*Pi<=x, x<=3/2*Pi;

                {x = -Pi}, {x = 0}, {x = Pi}

  assuming -5/2*Pi<=x, x<=5/2*Pi;

     {x = -2 Pi}, {x = -Pi}, {x = 0}, {x = Pi}, {x = 2 Pi}

Personally, I think that I'd first try using the restrictions as extra conditions in the first argument, over using them as assumptions.

It looks like you didn't notice the link from the solve Help page to the solve,details Help page. That has more information about some of those options. There is an example lower down that page which uses the explicit,allsolutions options on a trig expression and a domain restricted by two simple inequalities.

[edit] The functionality of the trig-solver was improved somewhat a few years ago, after which that option pair combination became more useful for such cases constrained by inequalities, and the example added to the Help page.) Prior to that the strongest univariate exact trig solver over a specified finite range was probably Student:-Calculus1:-Roots leveraging the internal `minimize/solve`, and which is still pretty good.

Now it gets trickier to explain. The real option is only documented as being relevant for parametric solving (of polynomial systems). But a few releases ago it started (sometimes) having an effect on other classes of problem. Sometimes it helps, and (much more rarely) it hinders. I try with and without, when pressed. I have previously submitted a bug report about lack of documentation on it. I believe that your sin(x) example works both with and without it. That is,


                {x = -Pi}, {x = 0}, {x = Pi}

  assuming x>=-3*Pi/2,x<=3*Pi/2;

                {x = -Pi}, {x = 0}, {x = Pi}

@NeillSmith I am asking whether it would be adequate or helpful if you could get (only) the D form to look like you want.

Would it serve if it was just for D form? 

For example, D(f)(x) and D(f)(3) rather than diff(f(x),x) and eval(diff(f(x),x),x=3) ?

How much direct manipulation do you need to do, where you might not conveniently be able to utilize convert(...,D) when needing to display?

In one of your Replies below you wrote, "How can I extract the numerical data of (x,U1) to use it in another software such as Origin?"

Does that simply mean that you want to export the numeric data that could be plotted (independent x values and corresponding dependent U1 values)?

Or do you want to be able to code-generate the piecewise polynomial interpolants that the numeric solver may have computed (in a a target language such as C, etc)? That would allow you to generate arbitrary [x,U1(x)] pairs of values, externally, or adaptively plot externally, etc.

@dharr I'll note that solve has been historically quirky wrt trig solving under bounds. For this example, Maple 2020 can do better but note 1) the calling sequence has to be of a particular kind, and 2) some aspect of that calling sequence are undocumented.


                   {x = -Pi}, {x = 0}, {x = Pi}

That functionality is leveraged in few places in the Library.

@emendes You've now described a scenario in which the entries are irrelevant to the job. It is very strange that the code you posted utilizes (and searches upon) the values of the entries. That is one of the primary causes of its slowness.

Does the command ListTools:-Slice in Maple 2020 provide anything like the functionality you want? (I'm not saying that its performance is optimal. i am curious about a functionality match.)

If you want to split according to number of entries (in the chunks) then why does ListTools:-LengthSplit not serve? if you want to split according to the number of chunks then why does ListTools:-Slice not serve? If neither of those provides the performance you require then, still, why omit that fact?

ps. It is unhelpful to not mention what kind of list size you have in mind, and target performance you desire.

What do you mean by "chunks of a certain size"?  Does that mean that the values of the entries come into it? (If not, then why examine them? If so, then how?)

Your code contains at least one instance of the misspelling nchunck and as posted doesn't work.

Upload and attach your document using the green up-arrow in the Mapleprimes editor.

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