# MaplePrimes Questions

Search Questions:

## Latest Questions Latest Questions Feed

### how to plot inequality with maple 12...

December 14 2014
0 2

I'd like to plot the following inequalities:

sqrt(x)<=1/sqrt(2)

1/sqrt(2)<sqrt(x)<=1/sqrt(2)

### Translating a MATLAB script to Maple...

December 14 2014
2 0

Hey!

I have this MATLAB script, but as I work in Maple, I'll need to translate it to Maple.
I know how to define symbols and functions, but I don't know which Maple commands to use, of if it needs to be done in another way, so the problem is translating from " dZ = [dx; dy; ax; ay; dm];" and down.

Any help would truly be greatly appreciated! Thank you!

This is the script:

function dZ = meteor_step(~, Z)

P = 1.2; % initial atmospheric pressure
H = 1.39E-4; % scale height of atm pressure
E = 8.11131859E6; % evaporation energy
D = 1; % drag constant
G = 9.814; % acceleration due to gravity
PM = 3.3E3; % density of the meteor

S = 3.986E14; % standard gravitational parameter of Earth (G*M)
R = 6.3674447E6; % radius of the Earth (meters)

x = Z(1);
y = Z(2);
dx = Z(3);
dy = Z(4);
m = Z(5);

atm = P*exp(-y*H);

v = sqrt(dx^2+dy^2);

area = pi * ( (3*m)/(4*PM) )^(2/3);

dist = sqrt(x^2+y^2);
Gv = -9.8;

accel = -(D*atm*area)/m*v;
ax = accel * dx;
ay = accel * dy + Gv;

dm = -(atm*v^3*area)/(2*E);

dZ = [dx; dy; ax; ay; dm];

end

[t, R] = ode45(@meteor_step, [0 250], [0, 100000, 100, -300, 25]);

x = R(:,1);
y = R(:,2);

dx = R(:,3);
dy = R(:,4);

v = (dx.^2+dy.^2).^(1/2);

m = R(:,5);

figure(1);
plot(t, y);
title('Meteor Kinematics: Height vs Time');
xlabel('Time elapsed (s)');
ylabel('Height (m)');

figure(2);
plot(x, y);
title('Meteor Kinematics: Horizontal vs Vertical Position');
xlabel('Horizontal (m)');
ylabel('Vertical (m)');

figure(3);
plot(t, v);
title('Meteor Kinematics: Speed vs Time');
xlabel('Time elapsed (s)');
ylabel('Absolute speed (m/s)');

figure(4);
plot(t, m);
title('Meteor Kinematics: Mass vs Time');
xlabel('Time elapsed (s)');
ylabel('Mass (kg)');

figure(5);
plot(t, dy);
title('Vertical Velocity vs Time');
xlabel('Time elapsed (s)');
ylabel('Vertical velocity (m/s)');

temp = abs(y - 52900);
[~, index] = min(temp);

t(index)
dx(index)/1000
dy(index)/1000

### How to retain an executed worksheet...

December 13 2014
1 1

I've got a worksheet in which I have invested many hours of CPU execution time and if the computer goes down, or Maple fails for some reason, I'll lose it all.

If this happens I would like to be able to continue the calculation from where I left off.

By saving the worksheet periodically, I can save all the commands, but not the results, so if I have to restart, I'll have to wait many hours before the worksheet catches up to where it left off.

In ancient versions of Maple, you used to be able to save an executed worksheet including results (I sort of remember that you wrote a file with the extension ".M")  but the new help pages say that is now different from what it used to be. Obviously I can "save" individual symbols to a file, but for a complicated worksheet  that gets complicated.

I've read about "maplet" files, but that doesn't seem to fill the bill either.

So, is there any simple way to save a worksheet so you can continue seamlessly from where you left off after a crash, with all the previous results intact?

### How to clear Maple output?...

December 13 2014
0 4

I have written a program which plays the game of Multicube, a commercially made boardgame. It works OK except that when the game is replayed, the previous game output stays on the screen.  This is rather distracting and I'd like the screen cleared when a new game is run.   I'd like to know how the screen previous ouput can be cleared.   ...or what is the likely cause.

At the start of my program I have:

restart;
interface(echo=0, verboseproc=0, warnlevel=0, prettyprint=1):

#I thought restart; would automatically have cleared any previous output.

The program reads necessary input (eg no of players, ..)  using:

Thanks,  David

### can maple give answer for int(cos(x)^n,x) ?...

December 13 2014
2 11

Was trying to see if I can get the reduction formulas for int(cos(x)^n,x) in maple. But it seems no assumption used can make Maple give any result for this.  Mathematica gives a result using Hypergeometric2F1 (even with no assumption on n, which I am not sure about now), but was wondering why maple can't do this one:

restart;
int( (cos(x))^n,x) assuming n::integer;

int( (cos(x))^n,x) assuming n::posint;
same

In Mathematica, I get:

I am newbie in Maple, so may be I am missing some command or doing something wrong.

ps. I was trying to obtain

But this is lost case now. I just need to find out first why int(cos(x)^n,x) does not evaluate to anything in Maple.

fyi, the Hypergeometric result for $\int cos^n(x) \,dx$ can be seen in this reference (half way down the page):

http://www.integraltec.com/math/math.php?f=cosPower.html#cos

ps. can't one enter Latex in this forum like at stack exchange?

### Boundary Value Problem...

December 13 2014
2 3

Hello,

I am trying to solve the boundary value problem (1-x^2)*y'' - 2*x*y' +12*y = 0 with y(-1) = -1 and y(1) = 1.  I have not used Maple much, but from some web surfing, it seems like the following inputs should work:

de := (1-x^2)*(diff(y(x), \$(x, 2)))-2*x*(diff(y(x), x))+12*y(x) = 0

Y := dsolve(de, y(-1) = -1, y(1) = 1)

However, when I input these lines, I get the error: Error(in dsolve), found wrong extra argument(s): y(-1) = -1, y(1) = 1

Does this mean that Maple can't solve this problem?  Is my syntax wrong?  I would appreciate any help.

Thanks!

Tim

### fsolve stopping criteria...

December 13 2014
1 6

What are the stopping criteria for fsolve?
I cannot find anything in the help page and there seems to be no way of adding an optional argument to fsolve about errors.

I was initially surprised by the results of the first two fsolve commands below:

restart;
infolevel[fsolve]:=2:
fsolve([x->1,x->3],[0.4,8]);
fsolve([x->1,x->3],[0..7,8..9]);
fsolve(x->1,0.4); #OK, returns unevaluated
fsolve([1,1],{x,y}); #OK, returns NULL

I assume that in the first two examples the criterion used is that at some point in the process the iterates [x(n+1),y(n+1)] and [x(n),y(n)] are close enough together and the difference between results from the two is small enough (clearly 0).

### Is there access to the name of an assignee in a pr...

December 13 2014
0 0

I have the following situation:

HB:=Bend(L,a,n);

Bend is a proc, that returns a Record with info based on its parameters. I would like to get access to the name I assign to (i.e. HB) in the proc. Any chance?

Mac Dude

PS: I can of course kludge things by adding an argument to the proc Bend. But I'd like to avoid that.

### Physics Simplify does not work with tensors...

December 13 2014
1 3

Good day,

I am working under paper which contains comparison of different tensor software packages focusing on the algebraic manipulations with tensors (namely Maple Physics, Mathematica xAct, Cadabra and Redberry). When doing comparison we’ve found that Maple Physics Simplify function sometimes fails to perform even trivial simplifications and almost does not work on harder examples. For example, one can easily see that all expressions below are zero while Maple Physics is unable to simplify them:

with(Physics):with(Library):Setup(spacetimeindices = lowercaselatin):

Define(A[a]):Define(B[a,b]):Define(F[a,b,c]):Define(H[a,b,c,d]):Define(J[a,b,c,d,e]):

#Does not give zero:

Simplify(J[~g,g,f,a,~f]-J[~f,f,g,a,~g]);

#Does not give zero:

Simplify(J[~f,a,b,g,c]*F[~e,f,~d]*F[e,d,~g]-J[~e,a,b,f,c]*F[~d,e,~g]*F[d,g,~f]);

#Does not give zero:

Simplify(A[c]*J[e,~h,h,i,b]*J[~d,~i,d,a,~e]-A[c]*J[d,~h,h,e,b]*J[~i,~e,i,a,~d]);

#Does not give zero:

Simplify(H[~e,b,~f,d]*J[f,c,a,~d,e]-H[~f,b,~d,e]*J[d,c,a,~e,f]);

#Does not give zero:

Simplify(F[d,~e,e]*F[~d,~f,f]-F[~e,~d,d]*F[e,~f,f]);

#Does not give zero:

Simplify(J[g,c,k,~j,~e]*H[i,h,a,~h]*H[e,b,~i,~g]*F[d,~k,j]-H[h,b,~g,~j]*F[d,~k,e]*J[j,c,k,~e,~h]*H[g,i,a,~i]);

#Does not give zero:

Simplify(B[~e,~c]*H[~f,g,c,e]*B[a,~d]*H[~g,b,f,d]-H[~f,b,g,e]*B[~d,~c]*B[a,~e]*H[~g,f,c,d]);

#Does not give zero:

Simplify(A[~c]*H[d,h,c,b]*F[~h,~d,f]*H[a,e,~e,~f]-A[~h]*H[a,c,~c,~f]*F[~e,~d,f]*H[d,e,h,b]);

I’ve attached a single Maple file with about 250 such examples (Maple18_failSimple.txt) and a file (Maple18_allSimple.txt) with 1000 simple examples I used: some of them work correctly, while some fails. All these examples perfectly work in other systems (Mathematica xAct, Cadabra and Redberry).

We use Maple18 with latests Physics package version (December 12), but we also tried latest Maple17 and other versions of Physics: none of them work. In all these examples all tensors have no symmetries, but we observe even worse results in case when tensors have symmetries (nearly all tests fail).

What is important is that when we try to test a little bit more complicated examples, which can be simplified by other packages within milliseconds, Maple Physics not able to perform basic simplification in nearly all cases. I have attached a file (Maple18_failMedium.txt with failed examples and Maple18_allMedium.txt with all examples we used) with more complicated but still simple examples (one can check each example by hand): Physics not able to simplify more than 50% of examples. Finally, I’ve attached harder examples which perfectly work in all three other systems, but none of them work in Maple Physics (Maple18_allHarder.txt).

So, my question is why Simplify is not able to perform such basic simplification of tensorial expressions? May be I miss something and I need to use another special command?

If we are using Simplify in a right way, Maple Physics can not be considered as a package for tensorial algebra (in the opposite to what is declared on the Maple website) until these basic simplification functionality will work.

PS

For generating input expressions we’ve written a little program that allows to generate random typical tensorial expressions arising in real computations (like calculation of Feynman diagrams etc.) and to run different system on such expressions in order to simplify them. Specifically we generate an expression (nested sums/products of tensors), then rewrite it in equivalent form (by renaming dummies, shuffling summands and multipliers and expand) and then subtract the result from initial expression. Obviously, simplification of such a prepared source must give zero.

Maple18_failSimple.txt

Maple18_allSimple.txt

Maple18_failMedium.txt

Maple18_allMedium.txt

Maple18_allHarder.txt

Edit: Here are some trivial examples that the latest fixed version (version 41.1 Dec/15) still fails to resolve correctly (besides Maple18_allHarder.txt that are still not working in the fixed version):

with(Physics): with(Library): Setup(spacetimeindices = lowercaselatin):

Define(A[a]):

Define(B[a,b], antisymmetric={{a,b}}):

Define(H[a,b,c,d], antisymmetric={{a,b,c,d}}):

#Does not give zero

Simplify(A[c]*B[d,~e]*B[~d,f]*H[e,~f,b,a], tryhard);

Without symmetries:

with(Physics):with(Library):Setup(spacetimeindices = lowercaselatin):

Define(A[a]):Define(B[a,b]):Define(F[a,b,c]):Define(H[a,b,c,d]):Define(L[a,b,c,d,e,f,g]):

#Does not give zero

Simplify(F[~f,~h,j]*L[~k,~i,h,k,~j,c,m]*H[e,b,a,~d]*H[d,~l,i,~e]*F[~m,f,l]-H[f,b,a,~k]*H[k,~l,j,~f]*F[~i,m,l]*L[~e,~j,d,e,~h,c,i]*F[~m,~d,h],tryhard);

