nm

9713 Reputation

19 Badges

12 years, 60 days

MaplePrimes Activity


These are replies submitted by nm

@Carl Love 

Thanks. I think the rule is more clear to me and shorter than subsindets and selectremove :)

Too bad Maple does not have more powerfull pattern matching than what it does already.  I use patmatch alot to pick certain ode form or pattern. Much easier to do than otherwise. But Maplesoft is busy with other things these days such as making AI apps and such than spending the time to improve its basic pattern matching code.

For me, symbolic computation is 80% pattern matching. After all, it is all about transforming  expressions from one form to another. And there is nothing more powerful than pattern matching for this.

I like your  y::(Not(1) &under denom , have not seen it before. from help it says this mean

               expession y so that denom(y) is not 1

So you are looking for y which must have form A/B where B is not 1, otherwise rule is not applied. This is better.

@mmcdara 

I was never able to look at solutions for any project Euler problems. I can only see the problem description. Such as https://projecteuler.net/problem=906

There is no link to click on to see solutions and code.

I tried few times to register, but never got reply to my email to activate. With Rosseta problems web page, all problems and code are easy to see and view without need to register or login or do anything.

I have no idea what programming contest in Maple means.  What does

            so I think starting with competition questions will be a quick way to improve.

mean? May be you meant site that solves problems using different languages? In this case you can check https://rosettacode.org/wiki/Rosetta_Code  and under each problem given,, there is a list of languages used to solve it. Maple is there on number of these.

"Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different"

To see all problems solved using Maple, here is the page 

https://rosettacode.org/wiki/Category:Maple

Click on any problem listed, it opens new page. On the left are list of all languages used to solve this specific problem. To see Maple solution code, scroll down until you get to the Maple name and click on it. For example, here is one problem using Maple

https://rosettacode.org/wiki/100_doors#Maple

I do not think there is step-by-step student version of Fourier series in Maple. I could not find it googling. But it is easy to write one. see   https://www.mapleprimes.com/questions/226960-How-Do-I-Find-The-Fourier-Constantcoefficients   for examples. You just beed to decide how many terms you want in the series.

You can try one or more of these

infolevel[dsolve]:= 5;  #infolevel[all]:= 5; for everything
trace(dsolve);
printlevel:= 10: #if you make it too high, too much output

change dsovle to other commands you want to trace.

@vv 

FYI, This code has serious bug in it. It flatttens also inside special functions that uses [] internally such as hypergeom, which makes it now invalid.

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

eq1:=x = -a/(3*b-2)*p^2*hypergeom([2/3, (3*b-2)/(3*b-3)],[(6*b-5)/(3*b-3)],-p^3)+p^(-b/(b-1))*_C1:
eq2:=y = b*x*p+a*(p^3+1)^(1/3):
sol:=solve({eq1,eq2},{y,p});

{p = RootOf(-a*_Z^2*hypergeom([2/3, (1/3)*(3*b-2)/(b-1)], [(1/3)*(6*b-5)/(b-1)], -_Z^3)+3*_Z^(-b/(b-1))*_C1*b-2*_Z^(-b/(b-1))*_C1-3*x*b+2*x), y = b*x*RootOf(-a*_Z^2*hypergeom([2/3, (1/3)*(3*b-2)/(b-1)], [(1/3)*(6*b-5)/(b-1)], -_Z^3)+3*_Z^(-b/(b-1))*_C1*b-2*_Z^(-b/(b-1))*_C1-3*x*b+2*x)+a*(RootOf(-a*_Z^2*hypergeom([2/3, (1/3)*(3*b-2)/(b-1)], [(1/3)*(6*b-5)/(b-1)], -_Z^3)+3*_Z^(-b/(b-1))*_C1*b-2*_Z^(-b/(b-1))*_C1-3*x*b+2*x)^3+1)^(1/3)}

sol[1];

p = RootOf(-a*_Z^2*hypergeom([2/3, (1/3)*(3*b-2)/(b-1)], [(1/3)*(6*b-5)/(b-1)], -_Z^3)+3*_Z^(-b/(b-1))*_C1*b-2*_Z^(-b/(b-1))*_C1-3*x*b+2*x)

sol:={subsindets(sol, {set,list}, op)};

{p = RootOf(-a*_Z^2*hypergeom(2/3, (1/3)*(3*b-2)/(b-1), (1/3)*(6*b-5)/(b-1), -_Z^3)+3*_Z^(-b/(b-1))*_C1*b-2*_Z^(-b/(b-1))*_C1-3*x*b+2*x), y = b*x*RootOf(-a*_Z^2*hypergeom(2/3, (1/3)*(3*b-2)/(b-1), (1/3)*(6*b-5)/(b-1), -_Z^3)+3*_Z^(-b/(b-1))*_C1*b-2*_Z^(-b/(b-1))*_C1-3*x*b+2*x)+a*(RootOf(-a*_Z^2*hypergeom(2/3, (1/3)*(3*b-2)/(b-1), (1/3)*(6*b-5)/(b-1), -_Z^3)+3*_Z^(-b/(b-1))*_C1*b-2*_Z^(-b/(b-1))*_C1-3*x*b+2*x)^3+1)^(1/3)}

sol[1];

Error, invalid input: hypergeom expects its 1st argument, l1, to be of type list(algebraic), but received 2/3

 


 

Download bug_in_set_flatten.mw

 

 

 

@ecterrab 

Thanks and to @aroche  from Maplesoft for the quick fix.  No error now:

Download internal_error_PDEtools_NumerDenom_sept_5_2024_FIXED.mw

@ecterrab 

I edited the follow up and made it much shorter. Hopefully it is more clear now. 

This is what I found,. When I run it in command line (cmaple) I do not see the internal error.

It only shows when using worksheet. 

But I found something very bizzar. In worksheet, if I put  :  at end of the ode equation, the error goes away!  

If I replace it with the error comes back.  

In conclusion: To see this error, need to run it in GUI in worksheet and need to have at least the ode or sol get displayed to screen before calling odetest.  If none are displayed, there will be no error.

PS: adding the worksheet showing the tracelast output. internal_error_PDEtools_NumerDenom_sept_4_2024_do_not_hide_output_with_tracelast.mw@ecterrab 

@Carl Love 

Ah, thanks, that makes sense. I can easily add this to my code, since I know what the dependent variable is. This way I do not need to find all other names in the solution or residual. 

@Carl Love 

This is strange, I did try assuming positive. I have code that tries 100 things, and one of them is positive. I thought assuming positive means to assume all identifiers  in the expression are positive. So why would

simplify(residual) assuming positive;

does ot returns zero but

simplify(residual) assuming (n, x, a, b, y(x)) >~ 0

does?

I am doing this in code. So to be able to do the above, I would have now to find all indents in the expression in order to list them like this. 

And I know about coulditbe, that is why I said before I no longer use it to check residual is zero, since it can give false positive on solution of ode being correct as it only needs single value to say yes. 

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1796 and is the same as the version installed in this computer, created 2024, August 29, 14:22 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

ode:=diff(y(x),x) = a*x^(n/(1-n))+b*y(x)^n;

diff(y(x), x) = a*x^(n/(1-n))+b*y(x)^n

maple_sol:=dsolve(ode,y(x),[Chini],useInt,implicit);

Intat(1/(_a^n/(b^(-n-1)*(a*x^(-n/(-1+n)))^(-2*n+1)*(-x^(-n/(-1+n)-1)*a*n*b/(-1+n))^n*n^(-n))-_a+1), _a = -y(x)/((-1+n)*x*a*x^(-n/(-1+n))))-(Int(-1/((-1+n)*x), x))+c__1 = 0

residual:=odetest(maple_sol,ode); #how to show this is zero?

(-y(x)*x^(1/(-1+n))/(a*(-1+n)))^n*n^n*(a*x^(-n/(-1+n)))^(2*n)*b^(n+1)*(-a*b*n*x^(-2*n/(-1+n)+1/(-1+n))/(-1+n))^(-n)-b*y(x)^n

residual:=odetest(maple_sol,ode) assuming positive;

(-1/(-1+n))^(-n)*(-y(x)/(-1+n))^n*b-b*y(x)^n

simplify(residual) assuming positive;

-b*(-(-1/(-1+n))^(-n)*(-y(x)/(-1+n))^n+y(x)^n)

simplify(residual) assuming (n, x, a, b, y(x)) >~ 0

0

 


 

Download challenge_odetest_sept_1_2024_V2.mw

@acer 

Ah, so the command I using was not the right one as I suspected. googling send me to wrong command!

@Thomas Richard 

 but how often does one need to feed a solution that's not coming from dsolve?

Most if not all the time.

What is the point of using odetest to test Maple's own solution? That is almost always correct. 

Students use odetest to test their own hand solution to verify it is correct or not before giving the HW to the teacher.

And odetest could fail if the solution given to it does not use _C1 and _C2. So one has to use these. I've been using these for years with no problem.

I know about arbitraryconstants but do not see how this has anything to do with this. If I use c__1 and c__2, then these are just aliases to _C1 and _C2.  (and I do not like aliases anyway).

May be _Z is special case. But from user point of view, I see nothing wrong with using system level reserved symbols as just symbols as long as they are not assigned any values.

Anyway, I will not use _Z any more, and change it to my own letter for now for the upper limit of the integration. It is not a big deal. I just found it a little strange that one can't even type the letter _Z in the equation they make, that is all.

@Thomas Richard 

But I use for example _C1 and _C2 everywhere in my code.  Are you saying I am not supposed to do that? I use them as symbols. Do not assign any values to them.

If I do not use _C1,_C2 in setting up my own solution, then odetest will not be happy as it expects the constants of integrations to be of this form.

Same fo _Z. I do not assign any values to it, I just use it as symbol in my integration upper limit to match Maple's.

For me a reserved symbol means one can't assign a value to it. But this does not mean one also can't even use it as symbol in the equations they generate? 

@Thomas Richard 

Ok, thanks. But I was looking at help and when I searched combine terms and it says at the top

The combine function applies transformations which combine terms in sums, products, and powers into a single term

Isn't that what I was trying to do? I have sum of two terms.

I would think any user looking to combine terms into one will hit this help page before the normal command, just from the name of the command itself if nothing else.

The help page should really direct the user when to use combine then or when to use normal

Here is my google search for how to combine terms in Maple. Even ChatGPT told me to use the combine command !

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