nm

11353 Reputation

20 Badges

13 years, 16 days

MaplePrimes Activity


These are questions asked by nm

 

Given an expression such as (x^2+1)*y^3*exp(-x-y), how to "factor" it to product of the two functions, one in x only and the other in y only. These products in this example are

                  exp(-x)*(1+x^2)

and

                 exp(-y)*y^3

For reference, this was also asked at Mathematica site here

addition:

Is it possible to obtain these separated products in a list or a set to make them easier to get hold of after the call? something like

   myFactor(  (x^2+1)*y^3*exp(-x-y) , {x , y} )

will return

    { exp(-x)*(1+x^2) , exp(-y)*y^3 }

This is current test cases

funcs:=[
   arcsin(x)/(sqrt(1-x^2)*y^2),
   x*y,
   x^2+x^2*y,
   2*x+1,
   cos(2*x),
   y,
   (x-1)/y,
   ln(1+y^2),
   1-x+y^2-x*y^2,
   x^2+x^3*y,
   1/(x+y),
   (1+sqrt(x))/(1+sqrt(y)),
   (1-x^2+y^2-x^2*y^2)/x^2,
   2*x*y^2+3*x^2*y^2,
   3*exp(2*x)+2*y,
   (5*sqrt(x)-y)/x,
   2*x*y+3*x^2*exp(x^2),
   sqrt(1+x+y^2),
   1,
   1+x*y,
   -y+4*x^3*y,
   exp(x^2)+2*x*y,
   -(y-exp(x))/(x-2),
   arcsin(x)/((1-x^2)*y^2),
   -(y-exp(x))/(x-2),
   -y+4*x^3*y,
   (x^2*y+y)*y^3*exp(-x-y+1)*3^(-x-y)*sqrt(x^2*y-y),
    sqrt(1-y^2)/x,
    sqrt(1-y^2)/(2*sqrt(x)),
    sqrt(1-y^2)
];

This functions checks if expression is product separable or not

is_separable:=proc(f,x,y)
  #checks if f(x,y) is separable to X(x)*Y(y) or not
  #but do not do the separation. The separation is done by
  #another function I have

  if diff(simplify(diff( simplify(ln(f)),x)),y) = 0 then
     return(true);
  else
     return(false);
  fi;
end proc:

it used as

for z in funcs do
   is_separable(z,x,y);
od;

 

I just found that Maple 17 and Maple 16 do not have the option "output=string" in the latex command.

And I need a way to convert the Latex generated to the screen to a string and save it to a variable like I can do with Maple 2017

Here is an example. In current Maple 2017 this works

result_of_int:=int((-5+3*x)^2/(2*x-1)^(7/2),x):
my_latex:= latex(result_of_int,output=string);

But in Maple 16, it gives an error

If I remove the output, then the result is not string.

How to capture the above output which is on the screen and save it as string in a variable?

I do not want to send the output to a file as is. I need to first convert it to a string, and save
it to variable first.

 

 

Would someone be able to explain this strange output?

restart;
sol:=int(1/(x*sin(x)),x);
algsubs(x=t,sol);

How did Maple manage to obtain this? I tried tracing but it did not help me figure it out.  If it is of any help:

int(1/sin(x),x);

It seems algsubs got confused somewhere?

 

 

Maple 2017.2, windows.

 

 

Does Maple have build-in function, which when given an expression that depends on x and y, will separate it to a product of two functions, one that depedns on x only and the other that depends on y only?

The input mathematical expression is known to be seperable.

For example, If the input is

((3*y + y^2)*3*x)/(x + sin(x))

Then I'd the Maple function to take the above and return list or set of two parts  {(3*y + y^2)   ,     3*x/(x + sin(x) } (if it can't separate it, it can return null).

The API can be something as  

 f,g = find_product_functions(expression,[x,y])

Something like this is used on determining for example if RHS of first order ODE is separable in order to solve it more easily.  collect() does not really work for this. So Maple allready does this internally in its ODE solver when it checks if ODE is separable or not. But is the function available for users?

 

 

One of the things I like in Maple is that I can return a local symbol from a proc() in some expression and it will not "conflict" with same symbol in the global space and will show the same.

I just do not know how Maple manages to do this.

For example:

foo:=proc(n)
   local x;
   x^n;
end proc;

And now if I do

x:=99;
foo(3);

Will return  x^3. This is even thought I had defined x:=99; before the call.

So there is one global `x` with value 99 and the `x` in the expression returned `x^3` did not get confused with the global `x`. Yet they look the same.

How does Maple manages to do this? In Mathematica, it always return local symbols with $nnn assigned to them to distinguish them from global symbols. (attaches the Module ID). For example, in Mathematica the same example above gives

Notice that the `x` returned from a proc() look different from inside the Module. It is not the same as the x in the global space.

Maple seems to be able to do the same thing, but using the same looking symbol. So it must be keeping track of things internally? It must know that the x in x^3 is not the same x in the x:=99 ofcourse.

Any idea how Maple does this?

 

First 164 165 166 167 168 169 170 Last Page 166 of 199