Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

When Maple converts sin(x)^n to Latex, the result remain  sin(x)^n.  But in Mathematical typesetting, this is normally written as sin^n(x).   Ofcourse this is only for Latex. In Maple code this not valid.

Is it possible to change Maple's Latex to make it do this automatically? Mathematica does this automatically. Here is an example

restart;
expr:=sin(x)^3+cos(3*x)^5;              
Physics:-Latex(expr)
 
            \sin \left(x \right)^{3}+\cos \left(3 x \right)^{5}

Which when compiled gives

Compare to Latex generated by Mathematica

Which compiles to 

Which is more standard in books and papers, than Maple's version.

Both Maple's Physics:-Latex and latex() command do the same thing.

Is there a way to make it generate the improved version for latex?

Maple 2020.1

 

 

sometimes I get intermediate expressions generated from other operations that contain terms such as exp(x)^n in them. As an example, exp(x)^3.  In Mathematica, it automatically replaces these by exp(3*x). But in Maple I need to force this change.

For purposes of Latex only, I like to change these terms to exp(3*x) before converting the whole expression to Latex, as it is looks much better that way.

expr:=exp(x)^3;
Physics:-Latex(expr)

                \left({\rm e}^{x}\right)^{3}

expr:=exp(3*x);
Physics:-Latex(expr)

                {\rm e}^{3 x}


I found that doing simplify(expr,exp)  does the trick. It changes exp(x)^n to exp(n*x). But I am worried about applying this whole simplification command to the whole expression, which can be very large, and do not want to change it all yet.

I just want to change any occurance of exp() there, and nothing more.

I tried using subsindent to do that, but it does not work on terms in denominator

restart;
expr:=exp(x)^3*sin(x)+3/(exp(x)^n);
subsindets(expr,'exp(anything)^anything',f->simplify(f,exp))

I tried

subsindets(expr,'1/exp(anything)^anything',f->simplify(f,exp))

and it did not work.

I am still not good at subsindent. How to make it change all exp(x)^n to exp(n*x) everywhere?

Hello

I need to detect if different expressions contain a radical. For example

aaa := X3*(alpha[2, 8]*(sqrt(X2/alpha[1, 7])*alpha[3, 8] + X1*alpha[3, 6])*X2 + X3*(alpha[2, 8] + alpha[3, 9]/2))/(X2*alpha[2, 8])

As can be noticed there is a square root in the expression.   

I have tried type(expr,sqrt) and has but to no avail. (I am not sure if I use them as they should though).   

Many thanks

 

Ed

 

Hi:

Every once-in-a-while Maple crashes due to a bug in numerical integration that I reported ages ago, but was never fixed (or if it was, I was never told). Anyway, this time, in addition to crashing, it wiped out my worksheet, and froze the machine. When I recovered, Maple had lost all memory of my preferences, recent files, etc - it was as if I had a clean installation.

I restored the link to the usual style file I use, but it still refuses to give me back the style I want - that is - the classical worksheet. Every command I enter now requires F5 or I will get 2D input which I hate. Does anyone know where the preferences, probably an .INI file, are kept, so I can restore it from an older version of Maple.

Thank you

Hi, i am using solve and solve command to find the root but when i used fsolve command to separate only real root, could separate all roots, can anyone correct me, please


 

restart

