nm

11538 Reputation

20 Badges

13 years, 115 days

MaplePrimes Activity


These are replies submitted by nm

@janhardo 

The second argument in 

subsindets(expr, exp, f -> ln(f));

has to be a maple type. But exp is not name of type. This makes it work

 subsindets(expr, 'specfunc'(exp), f -> ln(f));

As to why your second example

subsindets(expr, exp(anything), f -> ln(f));

worked. I am not sure. My guess is has to do with the fact that  exp(anything) has type function, but exp on its own (which you used in the first example has type procedure.

Either way, I always use 'specfunc'(name_of_function)  or 'specfunc'(anything,name_of_function)  and not the raw name of the function as you did. Reference: structured types in Maple.

@Axel Vogt 

What do I need to try it with no Physics? Is just changing the libname and removing the Physics from the path is enough? or do I need to do something more?

Btw, are you also on windows? it is possible it might not hang on mac or Linux. I only have Maple on widnows 10. Also, did you try increasing the timelimit to longer values? say 60 or 100 seconds? as it depends on the speed of the CPU also.

btw, I just removed Physics from libname, and it still hangs just the same. Unless you mean by no Physics something other than just doing this.

fyi, V 2024.1 gives what you show as expected result.

interface(version);

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

restart;

J2 := Int(sin(p*x), x);

Int(sin(p*x), x)

K2 :=eval(J2, Int = ((a, b) -> Int(mtaylor(a, x=0, 5), b)));

Int(p*x-(1/6)*p^3*x^3, x)

 

 

Download int_sept_21_2024.mw

Your code makes no sense to me. Why are you substituting x into the ode? There is no x at all anywhere. The independent variable is y and not x.  Also what does this BC mean?

D(psi)(-1 - x^2/2) = 1,

?  What is x here?

You are doing numerical dsolve. So you need numerical value for x at least.

You are also specifying BC at too many points. Maple can only solved two point boundary value problem, not 3 or 4. So you need to fix your BC/IC also.

 

@Laurenso 

How can I change all \frac into \dfrac?

Just add this line at the very end after s was calculated

s:=StringTools:-SubstituteAll(s,"\\frac","\\dfrac"):

The result will be

\begin{enumerate}[label=\arabic*)]
\item $\sqrt{-5 x^{2}-5 x -1} = -4 x -1 $\hfill Answer: $\left\{-{\dfrac{2}{7}}, -{\dfrac{1}{3}}\right\}$
\item $\sqrt{-5 x^{2}-5 x -1} = x +1 $\hfill Answer: $\left\{-{\dfrac{2}{3}}, -{\dfrac{1}{2}}\right\}$
\item $\sqrt{-5 x^{2}-5 x -1} = 4 x +3 $\hfill Answer: $\left\{-{\dfrac{5}{7}}, -{\dfrac{2}{3}}\right\}$
\item $\sqrt{-5 x^{2}-5 x +4} = -5 x +3 $\hfill Answer: $\left\{{\dfrac{1}{2}}, {\dfrac{1}{3}}\right\}$
\item $\sqrt{-5 x^{2}-4 x +2} = -5 x +2 $\hfill Answer: $\left\{{\dfrac{1}{3}}, {\dfrac{1}{5}}\right\}$
\item $\sqrt{-5 x^{2}-4 x +2} = -2 x +1 $\hfill Answer: $\left\{-{\dfrac{1}{3}}, {\dfrac{1}{3}}\right\}$
\end{enumerate}

 

@Carl Love 

It is like this:

RootOf(9*x1-5+RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808), x1, 171590466306199/562949953421312 .. 343180932612401/1125899906842624);

Error, (in property/ProbablyNonZero) cannot determine if this expression is true or false: ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6

RootOf(9*x1-5+RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808), x1, 171590466306199/562949953421312 .. 343180932612401/1125899906842624);

5/9-(1/9)*RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808)

restart;

RootOf(9*x1-5+RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808), x1, 171590466306199/562949953421312 .. 343180932612401/1125899906842624);

Error, (in property/ProbablyNonZero) cannot determine if this expression is true or false: ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6

RootOf(9*x1-5+RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808), x1, 171590466306199/562949953421312 .. 343180932612401/1125899906842624);

5/9-(1/9)*RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808)

restart;

RootOf(9*x1-5+RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808), x1, 171590466306199/562949953421312 .. 343180932612401/1125899906842624);

Error, (in property/ProbablyNonZero) cannot determine if this expression is true or false: ln(.1e11*abs(-.304805898398896+1.*RealRange(.304805898398895,.304805898398897)))/ln(10) < -6

RootOf(9*x1-5+RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808), x1, 171590466306199/562949953421312 .. 343180932612401/1125899906842624);

5/9-(1/9)*RootOf(8*_Z^2+_Z-43, 41629632769253767815/18446744073709551616 .. 20814816384626883921/9223372036854775808)

 

 

Download twice_rootof.mw

@Rouben Rostamian  

Thanks. good point. I overlooked this reformating of the ode. Now it makes sense.

@segfault 

Do you know how to get rid of the superfluos brackets { }  as in one of your solutions ?

Here is a version which does that. There might be better ways

interface(version);

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

ode:=diff(y(x),x)-y(x)*a-b*y(x)^2=f(x);
sol:=dsolve(ode);

diff(y(x), x)-y(x)*a-b*y(x)^2 = f(x)

my_sol := DESol( ode, y(x) );

DESol({diff(y(x), x)-y(x)*a-b*y(x)^2-f(x)}, {y(x)})

#to extract just first argument of DESol
r:=evalindets(my_sol,'specfunc'(anything,DESol),F->op(1,F));
map(X->op(X),[r])[]

{diff(y(x), x)-y(x)*a-b*y(x)^2-f(x)}

diff(y(x), x)-y(x)*a-b*y(x)^2-f(x)

#to extract all arguments
r:=evalindets(my_sol,'specfunc'(anything,DESol),F->op(1..,F));
map(X->op(X),[r])[]

{diff(y(x), x)-y(x)*a-b*y(x)^2-f(x)}, {y(x)}

diff(y(x), x)-y(x)*a-b*y(x)^2-f(x), y(x)

 


 

Download pick_DESol_argument_V2.mw

 

@C_R 

Do other software packages provide a separate test or is this a speciality of Maple?

Sympy has this function here

sympy.solvers.ode.checkodesol(ode, sol, func=None, order='auto', solve_for_func=True)[source]

"Substitutes sol into ode and checks that the result is 0"

Mathematica does not have dedicated command like odetest, But instructions how to verify ode  solution are given here

"The easiest method involves substituting the solution back into the equation. If the result is True, the solution is valid."

Examples are given above, Basically it is like algsubs in Maple, where one substitutes the solution into the ode. It will also automatically evaluates all derivates in the ode.

If the result is True, then solution is correct. So True is like zero in Maple.

One might have to use Simplify or FullSimplify to get True.

Mathematica only returns explicit solutions from its DSolve. There is no option to get implicit solution. So this method works only when solution is explicit. If you solved the ode yourself and obtained implicit solution, then you have to first solve for y(x) explicitly, and then plugin in the solution into the ode as shown in the above page. 

 

@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

 

 

 

First 11 12 13 14 15 16 17 Last Page 13 of 90