nm

10049 Reputation

19 Badges

12 years, 112 days

MaplePrimes Activity


These are answers submitted by nm

 

Need to tell is x is not negative

 

simplify(g(f(x))) assuming x>=0

                 x

 

This is a guess. When expression is product, such as a*b internally it is   a^1*b^1  so  when you do subs 1=2 you get a^2*b^2. It replaced the exponents by 2.

same for division. You can see this from

subs(1=2,a*b^9)

           a^2*b^9

And 

dismantle(a*b)

PROD(5)
   NAME(4): a
   INTPOS(2): 1  ------->
   NAME(4): b
   INTPOS(2): 1  ----->

 

Compare to 

dismantle(a*b^9)

PROD(5)
   NAME(4): a
   INTPOS(2): 1   --->
   NAME(4): b
   INTPOS(2): 9   ---->

 

So internally for a  PROD   , each term has hidden exponent of by default unless overriden.

 

For SUM, the same thing. There is a hidden or implied  `1`. You can see this from

dismantle( a + b);

SUM(5)
   NAME(4): a
   INTPOS(2): 1 --->
   NAME(4): b
   INTPOS(2): 1  --->

 

Compare to 

dismantle( a + 9*b);

SUM(5)
   NAME(4): a
   INTPOS(2): 1  ------->
   NAME(4): b
   INTPOS(2): 9  ------->1

 

So when you do 

subs(1=2,a+b)

It is as if  you typed

subs(1=2, 1*a+ 1*b)

And that is why you get 

          2*a + 2*b

It is by design. This is called "infinite scroll"

Google search also introduced this not long ago on its search result. It is terrible feature and Maplesoft seems to copy this. 

Google Infinite Scroll keeps loading new results as you scroll down the page.

Many web sites seem to imitate this now. 

I much prefer the old way. One page at a time, and click next page to see the next page of result.

I could not find a way to turn it off from google search result.

For Maple's page above, you'd have to ask Maplesoft if they can turn off Infinite Scroll as it is part of the page design and they are the ones who add the javascript in the page to control this.

Outside users has no control as far as I can see on how to prevent Infinite Scroll

So what you see as repositions arbitrarily. is actually a side effect of this automatic scrolling. If not done right, it looks like what you describe and I've seen this in many other sites.

It also makes one lose track of what they were looking on the page when this happens.

The web is a big mess and Maplesoft is just following the trend.

Here is another approach

find_element:=proc(e,L::list)
 local idx;
 idx:=ListTools:-Search(e,L);
 if idx=0 then
    RETURN([]);
 elif idx=nops(L) then
      RETURN([L[idx]]);
 else
      RETURN(L[idx+1..-1]);
 fi;
end proc;


is_in_order:=proc(N::list,lis::list)::truefalse;
    local final_result::truefalse:=true;
    local item,r::list:=lis;
    for item in N do 
       r:=find_element(item,r);
       if nops(r)=0 then
          final_result:=false;
          break;
       fi;
   od:
   RETURN(final_result);
end proc:

and now

         is_in_order([7,2,4],[2,6,5,7,3,2,9,4])
                              true

        is_in_order([7,2,4],[2,1,4,2,6,7,3,9])
                            false

        is_in_order([7,2,4],[7,4,2,7,2,4])
                           
true

        is_in_order([7,2,4],[7,7,7,7,2,2,2,7,4])
                           
true

30960

u1 := RootOf(4*_Z^2 + (4*RootOf(60*_Z^3 - 60*_Z^2 + 15*_Z - 1) - 4)*_Z + 4*RootOf(60*_Z^3 - 60*_Z^2 + 15*_Z - 1)^2 - 4*RootOf(60*_Z^3 - 60*_Z^2 + 15*_Z - 1) + 1)

RootOf(4*_Z^2+(4*RootOf(60*_Z^3-60*_Z^2+15*_Z-1)-4)*_Z+4*RootOf(60*_Z^3-60*_Z^2+15*_Z-1)^2-4*RootOf(60*_Z^3-60*_Z^2+15*_Z-1)+1)

DEtools:-remove_RootOf(u1):
result:=[allvalues(%)]:
map(X->simplify(convert(X,trig)),result);

