MaplePrimes Questions

Dear all,

the BlockCopy command is a miracle for me that I don't understand. Is there an easier command or an easy to understand documentation?

Thanks

Dear all, I'm new with maple. How can I extend an existing matrix?

XX := Matrix(2, 4, [[1, 1, 1, 1], [2, 2, 2, 2]])

extend(XX,1,0,0) # doesn't work

Thanks for help

I am trying to solve several problems of  solving  around 200 undetermined variables out of a set of aroud 300 2nd-order equations (such as a*b=c).

I just use "solve" command.

1. Maple continuingly evaluates and does not return result, how to make it work? 

2. In some problems, i have results, but there are great of freedom, which i want to restrict them in some way.

As the following worksheet shows, 
 

restart

kernelopts('version');

Physics:-Version();

`Maple 2024.0, X86 64 WINDOWS, Mar 01 2024, Build ID 1794891`

`The "Physics Updates" version in the MapleCloud is 1732 and is the same as the version installed in this computer, created 2024, April 12, 17:58 hours Pacific Time.`

with(RealDomain):

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 + y**2, x1**2 + y1**2, x2**2 + y2**2, x3**2 + y3**2 |
     x, x1, x2, x3 |
     y, y1, y2, y3 |
     1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/MTM:-det(<
  x1, x2, x3 |
  y1, y2, y3 |
  1, 1, 1
 >): simplify(`%`);

-(1/4)*(x1^2-2*x1*x2+x2^2+(y1-y2)^2)*(x2^2-2*x2*x3+x3^2+(y2-y3)^2)*(x1^2-2*x1*x3+x3^2+(y1-y3)^2)

eval(MTM:-det(<
   a, b/2, d/2 |
   b/2, c, e/2 |
   d/2, e/2, f
  >), PDETools:-Solve(MTM:-det(<
     x**2 - y**2, x1**2 - y1**2, x2**2 - y2**2, x3**2 - y3**2, x4**2 - y4**2 |
     x*y, x1*y1, x2*y2, x3*y3, x4*y4 |
     x, x1, x2, x3, x4 |
     y, y1, y2, y3, y4 |
     1, 1, 1, 1, 1
    >) = inner([a, b, c, d, e, f], [x**2, x*y, y**2, x, y, 1]),
   {f, e, d, c, b, a}, 'independentof' = {y, x}))/(MTM:-det(<
   x2, x3, x4 | 
   y2, y3, y4 | 
   1, 1, 1
  >)*MTM:-det(<
   x3, x4, x1 | 
   y3, y4, y1 | 
   1, 1, 1
  >)*MTM:-det(<
   x4, x1, x2 | 
   y4, y1, y2 | 
   1, 1, 1
  >)*MTM:-det(<
   x1, x2, x3 | 
   y1, y2, y3 | 
   1, 1, 1
  >)): simplify(`%`);

(1/4)*((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4))*((x3-x4)*x1+(x4-x3)*x2+(y3-y4)*(y1-y2))*((x2-x4)*x1-x2*x3+x3*x4+(y2-y4)*(y1-y3))


 

Download Why_not_consider_subexpressions?.mw

