nm

11353 Reputation

20 Badges

13 years, 8 days

MaplePrimes Activity


These are answers submitted by nm

export to eps then convert to pdf or png as needed.  use the noborder option for the plotsetup.

This is the pdf output

restart;
currentdir("...");
p:=plot(x^2, x = 0 .. 3, background = "Blue", axes = none);
plotsetup(default);
plotsetup(ps, plotoutput="my_image",plotoptions=`color,noborder`);
print(p);
plotsetup(default);

to see the division by zero, do this

P:=convert(P,rational)
solnum :=subs(P, M);

Humm, You can not use diff(u(x, 0), t)  as is for IC. This is same for ordinary differential equation as well as partial differential equation.

You have to use the D operator. For an ode we write  D(y)(0)=0  to give initial condition y'(0)=0. not diff(y(0),x)=0

I do not know what u__t(x, 0) is supposed to mean. Is this 2D math for document mode? I do not use 2D math for input.

I found this cheat sheet on the net so I copy it here

Just remember, if you have symbolic ic, as in   y(a)=c and if you type  D(y)(a)=c, it will fail, unless you tell Maple that the dependent variable is y(x). As in 

           dsolve([ode,D(y)(a)=b],y(x))  #must add y(x) here

If IC is numeric, as in y'(0)=b then you do not need to add y(x), so this works

           dsolve([ode,D(y)(0)=b])  #no need to add y(x) here, but it will not hurt if added

Same for pde. 

But If you really want to use diff, which I do not recommend, and better stick to D, then you can use this syntax instead. 

IC := u(x, 0) = f,  eval(diff(u(x,t),t),t=0)=g;

there is no factoral, changed it to factorial. Changed your sum limit from infinity to 10. Changed plot to start from 0.01 as negative values gives undefined for H().

Try this

Download plot_problem_march_13_2025.mw

(Maple prime will not let me insert content of worksheet). Here is plain text

restart;
h:=(u)->sin(0.3*u^2):
K:=(r,v,u)-> (factorial(2*r+3)*v^r*u^(r+2))/(factorial(r)*factorial(r+2)*(v+u)^(2*r+4)):   
w:=(r,j,a,u)->(u^j-1)/((1+u)^(r+j-1))*((a*u/(1+u))*binomial(r+j-1,j)-(1-a)*(1+u)*binomial(r+j-3,j-2)+(1-a)*u*binomial(r+j-1,j)):   
B:=(r,a,u)->sum(w(r,j,a,u)*h(j/r),j=0..10):#infinity):    
H:=(r,a,u)->int(K(r,v,u)*B(r,a,v),v=0..infinity):

p1:=plot(h(u),u=-1.5*Pi..1.5*Pi,color=blue);
p2:=plot(B(10,0.9,u),u=0..1.5*Pi,color=red);
p3:=plot(H(10,0.9,u),u=0.01..1.5*Pi,color=brown); 
plots:-display([p1,p2,p3],view=[default,-2..2]);

 

If you have function say g(x) that depends on x, and want to take derivative of g(x) with respect to another function f(x), then you can do

            dg/df = (dg/dx)/(df/dx)

In your case, g=L, and f is your fA. Since both are functions of r, then you do that. This only works if both functions depend on same variable.

Maple gives

L := -r^2*((-fA(r)^4 + (-2*fB(r)^2 - 2*fC(r)^2 + 2)*fA(r)^2 + 4*D(fB)(r)*fA(r)*fC(r)*r - fB(r)^4 + (-2*fC(r)^2 + 2)*fB(r)^2 - 4*fB(r)*fC(r)*D(fA)(r)*r - 2*r^2*D(fA)(r)^2 - 1 - 2*r^2*D(fB)(r)^2)/(2*g^2*r^4) + (r*(fB(r)^2 + fC(r)^2/2 + fA(r)^2 - 2*fA(r) + 1)*H(r)^2 + (-D(K)(r)*r^2*fC(r) - 2*K(r)*fB(r)*r)*H(r) + K(r)^2*fC(r)^2*r/2 + D(H)(r)*K(r)*r^2*fC(r) + r*((fB(r)^2 + fA(r)^2)*K(r)^2 + r^2*(D(H)(r)^2 + D(K)(r)^2)/2))*v^2/(r^2)^(3/2) - lambda(((K(r)^2 + H(r)^2 - 1)*v^2)/2)^2);