[(2/9)*(cos((1/3)*arctan(3/4))+1)*(3^(1/2)*sin((1/3)*arctan(3/4))-cos((1/3)*arctan(3/4))+2) = 0, -(2/9)*(cos((1/3)*arctan(3/4))+1)*(3^(1/2)*sin((1/3)*arctan(3/4))+cos((1/3)*arctan(3/4))-2) = 0, (1/9)*(2*cos((1/3)*arctan(3/4))-1)^2 = 0]

 

Download A.mw

see Improving-Phaseplot-For-System-Of-Odes for reference. There is no function which gives exactly as StreamPlot in Maple, but DEtools:-DEplot gets close. The difference is that in Mathematica the arrows follow each others along one stream, but in Maple they are disconnected. i.e. where one arrow ends, is not same location where the next arrow starts.

This makes Mathematica's output a little more pleasing to look at than Maple's IMNSHO.

ode=y'[x]==y[x]-x
f[x_,y_]:=y-x
p1=StreamPlot[{1,f[x,y]},{x,-5,6},{y,-4,3},
           Frame->False,Axes->True,AspectRatio->1/GoldenRatio,
           AxesLabel->{"x","y(x)"},BaseStyle->12]

restart;

ode:=diff(y(x),x)=y(x)-x;

DEtools:-DEplot(ode,[y(x)],x=-5..6,y = -4..3,arrows=curve,linecolor=red,
                  color='magnitude[legacy]',scene=[x,y(x)],
                  font=[TIMES,12], labelfont=[TIMES,16],size=[default,0.618034]);

 

One can change arrowsize, to make it look closer to Mathematica. But hard to pick the correct value each time.

restart;
ode:=diff(y(x),x)=y(x)-x;

DEtools:-DEplot(ode,y(x),x=-5..6,y = -4..3,arrows=curve,arrowsize=1.2,linecolor=red,color='magnitude[legacy]',
     scene=[x,y(x)],font=[TIMES,12], labelfont=[TIMES,16],numpoints =1000,size=[default,0.618034] );

may be inttrans:-laplace does not work well with mapping on list. I do not know. Here is a workaround
 

ode_sys:=2*diff(x(t),t$2) + 6*x(t) - 2*y(t) = 0, diff(y(t),t$2) + 2*y(t) - 2*x(t) = 0;
lsol:=map(X->inttrans:-laplace(X,t,s),[ode_sys])

 

I noticed this since 

          lsol:=inttrans:-laplace({ode_sys},t,s)

worked OK but has the problem you mentioned, but 

           lsol:=inttrans:-laplace([ode_sys],t,s)

Gives error

Which for me makes no sense., So I do not think inttrans:-laplace is listable function. In Maple. to be safe, I always use explicit map on things,

I am no expert on this. But basically evalhf  evaluates using hardware floating point. The same if you are using say Fortran or C or C++ and so on. No software emulation is involved. Most modern PC's these days are 64 bit. So you will get  

evalhf(Pi)
3.14159265358979312

This is what you should get in Fortran with double precision. If you use evalf() then software floating point kicks in, my guess is that  Maple uses GNU MPFR 

same as Mathematica.  You can adjust how many decimal points you want when using evalf but not with evalhf.  This is done by changing Digits or passing as argument the value of Digits you want used.

evalf(Pi,16)
3.141592653589793

evalf(Pi,50)
3.1415926535897932384626433832795028841971693993751

You can't get more than 16 decimals with hardware (unless you use quad precision or 128 bit  hardware)

So the bottom line, if you want your numerical calculations in Maple to give same results as say with Fortran or C, use hardware floating point. If you do not care, set Digits very high and you get software emulation which is little slower but result will be more accurate.

I myself always use exact numbers since I only do pure symbolic calculations, so do not do any evalf or evalhf stuff. But if you are doing more numerical calculations, say Finite elements in Maple, this can affect your calculations and which way to do it.

It is having hard time with the max. Try piecewise instead then it works

r:=t->Unit('W'/'m'^2)*piecewise(t/Unit('s')>0,t/Unit('s'),true,0);
plot(r(t),  t = -1*Unit('s') .. 2*Unit('s'),axes=boxed);