f := 9.765625000*10^(-6)*(-6671.221362*(x^2+2)^5*sqrt(2)*arctan((1/2)*x*sqrt(2))*x-555.9351135*(x^2+2)^6/((1/2)*x^2+1)-10479.13001*(x^2+2)^5*sqrt(2)*x-(374220*(0.297116730e-1*x^9+.269385824*x^7+.99643086*x^5+5.18951288*x^3+4.42867382*x))*x-1111.870227*x^10-12601.19538*x^8-62147.39274*x^6-485504.8775*x^4-828649.1585*x^2-788850.2769)/(x^2+2)^6-(0.1171875000e-3*(-555.9351135*(x^2+2)^6*sqrt(2)*arctan((1/2)*x*sqrt(2))-873.2608343*(x^2+2)^6*sqrt(2)-(374220*(0.29711673e-2*x^10+0.33673228e-1*x^8+.16607181*x^6+1.29737822*x^4+2.21433691*x^2+2.107985348))*x))*x/(x^2+2)^7+(3.484800000*sqrt(2)*(x^2+2)*arctan((1/2)*x*sqrt(2))*x+.8712000000*(x^2+2)^2/((1/2)*x^2+1)+(5.473911040*(x^2+2))*sqrt(2)*x+5.227200000*x^2-22.99200001)/(16*(x^2+2)^2)-(.8712000000*sqrt(2)*(x^2+2)^2*arctan((1/2)*x*sqrt(2))+1.368477760*sqrt(2)*(x^2+2)^2-36*x*(-0.484000000e-1*x^2+.638666667))*x/(4*(x^2+2)^3)

0.9765625000e-5*(-6671.221362*(x^2+2)^5*2^(1/2)*arctan((1/2)*x*2^(1/2))*x-555.9351135*(x^2+2)^6/((1/2)*x^2+1)-10479.13001*(x^2+2)^5*2^(1/2)*x-374220*(0.297116730e-1*x^9+.269385824*x^7+.99643086*x^5+5.18951288*x^3+4.42867382*x)*x-1111.870227*x^10-12601.19538*x^8-62147.39274*x^6-485504.8775*x^4-828649.1585*x^2-788850.2769)/(x^2+2)^6-0.1171875000e-3*(-555.9351135*(x^2+2)^6*2^(1/2)*arctan((1/2)*x*2^(1/2))-873.2608343*(x^2+2)^6*2^(1/2)-374220*(0.29711673e-2*x^10+0.33673228e-1*x^8+.16607181*x^6+1.29737822*x^4+2.21433691*x^2+2.107985348)*x)*x/(x^2+2)^7+(1/16)*(3.484800000*2^(1/2)*(x^2+2)*arctan((1/2)*x*2^(1/2))*x+.8712000000*(x^2+2)^2/((1/2)*x^2+1)+5.473911040*(x^2+2)*2^(1/2)*x+5.227200000*x^2-22.99200001)/(x^2+2)^2-(1/4)*(.8712000000*2^(1/2)*(x^2+2)^2*arctan((1/2)*x*2^(1/2))+1.368477760*2^(1/2)*(x^2+2)^2-36*x*(-0.484000000e-1*x^2+.638666667))*x/(x^2+2)^3

(1)

ip := solve(f = 0, x)

.6540411301, 3126.002498+5414.398621*I, .4137989369+1.038962897*I, .6364817315+1.870977651*I, -.6364817315+1.870977651*I, -.4137989369+1.038962897*I, -.6540411301, -6252.010299, -.4137989369-1.038962897*I, -.6364817315-1.870977651*I, .6364817315-1.870977651*I, .4137989369-1.038962897*I, 3126.002498-5414.398621*I

(2)

cp := fsolve(numer(f) = 0, x)

.6540411302

(3)

``


 

Download help_fsolve_real_root.mw

Hi there.

As we all know if we multiply two polynomials f(x) and g(x) of degrees m and n respectively we get polynomial h(x)= f(x)*g(x) of degree m+n and with m+n+1 coefficients in general. Function modp1(('Multiply')(...)) doing this very well. But sometimes we don't need full resulting h(x) - just subset of monomials and subset of coefficients of h(x) - so we don't need to calculate all m+n+1 coefficients of h(x) and waste time and resources for that.

I would request some additional rework of modp1 package: by adding to modp1(('Multiply')(...)) two optional parameters - degrees of first and last calculating coefficients of h(x).

For example:

h:=modp1(Multiply(f, g,n-1,n+1), p) could calculate only monomials with n-1, n and n+1 degrees and set other monomials to zero.

Or maybe it should be new function:

h:=modp1(Multiply_Truncate(f, g,n-1,n+1), p)

 

Is it possible?

It would be great and very efficient in many tasks.

Thank you.


 

restart;

M__h := 0.352e-1;

0.352e-1

 

0.34e-1

 

0.8354e-1

 

0.96e-2

 

.123

 

0.7258e-1

 

0.214e-1

 

0.219e-1

 

.123

 

.7902

 

.11

 

0.136e-3

 

0.5e-1

 

0.8910e-1

 

0.45e-1

 

.7

 

.7214

 

1.354

 

0.235e-1

(1)

pdes := [diff(B(t, x), t) = M__h-beta__1*B(t, x)*G(t, x)/N__h+beta__2*B(t, x)*G(t, x)/N__h-mu__h*B(t, x)+sigma__h*E(t, x)*(diff(B(t, x), x, x)), diff(C(t, x), t) = beta__1*B(t, x)*G(t, x)/N__h-u[1]*C(t, x)/(1+C(t, x))-mu__h*C(t, x)*(diff(C(t, x), x, x)), diff(DD(t, x), t) = beta__2*DD(t, x)*G(t, x)/N__h-u[1]*DD(t, x)/(1+DD(t, x))-mu__h*DD(t, x)-delta__1*DD(t, x)*(diff(DD(t, x), x, x)), diff(E(t, x), t) = u[1]*C(t, x)/(1+C(t, x))+u[1]*DD(t, x)/(1+DD(t, x))-(mu__h+sigma__h)*E(t, x)*(diff(E(t, x), x, x)), diff(F(t, x), t) = M__b-beta__3*F(t, x)*C(t, x)/N__b+beta__4*F(t, x)*DD(t, x)/N__b-mu__b*F(t, x)*(diff(F(t, x), x, x)), diff(G(t, x), t) = beta__3*F(t, x)*C(t, x)/N__b+beta__4*F(t, x)*DD(t, x)/N__b-mu__b*G(t, x)*(diff(G(t, x), x, x))];

[diff(B(t, x), t) = 0.352e-1-0.891056911e-1*B(t, x)*G(t, x)-0.96e-2*B(t, x)+0.8910e-1*E(t, x)*(diff(diff(B(t, x), x), x)), diff(C(t, x), t) = .6791869919*B(t, x)*G(t, x)-0.45e-1*C(t, x)/(1+C(t, x))-0.96e-2*C(t, x)*(diff(diff(C(t, x), x), x)), diff(DD(t, x), t) = .5900813008*DD(t, x)*G(t, x)-0.45e-1*DD(t, x)/(1+DD(t, x))-0.96e-2*DD(t, x)-0.235e-1*DD(t, x)*(diff(diff(DD(t, x), x), x)), diff(E(t, x), t) = 0.45e-1*C(t, x)/(1+C(t, x))+0.45e-1*DD(t, x)/(1+DD(t, x))-0.9870e-1*E(t, x)*(diff(diff(E(t, x), x), x)), diff(F(t, x), t) = .7214-.1739837398*F(t, x)*C(t, x)+.1780487805*F(t, x)*DD(t, x)-1.354*F(t, x)*(diff(diff(F(t, x), x), x)), diff(G(t, x), t) = .1739837398*F(t, x)*C(t, x)+.1780487805*F(t, x)*DD(t, x)-1.354*G(t, x)*(diff(diff(G(t, x), x), x))]

(2)

bcs := [(D[2](B))(t, 0) = 0, (D[2](B))(t, 1) = 0, (D[2](C))(t, 0) = 0, (D[2](C))(t, 1) = 0, (D[2](DD))(t, 0) = 0, (D[2](DD))(t, 1) = 0, (D[2](E))(t, 0) = 0, (D[2](E))(t, 1) = 0, (D[2](F))(t, 0) = 0, (D[2](F))(t, 1) = 0, (D[2](G))(t, 0) = 0, (D[2](G))(t, 1) = 0, B(0, x) = 100, C(0, x) = 70, DD(0, x) = 50, E(0, x) = 70, F(0, x) = 100, G(0, x) = 70]