-r^2*((1/2)*(-fA(r)^4+(-2*fB(r)^2-2*fC(r)^2+2)*fA(r)^2+4*(D(fB))(r)*fA(r)*fC(r)*r-fB(r)^4+(-2*fC(r)^2+2)*fB(r)^2-4*fB(r)*fC(r)*(D(fA))(r)*r-2*r^2*(D(fA))(r)^2-1-2*r^2*(D(fB))(r)^2)/(g^2*r^4)+(r*(fB(r)^2+(1/2)*fC(r)^2+fA(r)^2-2*fA(r)+1)*H(r)^2+(-(D(K))(r)*r^2*fC(r)-2*K(r)*fB(r)*r)*H(r)+(1/2)*K(r)^2*fC(r)^2*r+(D(H))(r)*K(r)*r^2*fC(r)+r*((fB(r)^2+fA(r)^2)*K(r)^2+(1/2)*r^2*((D(H))(r)^2+(D(K))(r)^2)))*v^2/(r^2)^(3/2)-lambda((1/2)*(K(r)^2+H(r)^2-1)*v^2)^2)

simplify(   diff(L,r)/diff(fA(r),r) )

(2*lambda((1/2)*(K(r)^2+H(r)^2-1)*v^2)^2*g^2*r^4+2*g^2*r^5*(D(lambda))((1/2)*(K(r)^2+H(r)^2-1)*v^2)*v^2*(H(r)*(diff(H(r), r))+K(r)*(diff(K(r), r)))*lambda((1/2)*(K(r)^2+H(r)^2-1)*v^2)-2*(-(diff(fC(r), r))*fB(r)*r+g^2*v^2*((K(r)^2+H(r)^2)*fA(r)-H(r)^2)*r^2*csgn(r)-((D@@2)(fA))(r)*r^2-fA(r)^3-fA(r)*fB(r)^2-fA(r)*fC(r)^2+fB(r)*fC(r)+fA(r))*r*(diff(fA(r), r))-(diff(H(r), r))^2*csgn(r)*g^2*r^4*v^2-g^2*v^2*csgn(r)*r^3*((diff(fC(r), r))*r*K(r)+((D@@2)(H))(r)*r^2+2*H(r)*fA(r)^2+2*H(r)*fB(r)^2+H(r)*fC(r)^2-4*H(r)*fA(r)-2*K(r)*fB(r)+K(r)*fC(r)+2*H(r))*(diff(H(r), r))-2*(r*fA(r)*(diff(fC(r), r))+((K(r)^2+H(r)^2)*fB(r)-H(r)*K(r))*g^2*v^2*r^2*csgn(r)-fB(r)^3+(-fA(r)^2-fC(r)^2+1)*fB(r)-((D@@2)(fB))(r)*r^2-fC(r)*fA(r))*r*(diff(fB(r), r))-(diff(K(r), r))^2*csgn(r)*g^2*r^4*v^2+g^2*v^2*csgn(r)*r^3*((diff(fC(r), r))*r*H(r)-((D@@2)(K))(r)*r^2-2*K(r)*fA(r)^2-2*K(r)*fB(r)^2-K(r)*fC(r)^2+2*H(r)*fB(r)+H(r)*fC(r))*(diff(K(r), r))-(g^2*r^2*v^2*(K(r)^2+H(r)^2)*csgn(r)-2*fA(r)^2-2*fB(r)^2)*fC(r)*r*(diff(fC(r), r))-g^2*r^4*v^2*fC(r)*(((D@@2)(H))(r)*K(r)-((D@@2)(K))(r)*H(r))*csgn(r)-fB(r)^4+(-2*fA(r)^2-2*fC(r)^2+2)*fB(r)^2+2*fB(r)*fC(r)*((D@@2)(fA))(r)*r^2-1-fA(r)^4+(-2*fC(r)^2+2)*fA(r)^2-2*fA(r)*fC(r)*((D@@2)(fB))(r)*r^2)/(r^3*g^2*(diff(fA(r), r)))

 

 