Because, according to Maple,  -5*x < -5*y  and -5*(x < y) are not the same:

This is either Maple's own type of math, or a bug. I have no idea.

another possible option is 

            map( X-> myf(op(X)), mylist)

 

f:=x->2*sin(x)+1/(2*x)-1;
evalf(allvalues(solve(f(x)=0,x)))

0.2392293076 + 0.4382263889*I, 0.2392293076 - 0.4382263889*I, -3.744173209, 2.721189630, -5.708231047, 6.764610627

or may be you meant this f

f:=x->2*sin(x)+1/2*x-1;
evalf(allvalues(solve(f(x)=0,x)))

-4.504657440 + 1.095023946*I, -4.504657440 - 1.095023946*I, 3.535612202, 0.4090496716, 5.308993144

The latex generated is not good. Its uses the old latex picture environment. If you switch to Tikz latex, then it fixes the problem.

\documentclass{amsart}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,through,hobby}
\begin{document}

%This code is translation of Maple code but used tikz.
\resizebox{150pt}{150pt}{%
\begin{tikzpicture}
\draw [line width=1cm] plot [smooth] coordinates {(60.78,187.36)(62.00,197.59)(63.22,207.82) };
\draw [line width=1cm] plot [smooth] coordinates {(60.78,187.36)(54.80,168.00)(48.83,148.65) };
\draw [line width=1cm] plot [smooth] coordinates {(60.78,187.36)(73.15,192.54)(85.53,197.72) };
\draw [line width=1cm]  plot [smooth] coordinates {(63.22,207.82)(47.73,191.76)(32.23,175.70)};
\draw  [line width=1cm] plot [smooth] coordinates {(63.22,207.82)(87.29,226.23)(111.36,244.64)};
\draw  [line width=1cm] plot [smooth] coordinates {(32.23,175.70)(35.77,153.14)(39.31,130.58)};
\draw [line width=1cm]  plot [smooth] coordinates {(32.23,175.70)(22.11,179.19)(12.00,182.69)};
\end{tikzpicture}
}

%This code below generated by Maple
\begin{picture}(300,300)
\thicklines
\linethickness{1pt}
\color[rgb]{0.000,0.000,0.000}\qbezier(60.78,187.36)(62.00,197.59)(63.22,207.82)
\color[rgb]{0.000,0.000,0.000}\qbezier(60.78,187.36)(54.80,168.00)(48.83,148.65)
\color[rgb]{0.000,0.000,0.000}\qbezier(60.78,187.36)(73.15,192.54)(85.53,197.72)
\color[rgb]{0.000,0.000,0.000}\qbezier(63.22,207.82)(47.73,191.76)(32.23,175.70)
\color[rgb]{0.000,0.000,0.000}\qbezier(63.22,207.82)(87.29,226.23)(111.36,244.64)
\color[rgb]{0.000,0.000,0.000}\qbezier(32.23,175.70)(35.77,153.14)(39.31,130.58)
\color[rgb]{0.000,0.000,0.000}\qbezier(32.23,175.70)(22.11,179.19)(12.00,182.69)
\end{picture}

\end{document}

Compiling the above using lualatex with TeXLive, here is the difference

 

 

 

You can see that Tikz is much better and lines are smooth.  Attached is the pdf file.

It might be possible to translate picture to tikz automatically, or by using some macros. You can ask at the tex forum for help on this. 

 

soccer.pdf

 


 

``