etc.

Another important issue is that with the current fixed version, the time used by Simplify became unacceptably large. As in the notebook that ecterrab provided, Maple Physics takes about 20 minutes on 100 medium examples (Download Simplified100MediumExamples.mw), while other packages spend just few seconds.

We are looking forward for the future updates that will solve these issues.

### How to solve non-linear ODE numerically...

December 13 2014
2 3

Hi,

I'm trying to solve the following differential equation numerically with dsolve:

but dsolve gives me this error:

> res := dsolve(DGL, numeric, parameters = [y0, A, B, C, E]);
Error, (in DEtools/convertsys) unable to convert to an explicit first-order system

I think the problem is that I use the wrong solver. Does Maple provide a solver which is capable of solving this kind of equations (nonlinear ODE)?

### Incomplete Worksheet...

December 12 2014
2 9

Hello,

I got a message "there are problems during the loading process. Worksheet may be incomplete"

I know that looking at the file in a text editor can help, but I dont know how to recognise the problems.

It doesnt look as a problem of strange characters either...

Its a pretty long worksheet, with many important work. Any help would be higlhy appreciatd. Thanks

Here is the worksheet

FenixHPbien.mw

Vicente

### why is there Pi and pi in Maple? Why not just Pi?...

December 12 2014
0 9

one of the most confusing thing for me with learning Maple, is pi vs. Pi. I keep mixing them up since do not remember half the time which one to use.

What is the point of having both? Mathematica only has Pi. If one wants numerical value for it, simply do N[Pi] which is similar to Maple evalf(Pi).

I just spend 5 minutes trying to figure why int((sin(x))^3*sin(k*x),x=-pi..pi); was giving me

While in Mathematica it gives

Then I noticed the Pi vs. pi, and now Maple gives same output.

Why pi was even introduced? was this done early on, or added in later versions? Why not keep Pi a symbolic and with evalf it gives numerical value as with Mathematica? Also, would one use pi?  It if just symbol (evalf(pi)) does nothing, then what is its use? if I can see a good use for pi vs. Pi, may be I'll understand the logic behind this duel system.

### How can I visualise inclined circles?...

December 12 2014
1 4

Hi,

For my thesis I would like to illustrate the inclination of the solar system objects in a plane. Imagine the Solar system as a circular plane which is the average of the motions of all objects orbiting the Sun. Each individual planet/object is inclined towards this averaged plane - some more, some less. E.g. this image. Behind Neptune there lies the so-called Kuiper belt with many thousands of dwarf planets (Pluto is one of them and there are over 1000 objects known out there already). Now imagine that the big heavy Jupiter and other big planets perturb those small objects out there: so they are also inclined towards the average plane, see this image. Their inclination depends on their radial distance to the Sun (measured usually in Astronomical Units...1 unit is the distance Sun-Earth...we are talking about 40 to 50 units here). For one, I want to visualise this: imagine a circular plane and each orbit out there has another angle to the average plane. This is the first. But now: imagine the circle with it's 360°. Each object reaches it's highest point on its orbit around the Sun on another angle on this 360° circle. Neptune e.b. at 170°, Pluto at 250° etc. You get the picture. So not only are the objects in the Kuiper belt inclined differently, but their maximum orbit positions are also scattered across an imaginary 360° circle. I want to show this with a 3d-plane like this image but not with two peaks for one orbit. Is there a way to do/plot/visualise this in Maple? I am just interested in a visualisation of the principle without any empirical data behind this.

Thanks.

December 12 2014
0 1

TG.mw

### How do you close all the paragraphs in a maple wor...

December 12 2014
1 4

I use maple worksheet to organize a derivation, etc.

But most of the paragraphs and subparagraphs should normally be closed.

But after executing the file (using !!!) every paragraph is opened.

We need better ability to control the opening/closing of paragraphs.

How do I close ALL paragraphs.

Also, how do I close all TOP level paragraphs (but not subparagraphs).

Thanks, Chee

 1 2 3 4 5 6 7 Last Page 3 of 1093
﻿