Download derivative_march_10_2024.mw

Student:-ODEs:-ODESteps does not support method name. If you try 

ode:=diff(y(x),x)+2*x*y(x)=x;

Student:-ODEs:-ODESteps(ode,y(x),['linear'])

#or

Student:-ODEs:-ODESteps(ode,y(x),['separable'])

You will get the same exact method used, which in this case separable.

To use different methods you need to use dsolve itself. Also DEtools:-odeadvisor(ode); is better than Student:-ODEs:-Type(ode) since it knows much more ode types. 

 

Example 1

 

ode:=diff(y(x),x)+2*x*y(x)=x;

diff(y(x), x)+2*x*y(x) = x

Student:-ODEs:-Type(ode)

{linear, separable}

dsolve(ode,['linear'])

y(x) = 1/2+exp(-x^2)*c__1

dsolve(ode,['separable'])

y(x) = -(1/2)*exp(-x^2)*c__1+1/2

 

 

 

Example 2

 

ode:=(x+y(x))*diff(y(x),x) = 1;

(x+y(x))*(diff(y(x), x)) = 1

Student:-ODEs:-Type(ode)

{}

DEtools:-odeadvisor(ode);

[[_homogeneous, `class C`], [_Abel, `2nd type`, `class C`], _dAlembert]

dsolve(ode,['dAlembert'])

y(x) = -x-1, y(x) = -x-LambertW(-c__1*exp(-x-1))-1

dsolve(ode,['Abel'])

y(x) = -x-1-LambertW(-2*c__1*exp(-1)/exp(x))

 

dsolve(ode,['homogeneous'])

y(x) = -x-LambertW(-c__1*exp(-1)/exp(x))-1

 

#to find all methods do
indices(`dsolve/methods`)

[1], [2, "linear_homogeneous other"], [high, "development"], [2, linear_homogeneous], [2, "special_functions"], [2, "hypergeometric"], [2, nonlinear], [1, high_degree], [3, linear_homogeneous], [high, linear_homogeneous], [3, linear_nonhomogeneous], [high, linear_nonhomogeneous], [2, "linear_homogeneous as given"], [1, "special"], [high, nonlinear], [1, extra], [2, linear_nonhomogeneous], [3, "development"], [1, "development"], [3, nonlinear], [2, "linear_homogeneous all methods"], [2, "linear_homogeneous in Normal Form"], [2, "development"], [1, semiclass]

`dsolve/methods`[2, "linear_homogeneous all methods"]

[quadrature, const_coeffs, Euler, linear_1, `linear/missing_y`, Kovacic, special_functions, to_const_coeffs, exact_linear, sym_1, Mathieu, MeijerG, Heun, HeunG, HeunC, HeunB, HeunD, HeunT, mu_xy, equivalent_to_Bessel, to_Riccati, Bessel, elliptic, Legendre, Whittaker, Kummer, cylindrical, hypergeometric, hypergeom1, hypergeom2, Riemann, RNF, hypergeometricsols, rationalize_lode, with_periodic_functions]

`dsolve/methods`[2, "linear_homogeneous other"]

[exact_linear, sym_1, to_const_coeffs, mu_xy, equivalent_to_Bessel, to_Riccati, with_periodic_functions]

ind:=indices(`dsolve/methods`);
for item in ind do
    cat("`dsolve/methods`",String(item));
    eval(parse(%))
od;

[1], [2, "linear_homogeneous other"], [high, "development"], [2, linear_homogeneous], [2, "special_functions"], [2, "hypergeometric"], [2, nonlinear], [1, high_degree], [3, linear_homogeneous], [high, linear_homogeneous], [3, linear_nonhomogeneous], [high, linear_nonhomogeneous], [2, "linear_homogeneous as given"], [1, "special"], [high, nonlinear], [1, extra], [2, linear_nonhomogeneous], [3, "development"], [1, "development"], [3, nonlinear], [2, "linear_homogeneous all methods"], [2, "linear_homogeneous in Normal Form"], [2, "development"], [1, semiclass]

"`dsolve/methods`[1]"

[quadrature, linear, Bernoulli, separable, inverse_linear, homogeneous, Chini, lin_sym, exact, Abel, pot_sym]

