nm

11353 Reputation

20 Badges

13 years, 20 days

MaplePrimes Activity


These are questions asked by nm

Why Maple gives different looking solution when calling  

dsolve(sys);

vs.

dsolve(sys,deps);

? Both solution are actually correct. But look different.  Here is an example

restart;
sys:=[
diff(x(t),t) = 2*x(t)-z(t), 
diff(y(t),t) = 2*y(t)+z(t), 
diff(z(t),t)=2*z(t),
diff(w(t),t)=-z(t)+2*w(t)];
deps:=[x(t),y(t),z(t),w(t)];

dsolve(sys);

dsolve(sys,deps);

Notice the difference:

In first case, the x(t) and y(t) solutions have 2 constants of integrations, and in the second case, they have 3 constants of integration.

If we solve this using the matrix exponential method, the solution comes out to match the first one:

A:=Matrix([[2,0,-1,0],[0,2,1,0],[0,0,2,0],[0,0,-1,2]]):
sol:=Vector([x(t),y(t),z(t),w(t)])=LinearAlgebra:-MatrixExponential(A,t).Vector([_C1,_C2,_C3,_C4]);
simplify(sol)

Again, both solution verify to 0, using odetest, and I assume now it is correct (have no reason to think odetest is not correct).

But I'd like to understand more why when passing the unknowns to dsolve, the solution comes out different looking (3 constants of integrations, vs. two in this case). Should the solution be the same looking in both cases? 

This came out, since I thought my solution was wrong, since it did not look like Maple's. 

 

Maple 2020.1

 

I'd like to plot phase plot of 2 first order ode's (along with 2 eigenvectors on same plot).

When using DEtools:-dfieldplot, the labels on the axis are not at the end, so hard to see them. Along with all the arrows, they become even harder to see.

Is it possible to have these labels (y,x) be at the ends of the axis so they are more easily seen? Here is an example below.

restart;
ode:=[diff(x(t),t) = 2*x(t)-y(t), diff(y(t),t) = 3*x(t)-2*y(t)]:
p1:=DEtools:-dfieldplot(ode,[x(t),y(t)],t=-2..2,x=-4..4, y=-4..4,arrows=SLIM,color=coral):
p2:=plot(3*x,x=-4..4,y=-4..4,color=magenta):
p3:=plot(x,x=-4..4,y=-4..4,color=blue):
plots:-display([p1,p2,p3]);

I looked at help, plot options, but do not see how to do it so far. I can change the font of the label and the font size, but I want to change the location to be at the end.

Maple 2020.1

 

I am porting some code I have  from Mathematica to Maple. 

In Mathematica, there is a command https://reference.wolfram.com/language/ref/CopyDirectory.html  which copies directory tree (i.e. the directory and everything below it) to a new location on the file system.

I looked at FileTools, and the Copy command there only works on files, not Directories.

"An exception is raised if source is a directory."

There must be a command in Maple to do this basic operation, but I am not able to find it. I googled.

Note: I do not want to rename the directory, but to copy it.

I could ofcourse work around this by writing code or calling system, but I would expect Maple to have a command for this somewhere.

 

 

Is there a way to find what changed in each Physics update? Even if it is just one or two lines short summary? I am not able to find how to do this.

For example, after doing Physics:-Version(latest); and getting a new version, how to find what was fixed/added to new version?

There is a page in help titled "Overview of the Physics Updates" but I am asking about what specific change made in each update and not as general overall description as the above page talks about.

Again, even if the changes are short, it will be nice to know what changed each time.  

 

Does Maple have any faciltiy to find any solution to two equations in  3 variables subject to constraint that each equation is not zero?

Here is an example. I like to find any values of t1,t2,t3 such that alpha and beta are not zero. Any choice of such t's will do. But not all can be zero ofcourse. All the t's are linear.

restart;
eq1:= alpha = -2*t1 - 4*t2 - 2*t3;
eq2:= beta = t1 + 2*t2 + t3;

By inspection we see that choice t2=0,t3=0,t1=1 works since

subs([t2=0,t3=0,t1=1],[eq1,eq2])

There are many other choices (infinite). I just need to find one combination of t_i in the integers.

I could write a loop and keep trying different values of t1,t2,t3 until I find such choise ofcourse. But I was wondering if there is better way to do this in Maple. Solve does not work on this ofcourse.

solve([eq1,eq2,eq3],[t1,t2,t3]) assuming alpha<>0,beta<>0

And setting up Ax=b does not work

restart;
A:=Matrix([[-2,-4,-2],[1,2,1]]);
b:=Vector([alpha,beta]);
LinearAlgebra:-LinearSolve(A,b)

Error, (in LinearAlgebra:-LinearSolve) inconsistent system
 

However, one thing I could do, is pick random alpha,beta values, and then solve for t_i, as in

restart;
A:=Matrix([[-2,-4,-2],[1,2,1]]);
b:=Vector([-2,1]);
LinearAlgebra:-LinearSolve(A,b)

And now I am able to find a solution I want. The problem with this method, is that if I pick wrong values of alpha,beta, I can also get no solution. For example, if I guessed alpha=1,beta=1 I get

restart;
A:=Matrix([[-2,-4,-2],[1,2,1]]);
b:=Vector([1,1]);
LinearAlgebra:-LinearSolve(A,b)

Error, (in LinearAlgebra:-LinearSolve) inconsistent system
 

So one option I could try, is pick random values of alpha,beta, and call LinearSolve until I get a choice which works?  i.e. one which does not give inconsistent system.

Thanks for any better suggestions.

First 111 112 113 114 115 116 117 Last Page 113 of 199