[(D[2](B))(t, 0) = 0, (D[2](B))(t, 1) = 0, (D[2](C))(t, 0) = 0, (D[2](C))(t, 1) = 0, (D[2](DD))(t, 0) = 0, (D[2](DD))(t, 1) = 0, (D[2](E))(t, 0) = 0, (D[2](E))(t, 1) = 0, (D[2](F))(t, 0) = 0, (D[2](F))(t, 1) = 0, (D[2](G))(t, 0) = 0, (D[2](G))(t, 1) = 0, B(0, x) = .100, C(0, x) = .70, DD(0, x) = .50, E(0, x) = .70, F(0, x) = .100, G(0, x) = .70]

(3)

sol := pdsolve(pdes, bcs, numeric);

module () local INFO; export plot, plot3d, animate, value, settings; option `Copyright (c) 2001 by Waterloo Maple Inc. All rights reserved.`; end module

(4)

sol:-plot3d([B(t, x), C(t, x)], t = 0 .. 20, x = 0 .. 20)

Error, (in pdsolve/numeric/plot3d) unable to compute solution for t>HFloat(0.25):
Newton iteration is not converging

 

``


 

Download spatial_1.mw

Not sure part A is done correctly. flow (m^3 / s) = Area (M^2) * velocity (m/s)

And have no idea how to do part B in maple

Thank you!

How to solve the system equation with Matrix? Basically is part (b)

And not quite familiar with Matrix multiplication in maple? How to do part(c)?

Thank you!!!!

Hi all,

We want to find a curve fit for an integer sequence.

We have n such that n^2+n+17 is a prime number.

See oeis.org/A007635 and comments.

Use the Maple CurveFitting package.

I tried with(CurveFitting).

We do not know if this is best represented by a polynomial or exponential curve fit.

 

n2_and_n_and_17_in_OEIS_007635.mw

n2_and_n_and_17_in_OEIS_007635.pdf

Regards,

Matt

The low-level command is "RTABLE". I have used it a million times. I use it with Maple 13 to replace expressions by tables.
For example,

print(`Hello! `*RTABLE(1,x^2+y^2));

will print: Hello! x^2+y^2. However, the main reason I am using it is to avoid Maple messing up the order of things like sums,
products, etc. However, this command has disappeared. It does not exist in Maple 2020. So, I cannot run my programs at the university which now has Maple 2020. Anybody knows if this command can still be used in another form the same way?

Thank you!
mapleatha

The 2020 Maple Conference is coming up fast! It is running from November 2-6 this year, all remotely, and completely free.

The week will be packed with activities, and we have designed it so that it will be valuable for Maple users of all skill and experience levels. The agenda includes 3 keynote presentations, 2 live panel presentations, 8 Maplesoft recorded presentations, 3 Maple workshops, and 68 contributed recorded presentations.

There will be live Q&A’s for every presentation. Additionally, we are hosting what we’re calling “Virtual Tables” at every breakfast (8-9am EST) and almost every lunch (12-1 EST). These tables offer attendees a chance to discuss topics related to the conference streams of the day, as well as a variety of special topics and social discussions. You can review the schedule for these virtual tables here.

Attendance is completely free, and we’re confident that there will be something there for all Maple users. Whether you attend one session or all of them, we’d love to see you there!

You can register for the Maple Conference here.

Hello! I would like to ask a short question about particularsol function. Could someone please explain to me, why the function interprets the cosinus term as particular solution, even though it is homogeneous solution? Is it a bug in Maple or I unterstand something wrong?

I am trying to find the surface area of f(x,y) but Maple seems unable to calculate it even numerically.  Any help would be much appreciated.  I'm not sure if I have written this correctly.

 

f := (x, y) -> x^4*sin(x^2 + y^3)^2*ln(y) + 2*y*x