"`dsolve/methods`[2, "linear_homogeneous other"]"

[exact_linear, sym_1, to_const_coeffs, mu_xy, equivalent_to_Bessel, to_Riccati, with_periodic_functions]

"`dsolve/methods`[high, "development"]"

[k25, RNF, mu_heuristic, MeijerG, nonlinear_homogeneous, mu_poly_yn, exp_sym]

"`dsolve/methods`[2, linear_homogeneous]"

[linear_homogeneous]

"`dsolve/methods`[2, "special_functions"]"

[Bessel, elliptic, Legendre, Kummer, Whittaker, hypergeometric, Mathieu]

"`dsolve/methods`[2, "hypergeometric"]"

[hypergeom1, hyper3]

"`dsolve/methods`[2, nonlinear]"

[Liouville, WeierstrassP, JacobiSN, linearizable, linearizable_by_differentiation, mu_xy_2, missing, mu_xyp2_dynamical_symmetries_fully_reducible, mu_xyp_singularcases, sym_1, exact_nonlinear, reducible, lin_sym, `S-function`, mu_xyp_generalcase, mu_xyp2_dynamical_symmetries_not_fully_reducible]

"`dsolve/methods`[1, high_degree]"

[WeierstrassP, WeierstrassPPrime, JacobiSN, linearizable_by_differentiation, missing, dAlembert, homogeneous_B, sym_implicit]

"`dsolve/methods`[3, linear_homogeneous]"

[quadrature, const_coeffs, Euler, fully_exact_linear, to_const_coeffs, linear, exp_reduce, exact_linear, with_periodic_functions]

"`dsolve/methods`[high, linear_homogeneous]"

[quadrature, const_coeffs, Euler, fully_exact_linear, to_const_coeffs, linear, exp_reduce, exact_linear, with_periodic_functions]

"`dsolve/methods`[3, linear_nonhomogeneous]"

[quadrature, fully_exact_linear, `linear_nonhomogeneous_[0,1]`, exact_linear_nonhomogeneous, linear, exp_reduce]

"`dsolve/methods`[high, linear_nonhomogeneous]"

[quadrature, fully_exact_linear, `linear_nonhomogeneous_[0,1]`, exact_linear_nonhomogeneous, linear, exp_reduce]

"`dsolve/methods`[2, "linear_homogeneous as given"]"

[quadrature, const_coeffs, Euler, linear_1, `linear/missing_y`, Kovacic, RNF, special_functions, MeijerG, Heun, hypergeometricsols, rationalize_lode]

"`dsolve/methods`[1, "special"]"

[80, 81]

"`dsolve/methods`[high, nonlinear]"

[linearizable_by_differentiation, linearizable, reducible, exact_nonlinear, missing, mu_formal, lin_sym]

"`dsolve/methods`[1, extra]"

[inverse_Riccati, Abel_AIL, `sym_pat/[F(x)*G(y),0]`, `sym_pat/[F(x),G(x)]`, `sym_pat/[F(x),G(y)]`, `sym_pat/[F(x)+G(y),0]`, `sym_pat/[F(x),G(x)*y+H(x)]`, sym_pat, exp_sym]

"`dsolve/methods`[2, linear_nonhomogeneous]"

[quadrature, fully_exact_linear, `linear_nonhomogeneous_[0,1]`, `linear_nonhomogeneous_[0,F(x)]`, linear_nonhomogeneous]

"`dsolve/methods`[3, "development"]"

[k25, RNF, mu_heuristic, linear_patterns, MeijerG, nonlinear_homogeneous, mu_y2, mu_poly_yn, exp_sym, pFq, `3F2`, `2F2`, `1F2`, `0F2`]

"`dsolve/methods`[1, "development"]"

[linearizable_by_differentiation, linearizable, con_sym, WeierstrassP, WeierstrassPPrime, equivalent_to_Abel, Abel_AIR, special, Riccati_symmetries]

"`dsolve/methods`[3, nonlinear]"

[linearizable_by_differentiation, linearizable, missing, exact_nonlinear, reducible, mu_formal, lin_sym]

"`dsolve/methods`[2, "linear_homogeneous all methods"]"