eq10 := varepsilon*F(-(V(t)*alpha^4*beta^2 - V(t)*alpha^2*beta^4 - S(t)*alpha^4*beta^2 + S(t)*alpha^2*beta^4 + X(t)*beta^4 - Z(t)*alpha^4 + S(t)*alpha^4 - S(t)*beta^4 - X(t)*beta^2 + Z(t)*alpha^2 - S(t)*alpha^2 + S(t)*beta^2)/(alpha^2*(alpha^2 - 1)*(alpha^2 - beta^2)*beta^2*(beta^2 - 1)), (W(t)*alpha^3*beta - W(t)*alpha*beta^3 + Y(t)*beta^3 - U(t)*alpha^3 - Y(t)*beta + U(t)*alpha)/((alpha^2*beta^2 - alpha^2 - beta^2 + 1)*beta*alpha*(alpha^2 - beta^2)), (X(t)*beta^2 - Z(t)*alpha^2 + V(t)*alpha^2 - V(t)*beta^2 - X(t) + Z(t))/((alpha^2 - beta^2)*(beta^2 - 1)*(alpha^2 - 1)), -(Y(t)*alpha*beta^2 - U(t)*alpha^2*beta + W(t)*alpha^2 - W(t)*beta^2 - Y(t)*alpha + beta*U(t))/((alpha^2 - beta^2)*(alpha^2*beta^2 - alpha^2 - beta^2 + 1)), -(X(t)*alpha^2*beta^2 - Z(t)*alpha^2*beta^2 - X(t)*alpha^2 + beta^2*Z(t) + V(t)*alpha^2 - V(t)*beta^2)/((alpha^2 - beta^2)*(beta^2 - 1)*(alpha^2 - 1)), (Y(t)*alpha^3*beta^2 - U(t)*alpha^2*beta^3 - Y(t)*alpha^3 + beta^3*U(t) + W(t)*alpha^2 - W(t)*beta^2)/((alpha^2 - beta^2)*(alpha^2*beta^2 - alpha^2 - beta^2 + 1)), (X(t)*alpha^4*beta^2 - Z(t)*alpha^2*beta^4 - X(t)*alpha^4 + beta^4*Z(t) + V(t)*alpha^2 - V(t)*beta^2)/((alpha^2 - beta^2)*(beta^2 - 1)*(alpha^2 - 1))) - Y(t)*alpha;

varepsilon*F(-(V(t)*alpha^4*beta^2-V(t)*alpha^2*beta^4-S(t)*alpha^4*beta^2+S(t)*alpha^2*beta^4+X(t)*beta^4-Z(t)*alpha^4+S(t)*alpha^4-S(t)*beta^4-X(t)*beta^2+Z(t)*alpha^2-S(t)*alpha^2+S(t)*beta^2)/(alpha^2*(alpha^2-1)*(alpha^2-beta^2)*beta^2*(beta^2-1)), (W(t)*alpha^3*beta-W(t)*alpha*beta^3+Y(t)*beta^3-U(t)*alpha^3-Y(t)*beta+U(t)*alpha)/((alpha^2*beta^2-alpha^2-beta^2+1)*beta*alpha*(alpha^2-beta^2)), (X(t)*beta^2-Z(t)*alpha^2+V(t)*alpha^2-V(t)*beta^2-X(t)+Z(t))/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)), -(Y(t)*alpha*beta^2-U(t)*alpha^2*beta+W(t)*alpha^2-W(t)*beta^2-Y(t)*alpha+beta*U(t))/((alpha^2-beta^2)*(alpha^2*beta^2-alpha^2-beta^2+1)), -(X(t)*alpha^2*beta^2-Z(t)*alpha^2*beta^2-X(t)*alpha^2+beta^2*Z(t)+V(t)*alpha^2-V(t)*beta^2)/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)), (Y(t)*alpha^3*beta^2-U(t)*alpha^2*beta^3-Y(t)*alpha^3+beta^3*U(t)+W(t)*alpha^2-W(t)*beta^2)/((alpha^2-beta^2)*(alpha^2*beta^2-alpha^2-beta^2+1)), (X(t)*alpha^4*beta^2-Z(t)*alpha^2*beta^4-X(t)*alpha^4+beta^4*Z(t)+V(t)*alpha^2-V(t)*beta^2)/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)))-Y(t)*alpha

Typesetting:-Unsuppress('all');
Typesetting:-Suppress([V(t),S(t),W(t),X(t),Y(t),U(t),Z(t)]);     
eq10;

