nm

4680 Reputation

17 Badges

8 years, 131 days

MaplePrimes Activity


These are questions asked by nm

What is the logic behind this. 

restart;
expr:=int(f(x),x);
lprint(algsubs(int=Int,expr));
lprint(subs(int=Int,expr));

gives


   int(f(x),x)

   Int(f(x),x)

So algsubs failed to replace int by Int

Looked at help. and see nothing. But I might have overlooked something. It says

It is a generalization of the subs command, which only handles syntactic substitution.

Generalization? If so, I expected it to work here. But may be there is a subtle reason why it did not? May be with algsubs, the replacement has to be algebraic expression and "int" is not, it is just a name.

Maple 2020.2
 

Hello Maple experts.

According to our teacher class notes, the ODE   y'=2*sqrt(y) with IC  y(0)=0 has 2 solutions. y(0)=0 and sqrt(y)=x

I am not able to get Maple to give the second solution,. It only gives y(0)=0.

Is there an option I am overlooking to make it give the other solution sqrt(y)=x ?

ode := diff(y(x),x) = 2*sqrt(y(x));
ic:=y(0)=0;
sol:=dsolve([ode,ic],y(x));

One can see the other solution by doing this

ode := diff(y(x),x) = 2*sqrt(y(x));
ic:=y(0)=A;
sol:=dsolve([ode,ic],y(x));
subs(A=0,sol)

I tried this in Mathematica. Mathematica does not give y=0 but it gives the second solution

I tried the singsol=all also, but it had no effect. Maple only shows the y(0)=0 solution.

Any suggestions?

Maple 2020.2

 

inside a local proc, when calling a  function such as map using the syntax map(x->x^2, target) does one need to declare as local inside the proc?

Same for other Maple calls, which uses something similar. For example 

subsindets(expr,'specfunc( anything, csgn )', f->simplify(f));

does one need to declare local to the proc where the above call is made?

Which one of these two example is more correct?

restart;
foo:=proc(expr)
  local x;
  map(x->x^2,expr);
end proc;

foo([x,y])

vs.

restart;
foo:=proc(expr)
    map(x->x^2,expr);
end proc;
foo([x,y])

In Mathematica for example, such symbols used by similar functions of the system (for example, Plot command, and others) are automatically localized to the system call itself avoiding any conflict with user own symbols.

I am not sure how Maple handles this. Should one always declare these symbols?

Maple 2020.2

 

 

I have an expression with number of csgn(arg) in it.

I'd like to scan this expression, telling Maple to assume arg is positive, in order to replace csgn(arg) by 1.

I am trying to do this using subsindets. But I do not know why it is not working. I am doing this in code, without looking at the expression. So I do not know what the arg's are and how many such cases could be.

Here is an example

expr:=(1+csgn(a)*a)/(3*csgn(b)*b);

To get to each csgn(arg), I am using the type 'specfunc( anything, csgn )'. I checked this is correct type by doing

type(csgn(a),'specfunc( anything, csgn )');

           true

Then

subsindets(expr,'specfunc( anything, csgn )', f->simplify(f) assuming positive);

But this does not change anything. 

I also tried

subsindets(expr,'specfunc( anything, csgn )',f->simplify(f) assuming op(1,f)::positive);

No change, But if I do 

simplify(csgn(a)) assuming positive;

it works. And Maple returns 1. Also this works

simplify(expr) assuming a>0,b>0;

But since I am do not before hand what the arguments to csgn() in the expression are, I can't do the above. I do not know even if expression has csgn() in it even. I am trying to simplify a result I obtain inside the program by doing the above.

What is wrong with my use of  subsindets above?

I think the problem is with using assumptions inside subsindents. As this below works

subsindets(expr,'specfunc( anything, csgn )',f->1);

So the call to subsidents was OK, it is just that the assumptions do not seem to be somehow effective inside.  May be name scoping issue?

Maple 2020.2

edit:

For now and as workaround, I am doing this

restart;
expr:=(1+csgn(a)*a)/(3*csgn(b)*b):
fun:=selectfun(expr,'csgn'); #find csgn if any

if numelems(fun)>0 then
    the_args:= op~(1,fun);
    simplify(expr) assuming map(x->x::positive,the_args)[];
fi;

 

I am still checking output using latest Latex and Maple 2020.2. I noticed a small problem.

Current Latex uses \mathrm{ln} instead of as before, which is just \ln this casues the space before the operator now to be lost, cause hard to read math.

It is better not to use \mathrm on ln

Here is an example

restart;
Latex:-Settings(UseImaginaryUnit=i,
      UseColor = false,
      powersoftrigonometricfunctions= computernotation,
      leavespaceafterfunctionname = true
):
expr:= 4*exp(3*x)+3*ln(x);
Latex(expr)

                       4 {\mathrm e}^{3 x}+3 \mathrm{ln}\left(x \right)

It should be

4 {\mathrm e}^{3 x}+3 \ln\left(x \right)

Without even \, between the letter before \ln as old latex() did:

latex(expr)

           4\,{{\rm e}^{3\,x}}+3\,\ln  \left( x \right)

As the Latex engine itself takes care of the spacing around math operators best.

Here is the difference when the Latex is compiled. The use of mathrm with exponential is not an issue, since it is one letter operator, but not with ln.

\documentclass[12pt]{book}
\usepackage{amsmath}
\usepackage{mleftright} 
\mleftright

\begin{document}
This is how it is now
\[
4 {\mathrm e}^{3 x}+3 \mathrm{ln}\left(x \right)
\]
                      
This is what it is better to be
\[
4 {\mathrm e}^{3 x}+3 \ln\left(x \right)
\]                                         
\end{document}

Compiled with lualatex compiler gives

The above shows the space problem.

Using Maple 2020.2 and Physics   879

 

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