[quadrature, const_coeffs, Euler, linear_1, `linear/missing_y`, Kovacic, special_functions, to_const_coeffs, exact_linear, sym_1, Mathieu, MeijerG, Heun, HeunG, HeunC, HeunB, HeunD, HeunT, mu_xy, equivalent_to_Bessel, to_Riccati, Bessel, elliptic, Legendre, Whittaker, Kummer, cylindrical, hypergeometric, hypergeom1, hypergeom2, Riemann, RNF, hypergeometricsols, rationalize_lode, with_periodic_functions]

"`dsolve/methods`[2, "linear_homogeneous in Normal Form"]"

[linear_1]

"`dsolve/methods`[2, "development"]"

[mu_xyp, mu_xyp2, mu_formal, mu_heuristic, exp_reduce, linear, Bessel2, Whittaker_old, nonlinear_homogeneous, exact_linear_nonhomogeneous, mu_y1, mu_x_y1, mu_y_y1, mu_poly_yn, exp_sym, sym_pat, sym_8]

"`dsolve/methods`[1, semiclass]"

[Riccati, inverse_Riccati, equivalent_to_Abel, linearizable, linearizable_by_differentiation]

 

 

Download specifiy_methods_of_dsolve.mw

you did not say which maple version you are using. but in Maple 2024 it does it just by using simplify

If this does not work in your version, try simplify(e,trig) and if this does not work, try convert(e,tanh)

one possible way is to use  TypeTools[AddType]

restart;

 

TypeTools[AddType]( my_type_A, n->evalb(n::integer and (n=10 or n=20 or n=30)) );

my_proc:=proc(a::integer, b::my_type_A)
  print(b)
end proc;

proc (a::integer, b::my_type_A) print(b) end proc

my_proc(3,10)

10

my_proc(3,7)

Error, invalid input: my_proc expects its 2nd argument, b, to be of type my_type_A, but received 7

my_proc(3,30)

30

Download my_type.mw

Another option is to use `type/....`  

I am no expert much in this area to know which method is better or more robust. 

restart

`type/my_type_A` := n->evalb(n::integer and (n=10 or n=20 or n=30))

proc (n) options operator, arrow; evalb(n::integer and (n = 10 or n = 20 or n = 30)) end proc

my_proc:=proc(a::integer, b::my_type_A)
  print(b)
end proc;

proc (a::integer, b::my_type_A) print(b) end proc

my_proc(3,10)

10

my_proc(3,7)

Error, invalid input: my_proc expects its 2nd argument, b, to be of type my_type_A, but received 7

my_proc(3,30)

30

Download my_type_2.mw

The advantage of making a name for the type, is that you can use this name in other places in your code to check if variable is of this type. Like this

restart

`type/my_type_A` := n->evalb(n::integer and (n=10 or n=20 or n=30))

proc (n) options operator, arrow; evalb(n::integer and (n = 10 or n = 20 or n = 30)) end proc

b:=30;
if b::my_type_A then
   "yes";
else
   "no";
fi;

30

"yes"

b:=31;
if b::my_type_A then
   "yes";
else
   "no";
fi;

31

"no"

Download my_type_3.mw

You need to tell it that x is real also.

is(0 < x^2 + x + y) assuming (0 < x + y), x::real

  # true

Because, what happens if x=-I and y=I+1? then x+y is 1, right? but x^2 is now -1, and -1+1 is zero which is not positive.

 

I've collected all Maple tech letters sometime ago from different corners of the internet.

Here is Vol 1, No 1  attached

MapleTech_volume_1_number_1_spring_1994.pdf

 

use simplify with side relation

is ( simplify( x*y*z, {x*z=0}) = 0 )

gives true

So instead of 

 simplify( x*y*z ) assuming x=0

Which does not give zero, use 

simplify( x*y*z ,{x=0})

which now gives zero.

The order is important for type. Here is a much simpler example

type(1+"s",`&+`(integer,string));

    #true

Now change the order, it gives false

type(1+"s",`&+`(string,integer));

   #false

That is why your third one gave true but the first two did not, The third one had the same exact order as how Z is written.  

One would think the order of `+` operands should not matter but  it does for type.