fx := 4*x^3*sin(y^3 + x^2)^2*ln(y) + 4*x^5*sin(y^3 + x^2)*ln(y)*cos(y^3 + x^2) + 2*y

fy := 6*x^4*sin(y^3 + x^2)*ln(y)*y^2*cos(y^3 + x^2) + x^4*sin(y^3 + x^2)^2/y + 2*x

Int(Int(sqrt(fx^2 + fy^2 + 1.), x = 0. .. 4.), y = 1. .. 5.)

 

What is the best way to handle this?  Many times one wants to return an expression from inside a proc, which uses local symbls, back to the user (global context).

The problem is, if one tries to simplify this returned expression, adding assumptions on some of the symbols in the expression, it does not work. Since the symbol used in the assuming is global, while the symbol inside the returned expression was local to the proc.

Even though the symbols look the same on the screen, they are actually different symbols, so the simplify does not work as expected.

Here is a simple example

restart;
foo:=proc()
local x;
  return exp(2*sqrt(1/x^2)*x*ln(x)) + exp(sqrt(1/x^2)*x*ln(x)) ;
end proc;

sol:=foo();

simplify(sol) assuming x>0

The above does not work. Since the "x" in assuming x>0 is global, while the "x" in the expression was local to the proc. So even though they look same, they are different symbols.

The standard way to handle this, is to pass the "x" to be used to build the solution, from the user to the proc(), so that when the expression is returned, the "x" used will be the global one. Like this

restart;
foo:=proc(x)
  return exp(2*sqrt(1/x^2)*x*ln(x)) + exp(sqrt(1/x^2)*x*ln(x)) ;
end proc;

sol:=foo(x);

simplify(sol) assuming x>0

Now it works:

But this method is not practical all the time. Suppose the local proc wants to generate an expression with other symbols in it, that the user does not know about. Say alpha, beta, z, eta, and so on. The user does not care about having to pass every possible symbol down on each call.  

Is there a way to tell assuming, that the symbols in assumptions command, are to be taken from the expression itself, and not to be global ones?    i.e. when doing 

simplify(sol) assuming x>0

I want Maple to take that "x" in assuming to be the "x" inside the expression only, and not a global "x".  

This will make life much simpler.  I remember seeing other use of assuming where this could be done, but I can't find it yet.

edit:

This is  just one example, where returning expression with new symbol from local proc can be required sometimes.

This is similar to using constant of integrations _C1 by dsolve when it returns a solution.

But those _C1 are all predefined as system/global symbols. But there can be cases where one needs to use new symbols. 

An example is where int() timesout or it does not produce result.

In this case, instead of leaving it as is (since I need to use the result and do not want Maple to keep evaluating it in the expression it is in), so  I replace int(integrand,x) with Int( new_integrand , alpha=0...x) where new_integrand is the same as integrand but with each in it, is replaced by new symbol alpha

This symbol alpha has to be local to the proc (it was not passed down by user). 

Maple uses _Z sometimes for such a cases, which I do not like. (it looks bad in Latex)

Here is an example

foo:=proc(x)
local int_result,alpha;
local integrand:=1/ln(x^2+1);

int_result:= int(integrand,x);
if has(int_result,'int') then  #did not integrate
   int_result:=Int(subs(x=alpha,integrand),alpha=0..x);
fi;

  return int_result;
end proc:

int_result:=foo(x)

The expression returned contains symbol alpha, which is local to the proc.  Only way around this, is to have the user pass in alpha as well as x, just in case it is needed, which is not practical to do.

This is just one example of many. Another example is when doing some transformation internally (change of variables) to convert the ode from one form to another, and I need to return those intermediate results back to caller. These substitutions use local symbols.

As I said, I could have used _Z or some other system/global known symbol for this. But I do not like how this looks in Latex. And if I need another symbol for another case, I have to look for another one.  Instead, I just make my own local symbols and use them in the expression. (Except for constant of integrations, I use those _C1,_C2, etc....

 

First 361 362 363 364 365 366 367 Last Page 363 of 2097