nm

11413 Reputation

20 Badges

13 years, 71 days

MaplePrimes Activity


These are replies submitted by nm

@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

 

 

 

@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. 

First 12 13 14 15 16 17 18 Last Page 14 of 91