The only way I know how to make it match all, is to use alternatives and enumerate all possible cases.  For the above example, that will be

type(1+"s", {`&+`(integer,string) 
             ,`&+`(string,integer) 
            }
    )
#true

So you'd do the same for your input. 

I do not know other ways to do it. Using `Or` does work. At least in my attempts. So I always do it this way, by listing all possible alternatives.  

Your A is equation and not polynomial. lhs(A) is a polynomial. 

So instead of 

for i from 0 to degree(A,p) do EQ[i]:=simplify(coeff(A,p,i)); end do;

Do this instead

for i from 0 to degree(lhs(A),p) do EQ[i]:=simplify(coeff(lhs(A),p,i)); end do;

And now it gives

I do not think you can do this in general because as you said, Maple will apply auto-simplification and revert the changes.

If you just want this for display purposes, this is function which you call only any expressions and it will convert the circular trig functions to use sin only. It uses InertForm:-Parse to prevent Maple from reverting it back. This handles cos.,tan,sec,cot and csc.  You can use value(%) to convert back to non inert form.

restart;

change_to_sin_only:=proc(expr)
local e,F;

  e:=evalindets(expr,specfunc(anything,cos),F->InertForm:-Parse( cat("sin(",String(op(1,F)),"+Pi/2)")));
  e:=evalindets(e,specfunc(anything,tan),F->InertForm:-Parse( cat("sin(",String(op(1,F)),")/sin(",String(op(1,F)),"+Pi/2)")));
  e:=evalindets(e,specfunc(anything,sec),F->InertForm:-Parse( cat("1/sin(",String(op(1,F)),"+Pi/2)")));
  e:=evalindets(e,specfunc(anything,cot),F->InertForm:-Parse( cat("sin(",String(op(1,F)),"+Pi/2)/sin(",String(op(1,F)),")")));
  e:=evalindets(e,specfunc(anything,csc),F->InertForm:-Parse( cat("1/sin(",String(op(1,F)),")")));
  e;
end proc:

expr:=cos(x)+sin(x)+x+tan(2*x)+sec(x)+csc(x)+cot(x)+sin(x)/cos(x)+exp(2*cos(x));

cos(x)+sin(x)+x+tan(2*x)+sec(x)+csc(x)+cot(x)+sin(x)/cos(x)+exp(2*cos(x))

change_to_sin_only(expr);

%sin(`%+`(x, `%/`(Pi, 2)))+sin(x)+x+`%/`(%sin(`%*`(2, x)), %sin(`%+`(`%*`(2, x), `%/`(Pi, 2))))+`%/`(1, %sin(`%+`(x, `%/`(Pi, 2))))+`%/`(1, %sin(x))+`%/`(%sin(`%+`(x, `%/`(Pi, 2))), %sin(x))+sin(x)/%sin(`%+`(x, `%/`(Pi, 2)))+exp(2*%sin(`%+`(x, `%/`(Pi, 2))))

simplify(value(%));

cos(x)+sin(x)+x+tan(2*x)+sec(x)+csc(x)+cot(x)+tan(x)+exp(2*cos(x))

expr:=cos(x)^3+sin(x)+1/tan(2*x);

cos(x)^3+sin(x)+1/tan(2*x)

change_to_sin_only(expr);

%sin(`%+`(x, `%/`(Pi, 2)))^3+sin(x)+1/`%/`(%sin(`%*`(2, x)), %sin(`%+`(`%*`(2, x), `%/`(Pi, 2))))

simplify(value(%));

cos(x)^3+sin(x)+cot(2*x)

 


Download convert_to_sin.mw

 

See my original post where I state it needs to be cos(x)=k*sqrt(1-sin(x)^2) 

This versions uses  this form with k +1 or -1. You can pick the one you need or feel free to modify it.

Again, this is for display only as it uses Inert form

restart;