the underlined part is evidently not the simplest. (For instance, shouldn't RealDomain:-simplify(x2^2 - 2*x2*x3 + x3^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2-x3)*x1-x2*x4+x3*x4+(y2-y3)*(y1-y4), 'size') be converted into RealDomain:-simplify((x2 - x3)^2 + (y2 - y3)^2, 'size') and RealDomain:-simplify((x2 - x3)*(x1 - x4) + (y2 - y3)*(y1 - y4), 'size')?) 
If I understand correctly, , by default, should try combining every part of an expression with every other to apply a vast range of potential transformations to look at many different forms of it and make progress in picking out the simplest possible one. So, why is simplify unable to touch certain sub-expressions when they are encountered at intermediate stages in a computation? 

I have a double for loop which has a numeric integration located inside of the innermost loop. When I try to run my worksheet I recieve an error in which the numeric integration is not computed for a certain set of values in my loops. If I take these two values and input them into my function and then integrate outside of the loop it appears to work just fine. Not sure what to make of this. Any thoughts would be appreciated. 

Secondly, to avoid any confusion about what I am trying to do and if someone has general comments on my worksheet I added some text in the worksheet to describe what I am interested in doing, even though I am sure most people here would be able to figure that out from the commands alone. 

Thanks. 

LoopError.mw

Could someone be able to spot why I get different solution when solving for the constant of integration from this Maple dsolve solution manually than when asking Maple to do it directly?

This is the ode 

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

If I ask Maple to solve it with the IC all at once, it gives solution which odetest verifies OK.

If I ask Maple to solve it with no IC, then solve the constant myself and plug the constant back into the solution I get solution which does not verify any more.

I am not able to find why. Could someone spot the error in this? Please see worksheet below. I suspect the problem is when plugging back the constant of integration into the general solution, but have no idea now what it is. Clearly Maple did something much smarter than what I did by just plugging the constant back into the solution. May be need to specify what branch to use when plugging the constant back? but how do I know which one?
 

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1730 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

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

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

y(1) = 1

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

sol_with_IC_direct:=dsolve([ode,ic]);
odetest(sol_with_IC_direct,[ode,ic]);

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

[0, 0]

#this verifies Maple found correct constant also:

solve(rhs(sol_with_IC_direct)=rhs(sol_no_IC),c__1)

1/2

#now solve for constant of integration manually. This gives invalid solution. Why?

eq:= 1=limit(rhs(sol_no_IC),x=1);

1 = -LambertW(-exp(-2)/c__1)-1

PDEtools:-Solve(eq,c__1);

c__1 = 1/2

sol_with_ic:=eval(sol_no_IC,%)

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

odetest(sol_with_ic,[ode,ic]);

[0, 2+LambertW(-2*exp(-2))]

 

 

Download why_wrong_solution.mw

How to show that any Pythagorean triplet can be obtained from <3,4,5> ? Thank you.
Can we simplify this program?

#Génération Géométrique et Algébrique des triplets Pythagoriciens
restart;
with(geometry);
with(LinearAlgebra);
_EnvHorizomtalName = 'x';
_EnvVerticalName = 'y';

with(plottools);
P := point([0, 0], color = black, symbol = cross, symbolsize = 25);
Oo := point([1/2, 1/2], color = black, symbol = cross, symbolsize = 25);
A := point([1, 1/2], color = black, symbol = cross, symbolsize = 25);
with(plots);
c1 := circle([1/2, 1/2], 1/2, color = blue);
NULL;
PA := line([0, 0], [1, 1/2], color = red);
eqC := (x - 1/2)^2 + (y - 1/2)^2 = 1/4;
eqPA := y = 1/2*x;
sol := solve({eqC, eqPA}, {x, y});

t1 := textplot([0, 0, 'typeset'("P"), font = [Times, Bold, 14]], 'align' = 'above');
t2 := textplot([1, 1/2, 'typeset'("A"), font = [Times, Bold, 14]], 'align' = 'right');
t3 := textplot([1/5, 1/10, 'typeset'("A'"), font = [Times, Bold, 14]], 'align' = 'above');
A1 := point([1 - 1/5, 1/10], color = black, symbol = cross, symbolsize = 25);
diff(A, x) := point([1/5, 1/10], color = black, symbol = cross, symbolsize = 25);
t4 := textplot([1 - 1/5, 1/10, 'typeset'("A1"), font = [Times, Bold, 14]], 'align' = 'right');
A2 := point([1 - 1/5, 1 - 1/10], color = black, symbol = cross, symbolsize = 25);
t5 := textplot([1 - 1/5, 1 - 1/10, 'typeset'("A2"), font = [Times, Bold, 14]], 'align' = 'right');
A3 := point([1/5, 1 - 1/10], color = black, symbol = cross, symbolsize = 25);
t6 := textplot([1/5, 1 - 1/10, 'typeset'("A3"), font = [Times, Bold, 14]], 'align' = 'right');

poly := Matrix([[1/5, 1/10], [1 - 1/5, 1/10], [1 - 1/5, 1 - 1/10], [1/5, 1 - 1/10]], datatype = float);
pol := polygonplot(poly, color = blue, transparency = 0.95);

display(c1, P, Oo, A, PA, seq(A || i, i = 1 .. 3), seq(t || i, i = 1 .. 6), pol, scaling = constrained, axes = none, size = [600, 600]);

R1 := Transpose(<<1, -2, 2> | <2, -1, 2> | <2, -2, 3>>);
R2 := Transpose(<<1, 2, 2> | <2, 1, 2> | <2, 2, 3>>);
R3 := Transpose(<<-1, 2, 2> | <-2, 1, 2> | <-2, 2, 3>>);
V := <3, 4, 5>;
MatrixVectorMultiply(R1, V);
MatrixVectorMultiply(R2, V);
MatrixVectorMultiply(R3, V);
t1 := <2225, 3648, 4273>;
t2 := MatrixVectorMultiply(1/R1, t1);
t3 := MatrixVectorMultiply(1/R3, t2);
t4 := MatrixVectorMultiply(1/R2, t3);
t5 := MatrixVectorMultiply(1/R1, t4);
t6 := MatrixVectorMultiply(1/R3, t5);
MatrixVectorMultiply(MatrixMatrixMultiply(MatrixMatrixMultiply(MatrixMatrixMultiply(MatrixMatrixMultiply(R1, R3), R2), R1), R3), V);
% - t1;
NULL;
 

The question is not at all from me, but, probably, one might say, from the authors of this publication.  interesting_system.pdf

Just for fun.
Find all real solutions to this 2x2 system of nonlinear equations in any given domain. 

f1:=x1-x1*sin(x1+5x2)-x2*cos(5x1-x2);
f2:=x2-x2*sin(5x1-3x2)+x1*cos(3x1+5x2);


 


 

 

In my view, <x || (1 .. 2); y || (1 .. 2); 1 $ 2> should return a Matrix without any error messages; however, 

<x || (1 .. 2); y || (1 .. 2); 1 $ 2>; # Arguments are shielded??? 
Error, (in Matrix) this entry is too wide or too narrow: 1

If I understand right, each argument of a function is evaluated in turn (unless the modifier is used). 
So why is it not equivalent to <x1, x2; y1, y2; 1, 1>

 

As I learned here Maple is also a multi-paradigm programming language.

I was wondering how Maple compares in this chart.

Even though I am not a computer scientist, I would say that Maple is on a par with the number one (not sure about pipelines).

Would this claim be correct?

Hello everyone,

I'm using Maple 18. I have a problem that I can't solve. It concerns the programmatic - from the Maple code level - export of animations (even single images) with good quality graphics, i.e. either high resolution or "large" size - which translates into the same. This is because Maple 18 does not have a size option in plot3d.

Even manually enlarged graphics - a bit too much, makes manual export impossible; Maple reports "..the file could not be created...". Most often, this ends with the creation of a gif file with a capacity of 0 bytes.

I am asking for help if anyone knows how to deal with this [normal export of "normal" graphics manually or with software can of course be done in Maple 18].

Regards.

Through the years I basically had to work with the fact that Maple prefers to express results in terms on Cos^2(x) and not Sin^2(x).

With older Maple versions there was never a workaround by means of a command that would convert an expression in terms of sin^2(x) if Maple expressed it as cos^2x.

Is there any way in the newer Maple versions to convert output to be expressed rather as sin(x).

It becomes a bit old, to always substitute the identitity manually to convert.

Any easy way  for this in new versions.

I have a table indexed as A[i][j,k],  Each entry is an expression involving diff which I want to convert to but convert(A,D) doesn't work. Any suggestions on how to do that?

restart;

for i from 1 to 2 do
  for j from 1 to 2 do
    for k from 1 to 2 do
      A[i][j,k] := diff(u[i](x[1],x[2]), x[j], x[k]);
    end do
  end do;
end do;

A[1][1,1];

diff(diff(u[1](x[1], x[2]), x[1]), x[1])

print(A);

A

 
 

Download convert-table.mw

 

I am trying to find the minimum values of a table, but not of all of its indices, just some that comply to a certain pattern.

The minimum of the values of a table are found by using min(entries(atable)).

If the indices of atable are "a1", "a2", "b1", "b2", I would like to just have the ones starting with "a".

Can be done by a loop, but is there a easier way?

I any trying to seperate the real and imaginary components but they are mixed up inside and outside a square root.

Their seems to be a problem displaying the worksheet.

restart



expand((a+I*b)*(a-I*b))
(a+I*b)+(a-I*b)
# z = x *Iy    I need to seperate out solution to [x,y] & [x,-y]
#https://math.stackexchange.com/questions/44391/foci-of-a-general-conic-equation
eq := T*z^2 - (R + S*I)*z +G-K + H*I
sol:=solve(eq,z)
expand(sol[1]*sol[2])=a^2+b^2
simplify(sol[1]+sol[2]=2*a)
simplify(sol[1]-sol[2]=2*b)

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/2024-04-20_Q_Seperate_Real_&_Imaginary.mw .

Download 2024-04-20_Q_Seperate_Real_&_Imaginary.mw

First 98 99 100 101 102 103 104 Last Page 100 of 2414