nm

5646 Reputation

17 Badges

8 years, 277 days

MaplePrimes Activity


These are questions asked by nm

sometimes I have a need to do an assignment inside  operator call `if`(......) . but it is not possible it seems to do this in Maple.

This happens when I am using `if`(...) inside cat() to build a long string, and  depending on some condition, different string is build.  

This works fine in general, until I need to assign new value to a variable at the same time as I am building the string.

An example will make it more clear. Instead of the following

str:="A";
x:=10;

str:=cat(str,`if`(x=10," it was 10","it was not 10"));

if x=10 then
   x:=11;
else
   x:=9;
fi;                         

I'd like to do something like this (which does not work in Maple)

str:="A";
x:=10;
str:=cat(str,`if`(x=10,  x:=11;" it was 10" , x:=9; "it was not 10"))

Tried assign() also. Does not work.  I tried different variation on the above, none works. 

In Mathematica, the above is possible. But this is using standard `If`, which can be inlined

Is it possible to do something like this in Maple? 

The reason is that I do not have to do the checking twice: once to build the string, and once after that is done, in order to do the assignment. It is better if both are done in one place. The above is just an example. I could have more than one `if` inside as I am building the long string. 

Btw, how does one look up help on the operator if and not the statement if ? the help page for if does not talk about it or give any examples.

Maple 2020.2

command completion (when hitting the ESC key) in Maple could be made more useful. It does not seem to support type names for example.

What shows up on the command completion window are  possible commands that start with that partial text.

It does not list other known names by Maple, such as type names and other options.

This makes it hard to use in many places, where one have to remember type names exactly instead of the system helping them by listing all possible type names that start with that string.

Is there a way around this? Will Maple next version support smarter and more complete command completion menu?

 

 

This integral 

for n integer and n>=0

Maple finds it if I tell it this in the assumptions.  But if I remove the assumption that n>=0 and just keep the assumption that n is integer, it hangs. (at least I waited 5 minutes and gave up).

Is this something to be expected?  If I try the same thing in Mathematica, i.e. telling it n is an integer, but not that it is n>=0, it returns result  immediately, with condition that the result is valid for n>=0.

restart;
int(x^n*exp(-x),x=0..infinity) assuming n::integer

seems to hang.

In Mathematica:

My question is  if this behaviour of int hanging is to be expected, since it was not told than n>=0? Should it have returned result of n!  like Mathematica, with the assumption given in the result as well?

Since for n<0 the integral does not converge, and maple knows this

restart;
int(x^(-2)*exp(-x),x=0..infinity)

            infinity

May be this is just a design issue in int and it was stuck trying to evaluate the integral for negative integers, and could not determine if it converges or not?

Any thoughts?

Maple 2020.2

Is there a workaround for this?

restart;
int(sqrt(x)*sin(sqrt(3)*ln(x)/2),x)

The answer according to Mathematica is

Maple 2020.2 on windows 10

 

Why this fails in solve in Maple 2020.2?

restart;

A:=-ln(u)/2 + ln(3*u - 2)/6;
B:=_C1 + ln(x);
sol := solve(A-B= 0,u) assuming real

No error if I try the above code in Maple 2019.2.

Also, the error goes away if I replace assuming real  with assuming x::real

restart;

A:=-ln(u)/2 + ln(3*u - 2)/6;
B:=_C1 + ln(x);
sol := solve(A-B= 0,u) assuming x::real

Is this a bug in solve?

Maple 2020.2 on windows 10.

 

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