change_to_sin_only:=proc(expr,k::integer,$)
local e,F;
  if k=-1 then
     e:=evalindets(expr,specfunc(anything,cos),F->InertForm:-Parse( cat("-1*sqrt(1-sin(",String(op(1,F)),")^2)")));
     e:=evalindets(e,specfunc(anything,cot),F->InertForm:-Parse( cat("-1*sqrt(1-sin(",String(op(1,F)),")^2)/sin(",String(op(1,F)),")")));
     e:=evalindets(e,specfunc(anything,sec),F->InertForm:-Parse( cat("1/(-1*sqrt(1-sin(",String(op(1,F)),")^2))")));
     e:=evalindets(e,specfunc(anything,csc),F->InertForm:-Parse( cat("1/sin(",String(op(1,F)),")")));
     e:=evalindets(e,specfunc(anything,tan),F->InertForm:-Parse( cat("sin(",String(op(1,F)),")/(-1*sqrt(1-sin(",String(op(1,F)),")^2))")));
  elif k=1 then
     e:=evalindets(expr,specfunc(anything,cos),F->InertForm:-Parse( cat("sqrt(1-sin(",String(op(1,F)),")^2)")));
     e:=evalindets(e,specfunc(anything,cot),F->InertForm:-Parse( cat("sqrt(1-sin(",String(op(1,F)),")^2)/sin(",String(op(1,F)),")")));
     e:=evalindets(e,specfunc(anything,sec),F->InertForm:-Parse( cat("1/(sqrt(1-sin(",String(op(1,F)),")^2))")));
     e:=evalindets(e,specfunc(anything,csc),F->InertForm:-Parse( cat("1/sin(",String(op(1,F)),")")));
     e:=evalindets(e,specfunc(anything,tan),F->InertForm:-Parse( cat("sin(",String(op(1,F)),")/(sqrt(1-sin(",String(op(1,F)),")^2))")));
  else
     error "k must be 1 or -1";
  fi;
  e;
end proc:

expr:=cos(x)+sin(x)+x+tan(2*x)+sec(x)+csc(x)+cot(x)+tan(x)+exp(2*cos(x));

cos(x)+sin(x)+x+tan(2*x)+sec(x)+csc(x)+cot(x)+tan(x)+exp(2*cos(x))

change_to_sin_only(expr,1);

%sqrt(`%+`(1, -`%^`(%sin(x), 2)))+sin(x)+x+`%/`(%sin(`%*`(2, x)), %sqrt(`%+`(1, -`%^`(%sin(`%*`(2, x)), 2))))+`%/`(1, %sqrt(`%+`(1, -`%^`(%sin(x), 2))))+`%/`(1, %sin(x))+`%/`(%sqrt(`%+`(1, -`%^`(%sin(x), 2))), %sin(x))+`%/`(%sin(x), %sqrt(`%+`(1, -`%^`(%sin(x), 2))))+exp(2*%sqrt(`%+`(1, -`%^`(%sin(x), 2))))

change_to_sin_only(expr,-1);

`%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(x), 2))))+sin(x)+x+`%/`(%sin(`%*`(2, x)), `%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(`%*`(2, x)), 2)))))+`%/`(1, `%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(x), 2)))))+`%/`(1, %sin(x))+`%/`(`%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(x), 2)))), %sin(x))+`%/`(%sin(x), `%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(x), 2)))))+exp(2*`%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(x), 2)))))

expr:=1/tan(2*sin(x))+sec(x);

1/tan(2*sin(x))+sec(x)

change_to_sin_only(expr,1);

1/`%/`(%sin(`%*`(2, %sin(x))), %sqrt(`%+`(1, -`%^`(%sin(`%*`(2, %sin(x))), 2))))+`%/`(1, %sqrt(`%+`(1, -`%^`(%sin(x), 2))))

change_to_sin_only(expr,-1);

1/`%/`(%sin(`%*`(2, %sin(x))), `%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(`%*`(2, %sin(x))), 2)))))+`%/`(1, `%*`(-1, %sqrt(`%+`(1, -`%^`(%sin(x), 2)))))

 


 

Download convert_to_sin_v2.mw

according to this FAQ page, to change heap size, edit this line

# set maximum Java heap size
# maxheap=700m

In the file launch.ini ( I do not know if this affect the user interface process or mserver.exe process). The above page says

The Java heap size is the system memory allocated to the creation of a JVM (Java Virtual Machine) application

So I assume this is for the user interface and not mserver.exe. 

For stacksize use the command (you can put this in your maple init file for example).

kernelopts(stacksize = 100*1024*1024);

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