varepsilon*F(-(V(t)*alpha^4*beta^2-V(t)*alpha^2*beta^4-S(t)*alpha^4*beta^2+S(t)*alpha^2*beta^4+X(t)*beta^4-Z(t)*alpha^4+S(t)*alpha^4-S(t)*beta^4-X(t)*beta^2+Z(t)*alpha^2-S(t)*alpha^2+S(t)*beta^2)/(alpha^2*(alpha^2-1)*(alpha^2-beta^2)*beta^2*(beta^2-1)), (W(t)*alpha^3*beta-W(t)*alpha*beta^3+Y(t)*beta^3-U(t)*alpha^3-Y(t)*beta+U(t)*alpha)/((alpha^2*beta^2-alpha^2-beta^2+1)*beta*alpha*(alpha^2-beta^2)), (X(t)*beta^2-Z(t)*alpha^2+V(t)*alpha^2-V(t)*beta^2-X(t)+Z(t))/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)), -(Y(t)*alpha*beta^2-U(t)*alpha^2*beta+W(t)*alpha^2-W(t)*beta^2-Y(t)*alpha+beta*U(t))/((alpha^2-beta^2)*(alpha^2*beta^2-alpha^2-beta^2+1)), -(X(t)*alpha^2*beta^2-Z(t)*alpha^2*beta^2-X(t)*alpha^2+beta^2*Z(t)+V(t)*alpha^2-V(t)*beta^2)/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)), (Y(t)*alpha^3*beta^2-U(t)*alpha^2*beta^3-Y(t)*alpha^3+beta^3*U(t)+W(t)*alpha^2-W(t)*beta^2)/((alpha^2-beta^2)*(alpha^2*beta^2-alpha^2-beta^2+1)), (X(t)*alpha^4*beta^2-Z(t)*alpha^2*beta^4-X(t)*alpha^4+beta^4*Z(t)+V(t)*alpha^2-V(t)*beta^2)/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)))-Y(t)*alpha

Typesetting:-Unsuppress('all');
eq10;

varepsilon*F(-(V(t)*alpha^4*beta^2-V(t)*alpha^2*beta^4-S(t)*alpha^4*beta^2+S(t)*alpha^2*beta^4+X(t)*beta^4-Z(t)*alpha^4+S(t)*alpha^4-S(t)*beta^4-X(t)*beta^2+Z(t)*alpha^2-S(t)*alpha^2+S(t)*beta^2)/(alpha^2*(alpha^2-1)*(alpha^2-beta^2)*beta^2*(beta^2-1)), (W(t)*alpha^3*beta-W(t)*alpha*beta^3+Y(t)*beta^3-U(t)*alpha^3-Y(t)*beta+U(t)*alpha)/((alpha^2*beta^2-alpha^2-beta^2+1)*beta*alpha*(alpha^2-beta^2)), (X(t)*beta^2-Z(t)*alpha^2+V(t)*alpha^2-V(t)*beta^2-X(t)+Z(t))/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)), -(Y(t)*alpha*beta^2-U(t)*alpha^2*beta+W(t)*alpha^2-W(t)*beta^2-Y(t)*alpha+beta*U(t))/((alpha^2-beta^2)*(alpha^2*beta^2-alpha^2-beta^2+1)), -(X(t)*alpha^2*beta^2-Z(t)*alpha^2*beta^2-X(t)*alpha^2+beta^2*Z(t)+V(t)*alpha^2-V(t)*beta^2)/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)), (Y(t)*alpha^3*beta^2-U(t)*alpha^2*beta^3-Y(t)*alpha^3+beta^3*U(t)+W(t)*alpha^2-W(t)*beta^2)/((alpha^2-beta^2)*(alpha^2*beta^2-alpha^2-beta^2+1)), (X(t)*alpha^4*beta^2-Z(t)*alpha^2*beta^4-X(t)*alpha^4+beta^4*Z(t)+V(t)*alpha^2-V(t)*beta^2)/((alpha^2-beta^2)*(beta^2-1)*(alpha^2-1)))-Y(t)*alpha

 


 

Download suppress.mw

It seems due to build-in immediate simplifications. 

a<=b and b>=a are immediately simplified to same thing and placed in same memory location before it reaches the set command.

addressof(a<=b)
                      36893490551756576564

addressof(b>=a)
                      36893490551756576564

But this is not the case for a=b and b=a. These remain internally as different objects in different memory locations

addressof(a=b)
                      36893490551757501180

addressof(b=a)
                      36893490551757501204

Also set does not do simplification either.

{a=b,2*a=2*b}

gives {a = b, 2*a = 2*b}  and not {a=b} 

2 3 4 5 6 7 8 Last Page 4 of 17