Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I have a matirx

where ci and si represent cos(θi) and sin(θi), respectively. I need to substitute

What is the right way of using trigsubs command?

 

Why when I write (9b2 - r2 - a2 cos(theta)2)2 maple changes to (r2+ a2 cos(theta)2 - 9b2)2 ? Would anyone know how to block this change?

Thanks!

write a maple script to find the relation on set s is

1)reflexsive

2)symmetric

3)trasitive

 

How do I change my input of variable current, I1, to I, without violating the imaginary unit?

S

 

After waiting about six hours for the worksheet to be executed, I finally lost hope and stopped it. (My CPU usage was stuck on 100% the whole time and I almost ran out of memory) Is this evaluation time normal and should I have waited longer, or is there a problem with my worksheet? (I'm uploading it here) Or is it possible that the equation cannot be solved by Maple at all?

parasitic.mw

I submit a bug through MaplePrimes because I can't do it as usually (Hope some people understand me.). Let us consider

with(LinearAlgebra):
M := Matrix(5, 5,  (i, j) -> (10*i+j)*sin((1/180)*Pi*(10*i+j))):
MatrixInverse(M);
 #One sees a long and wrong output instead of the warning "Matrix M is singular"

Indeed,

Digits := 500; evalf(Determinant(M), 495);
                               
                           1.3 10 ^(-488)   

Bug_in_MatrixInverse.mw

I submit a bug through MaplePrimes because I can't do it as usually (Hope some people understand me.). Let us consider

restart; pdsolve([diff(u(t, x), t, t) = diff(u(t, x), x, x), u(t, 0) = 0, u(t, Pi) = 0]);
pdsolve([diff(u(t, x), t, t) = diff(u(t, x), x, x), u(t, 0) = 0, u(t, Pi) = 0], generalsolution);
u(t, x) = Sum(sin(n*x)*(_C5(n)*cos(n*t)+_C1(n)*sin(n*t)), n = 1 .. infinity)
u(t, x) = Sum(sin(n*x)*(_C5(n)*cos(n*t)+_C1(n)*sin(n*t)), n = 1 .. infinity)

The question arises: what do these outputs mean? I don't see any explanation in ?pdsolve and ?examples,pdsolve_boundaryconditions. What are _C1(n) and _C5(n)? Under which conditions does the above series converge?

Moreover,

pdetest(%, [diff(u(t, x), t, t) = diff(u(t, x), x, x), u(t, 0) = 0, u(t, Pi) = 0]);
                           [0, 0, 0]

I think the above is simply a fake: it is possible to differentiate  a series only under certain conditions.

Bug_in_pdsolve.mw

Please, don't convert my post to a question. This is not correct and fair. Hope some people understand me.

how dsolve differential equations?

ta.mw

Hi all,

I have a system of 18 polynomial equations (and 18 variables).

The polynomials are of second degree (meaning, every polynomial has at most multiplications of two different variables or a single variable squared).

My goal is to be able to solve the polynomials by getting ALL the possible solutions.

For now, when I use the solve command, Maple is trying to solve and never returns the solutions to the equations (I stopped after 3 hours).

But when I use fsolve, Maple returns a single solution (immediately) which is sometimes the solution I expected to get but not always.

If I don't get the solution I expected to get, I call fsolve again but this time with the 'avoid' option in order not to get the same solution again. that way if I use 'fsolve' about 3 times I get the solution I expected to get in most cases. but still not always.

My question, since the equations are polynomials, is there a way to tell Maple to solve the equations in a more efficient way so that I will get ALL the possible solutions? (when I use the 'solve' command I don't tell Maple in any way that the equations are polynomials). or any other way to get all the solutions (I'm new with Maple so maybe there are other commands that I don't know about and can give me all the solutions).

btw, I need only the real solutions. I don't need the complex solutions if exist.

 

I wrote bellow an example of the code in Maple with the equations that I'm trying to solve (note that I use fsolve twice but only in the second time I get the solutions I expected to get).

The 'h' function in the code looks extermely long but I don't try to solve 'h' in the fsolve command. only the g1* and diff_r1* and diff_t1* functions (which are much shorter than 'h').

I will appreciate any help.

Thanks!

Here is the code:

restart;
g1_1_1:=r1__1_1^2+r1__1_2^2+r1__1_3^2-1;
g1_1_2:=r1__1_1*r1__2_1+r1__1_2*r1__2_2+r1__1_3*r1__2_3;
g1_1_3:=r1__1_1*r1__3_1+r1__1_2*r1__3_2+r1__1_3*r1__3_3;
g1_2_2:=r1__2_1^2+r1__2_2^2+r1__2_3^2-1;
g1_2_3:=r1__2_1*r1__3_1+r1__2_2*r1__3_2+r1__2_3*r1__3_3;
g1_3_3:=r1__3_1^2+r1__3_2^2+r1__3_3^2-1;
h:=(-.992492661403*r1__1_1+12.3284921161777*r1__1_2+7.57084655768457*r1__1_3+.324267866473309*t11+.0749281794197556+1.09088742857604*r1__2_1-13.5507269559957*r1__2_2-8.32141299937268*r1__2_3-.356415470609132*t12+.928796854654334*r1__3_1-11.5372789567796*r1__3_2-7.08496771958172*r1__3_3-.303457129743798*t13)^2+(-2.48532903781461*r1__2_1+30.87212696684*r1__2_2+18.958371709801*r1__2_3+.81200836636144*t12-.197547504455846+1.09088742838705*r1__1_1-13.550726959431*r1__1_2-8.32141299910563*r1__1_3-.356415470592923*t11+.48989466626242*r1__3_1-6.08534729180524*r1__3_2-3.73697206129778*r1__3_3-.160058713114523*t13)^2+(-2.6436153220831*r1__3_1+32.8383190443191*r1__3_2+20.1657974352703*r1__3_3+.863723767113888*t13+.0651743072009662+.928796854295815*r1__1_1-11.5372789582423*r1__1_2-7.08496772054044*r1__1_3-.303457129759512*t11+.48989466615819*r1__2_1-6.08534729103406*r1__2_2-3.73697206192339*r1__2_3-.160058713130091*t12)^2+(-3.0453012837136*r1__1_1+28.3453761824993*r1__1_2+20.6329645159026*r1__1_3+.803383631995274*t11+1.1433809887851+.588739190174359*r1__2_1-5.47992867285244*r1__2_2-3.98891068120136*r1__2_3-.15531580779083*t12+1.38673265028867*r1__3_1-12.9075762854695*r1__3_2-9.39559107531887*r1__3_3-.365835170130537*t13)^2+(-3.32552348095664*r1__2_1+30.9536578751004*r1__2_2+22.5315663656812*r1__2_3+.877309298336102*t12-1.987216561269+.588739190114314*r1__1_1-5.47992866961904*r1__1_2-3.98891068053918*r1__1_3-.155315807786897*t11+1.09544034380124*r1__3_1-10.1962550610257*r1__3_2-7.42198542424216*r1__3_3-.28898908845837*t13)^2+(-1.21036350562772*r1__3_1+11.2659489790199*r1__3_2+8.20062940888435*r1__3_3+.319307069650757*t13+.229170772052734+1.38673265024704*r1__1_1-12.9075762829888*r1__1_2-9.39559107412026*r1__1_3-.365835170095885*t11+1.09544034388008*r1__2_1-10.1962550650824*r1__2_2-7.4219854245274*r1__2_3-.288989088438315*t12)^2+(-5.95351974815554*r1__1_1+36.6994162407641*r1__1_2+25.4290813546269*r1__1_3+.974842575637377*t11-2.63695732507178+.0862138869060729*r1__2_1-.531450210031119*r1__2_2-.368242659171055*r1__2_3-.0141168537454004*t12+.952506399264142*r1__3_1-5.87155670816424*r1__3_2-4.06841057826005*r1__3_3-.155965518005519*t13)^2+(-6.05878205069695*r1__2_1+37.3482870296174*r1__2_2+25.8786849115508*r1__2_3+.992078459354551*t12-1.33152058265882+.0862138869007144*r1__1_1-.531450210081823*r1__1_2-.368242659219069*r1__1_3-.0141168537421636*t11+.534490070726969*r1__3_1-3.29476921378019*r1__3_2-2.28295060211721*r1__3_3-.087518593905657*t13)^2+(-.202018537282116*r1__3_1+1.24530743607334*r1__3_2+.862875410606218*r1__3_3+.0330789650607677*t13+.545863834860738+.952506399246256*r1__1_1-5.87155670833708*r1__1_2-4.06841057735347*r1__1_3-.155965517969505*t11+.534490070750153*r1__2_1-3.29476921356283*r1__2_2-2.28295060131082*r1__2_3-.0875185939055155*t12)^2+(-6.07959771459677*r1__1_1+30.9674242426801*r1__1_2+22.3705097998352*r1__1_3+.857873368534317*t11-1.76471733145788+1.65075563468967*r1__2_1-8.40839352379239*r1__2_2-6.07412642093546*r1__2_3-.232933059628316*t12+1.84351225448619*r1__3_1-9.39023086096381*r1__3_2-6.78339437706986*r1__3_3-.260132354459928*t13)^2+(-4.38138073503315*r1__2_1+22.3172786035824*r1__2_2+16.1217444412232*r1__2_3+.618243184218713*t12-.923385301124302+1.65075563490521*r1__1_1-8.40839352323243*r1__1_2-6.07412642020582*r1__1_3-.232933059620808*t11+3.02135458680454*r1__3_1-15.3897632163199*r1__3_2-11.1173872944915*r1__3_3-.426334069877298*t13)^2+(-3.71266987086301*r1__3_1+18.9110905602843*r1__3_2+13.6611535221535*r1__3_3+.523883447195053*t13+1.79101248019951+1.84351225469879*r1__1_1-9.39023085830571*r1__1_2-6.78339437737683*r1__1_3-.260132354453603*t11+3.02135458675847*r1__2_1-15.3897632129884*r1__2_2-11.1173872963301*r1__2_3-.426334069880672*t12)^2+(-3.90011435645636*r1__1_1+33.4181858543797*r1__1_2+19.9362529914774*r1__1_3+.790634768245585*t11-3.40601893140435+1.48764430833506*r1__2_1-12.7469016125627*r1__2_2-7.60440607186657*r1__2_3-.301576621987651*t12+1.34716650703029*r1__3_1-11.5432155550731*r1__3_2-6.88632430891628*r1__3_3-.273098832924476*t13)^2+(-2.79003782913976*r1__2_1+23.9064791937414*r1__2_2+14.261863864387*r1__2_3+.565599033947199*t12+2.94191879923881+1.48764430859128*r1__1_1-12.7469016146313*r1__1_2-7.6044060696602*r1__1_3-.301576621995954*t11+1.94050330636006*r1__3_1-16.6272304379243*r1__3_2-9.91928987276943*r1__3_3-.393380614413616*t13)^2+(-3.17562785143546*r1__3_1+27.2104128357136*r1__3_2+16.2328881834776*r1__3_3+.643766197822571*t13-.637542053291817+1.34716650724399*r1__1_1-11.5432155571023*r1__1_2-6.88632430841617*r1__1_3-.273098832949826*t11+1.94050330633365*r1__2_1-16.627230438149*r1__2_2-9.91928987492707*r1__2_3-.3933806144393*t12)^2+(-2.01324057094153*r1__1_1+40.4637240018238*r1__1_2+19.1624249532275*r1__1_3+.995107416713897*t11+1.84529512341763+.0539908034671229*r1__2_1-1.08515047907221*r1__2_2-.513895226737029*r1__2_3-.0266866512328603*t12+.130433143363034*r1__3_1-2.62154994723571*r1__3_2-1.24148865078056*r1__3_3-.0644706798567015*t13)^2+(-1.72864549456945*r1__2_1+34.7437038570169*r1__2_2+16.453592301917*r1__2_3+.854437357037078*t12+1.26622268071142+.0539908034660728*r1__1_1-1.08515047910239*r1__1_2-.513895226549678*r1__1_3-.026686651233501*t11+.711449065385413*r1__3_1-14.2992740321447*r1__3_2-6.77171397936849*r1__3_3-.351656057242671*t13)^2+(-.304391827618365*r1__3_1+6.11791114030412*r1__3_2+2.89726208101195*r1__3_3+.150455226223174*t13-.664170181540941+.130433143328345*r1__1_1-2.62154994715954*r1__1_2-1.24148865060744*r1__1_3-.0644706798534696*t11+.711449065210039*r1__2_1-14.2992740313315*r1__2_2-6.77171398089296*r1__2_3-.3516560572166*t12)^2+(-.554028798262323*r1__1_1+16.4352774899688*r1__1_2+12.212735424138*r1__1_3+.451248010725026*t11+1.80668680530669+.561213036138882*r1__2_1-16.6483980707805*r1__2_2-12.3711011963105*r1__2_3-.457099462951262*t12+.241478758779813*r1__3_1-7.16347312712678*r1__3_2-5.32303772144054*r1__3_3-.19668076798868*t13)^2+(-.760290795908938*r1__2_1+22.5540445569422*r1__2_2+16.7594723669968*r1__2_3+.619245263577858*t12-.547959274703874+.561213036185506*r1__1_1-16.6483980712546*r1__1_2-12.3711011949445*r1__1_3-.457099462966984*t11+.201146990103896*r1__3_1-5.96703024933782*r1__3_2-4.43398426133857*r1__3_3-.163831157208818*t13)^2+(-1.14122053061752*r1__3_1+33.854334200315*r1__3_2+25.1564980835807*r1__3_3+.929506725704928*t13-3.76727778582615+.241478758813686*r1__1_1-7.16347312565607*r1__1_2-5.32303772203581*r1__1_3-.196680768005511*t11+.201146990115401*r1__2_1-5.96703024794285*r1__2_2-4.43398426232404*r1__2_3-.163831157217202*t12)^2+(-4.02477735374144*r1__1_1+27.7950101802505*r1__1_2+21.425586834354*r1__1_3+.78027956702849*t11+.221994737480659+1.24285496385638*r1__2_1-8.5831248120031*r1__2_2-6.61624099843662*r1__2_3-.24095105086973*t12+1.73688577463857*r1__3_1-11.9948890468077*r1__3_2-9.24617530570086*r1__3_3-.336728310946364*t13)^2+(-3.7951756300308*r1__2_1+26.2093865067395*r1__2_2+20.2033200543809*r1__2_3+.735766910103154*t12-.764444377219279+1.2428549639263*r1__1_1-8.58312481092265*r1__1_2-6.61624100152625*r1__1_3-.240951050879308*t11+1.90471339873406*r1__3_1-13.1539023563811*r1__3_2-10.1395925103233*r1__3_3-.369264884863308*t13)^2+(-2.49629140831476*r1__3_1+17.2393250571566*r1__3_2+13.2888116882479*r1__3_3+.483953522844612*t13+.402154769245324+1.73688577506273*r1__1_1-11.9948890436773*r1__1_2-9.24617530885054*r1__1_3-.336728310949967*t11+1.90471339909204*r1__2_1-13.153902354604*r1__2_2-10.1395925090424*r1__2_3-.36926488485258*t12)^2+(r1__1_1^2+r1__1_2^2+r1__1_3^2-1)*b1__1_1+(r1__1_1*r1__2_1+r1__1_2*r1__2_2+r1__1_3*r1__2_3)*b1__1_2+(r1__2_1^2+r1__2_2^2+r1__2_3^2-1)*b1__2_2+(r1__1_1*r1__3_1+r1__1_2*r1__3_2+r1__1_3*r1__3_3)*b1__1_3+(r1__2_1*r1__3_1+r1__2_2*r1__3_2+r1__2_3*r1__3_3)*b1__2_3+(r1__3_1^2+r1__3_2^2+r1__3_3^2-1)*b1__3_3;
diff_t11:=diff(h,t11);
diff_t12:=diff(h,t12);
diff_t13:=diff(h,t13);
diff_r1__1_1:=diff(h,r1__1_1);
diff_r1__2_1:=diff(h,r1__2_1);
diff_r1__3_1:=diff(h,r1__3_1);
diff_r1__1_2:=diff(h,r1__1_2);
diff_r1__2_2:=diff(h,r1__2_2);
diff_r1__3_2:=diff(h,r1__3_2);
diff_r1__1_3:=diff(h,r1__1_3);
diff_r1__2_3:=diff(h,r1__2_3);
diff_r1__3_3:=diff(h,r1__3_3);
with(Groebner):
with(RealDomain):
sols:=fsolve({g1_1_1,g1_1_2,g1_1_3,g1_2_2,g1_2_3,g1_3_3,diff_t11,diff_t12,diff_t13,diff_r1__1_1,diff_r1__1_2,diff_r1__1_3,diff_r1__2_1,diff_r1__2_2,diff_r1__2_3,diff_r1__3_1,diff_r1__3_2,diff_r1__3_3},{ t11, t12, t13, r1__1_1, r1__1_2, r1__1_3, r1__2_1, r1__2_2, r1__2_3, r1__3_1, r1__3_2, r1__3_3, b1__1_1, b1__1_2, b1__1_3, b1__2_2, b1__2_3, b1__3_3} );
with(Groebner):
with(RealDomain):
sols:=fsolve({g1_1_1,g1_1_2,g1_1_3,g1_2_2,g1_2_3,g1_3_3,diff_t11,diff_t12,diff_t13,diff_r1__1_1,diff_r1__1_2,diff_r1__1_3,diff_r1__2_1,diff_r1__2_2,diff_r1__2_3,diff_r1__3_1,diff_r1__3_2,diff_r1__3_3},{ t11=0.184015, t12=0.087459, t13=0.308915, r1__1_1=0.230878, r1__1_2=0.909187, r1__1_3=0.936884, r1__2_1=0.031879, r1__2_2=0.593647, r1__2_3=0.043818, r1__3_1=0.424903, r1__3_2=0.521581, r1__3_3=0.840339, b1__1_1=0.625030, b1__1_2=0.255205, b1__1_3=0.904691, b1__2_2=0.767301, b1__2_3=0.562666, b1__3_3=0.897154}, avoid={{b1__1_1 = -32.51343311, b1__1_2 = 43.92451284, b1__1_3 = 22.91611840, b1__2_2 = -6.848329887, b1__2_3 = 16.30411571, b1__3_3 = -13.09739229, r1__1_1 = .5873876993, r1__1_2 = -.8092603402, r1__1_3 = -.8566942425e-2, r1__2_1 = .2869971672e-1, r1__2_2 = .1024997381e-1, r1__2_3 = .9995355243, r1__3_1 = -.8087966474, r1__3_2 = -.5873607408, r1__3_3 = .2924625105e-1, t11 = 36.59195193, t12 = -22.18329766, t13 = 22.31332161}} );

I am beginning to study Special Relativity and Classical Field Theory - The Theoretical Minimum by Leonard Susskind and Art Friedman.

The book's notation for a 4-Vector is X superscript mu. Its components are X superscripts 0, 1, 2 and 3 which, in sequence, refer to t(ime), x, y and z.

Proper time, tau, is defined using these vector components in that sequence.

The book's notation for 4-Velocity is U superscript mu with components U superscripts 0 thru 3. U superscript zero is defined to be the derivative of X superscript zero with respect to tau i.e. dt/dtau and the remaining U components follow this pattern.

As a beginner in this area, which Maple packages/commands would most easily and clearly implement this notation in a Maple worksheet? 

Consider the following anticommutators:

with(Physics):
Simplify(AntiCommutator(Dgamma[1],Dgamma[1])),
Simplify(AntiCommutator(Dgamma[1],Dgamma[2]));

Being basic Clifford algebra, I wonder why Physics does not know that the second one should simplify to zero.

PS: Just to be sure, I have updated to Maple 2017.3 today.

restart;

eq1 := a[n+2]+4*a[n+1]+10*a[n]-5*n-1;

applyrule(a[n::anything] = n*p+q+b[n], eq1);

eq2 := a(n+2)+4*a(n+1)+10*a(n)-5*n-1;

applyrule(a(n::anything) = b(n)+n*p+q, eq2);

eq3 := a(n+2)+4*a(n+1)+10*a(n) = 5*n+1;

applyrule(a(n::anything) = b(n)+n*p+q, eq3)

 

So my question is: Why does the first one not work? the second one works as expected, but the third one again does not?!

CodeGeneration returns round brackets when converting a matrix to numpy. According to Python syntax it should return square brackets. I am using Maple 18, so maybe this issue has been solved in more recent releases.

MWE

----------------
>restart:
>with(CodeGeneration):
>QLoc:=proc()
local Q:
Q:= Matrix(2,2):
Q(1,1) := 1E5:
Q(2,2) := 1E4:
Q(1,2) := 1E3:
Q(2,1) := 1E3:
return Q:
end proc:
 

>Python(QLoc);

import numpy

def QLoc ():
    Q = numpy.mat([[0,0],[0,0]])
    Q(1, 1) = 0.1e6
    Q(2, 2) = 0.1e5
    Q(1, 2) = 0.1e4
    Q(2, 1) = 0.1e4
    return(Q)

------------

Hey all Maple experts, Kris here!

I could really use some help/clarfication on what is going on with alias, diff, and pointers for vectors.

A short description of what I want to do:
I have 4 equations with 4 variables. The first two equations and variables (1 and 2) are called private, and the last two (3 and 4) are called common. I want to establish an implicit dependence of common on private, namely that the private variables 1 and 2 depend on 3 and 4. Then I want to derivate the private equations with respect to the common variables.

Thus, I create pointers that point to the correct private or common equation or variables with the loop.
for i from 1 to 2 do
iP[i]:=i:
iC[i]:=i+2;
od:

So that for example, a set of four equations named "phi" phi[1..4] where phi[iP[1]] is the first private equation, and phi[iC[1]] is the first common equation. Hopefully so far I have been clear. I create an alias, and continue to derivate these equations. However, I notice that Maple does not recognize the functions in the diff command if the "pointer" notation is used. I will paste the entire code for you all to look at and maybe you can see where things get "weird". Namely if I write phi[1], is not the same as phi[iP[1]], even though iP[1]:=1 (Both are integers). 

p.s. I have used implicitdiff. It is way too slow and memory inefficient for many equations (hundreds to thousands). So that is why I am trying to find a work-around.

restart:
Digits:=15:
with(LinearAlgebra):


for i from 1 to 2 do
iP[i]:=i:
iC[i]:=i+2;
od:


alias(seq(x[iP[i]]=x[iP[i]](seq(x[iC[j]],j=1..2)),i=1..2)):
alias(seq(seq(dPdC[i,iC[k]]=diff(x[iP[i]](seq(x[iC[j]],j=1..2)),x[iC[k]]),k=1..2),i=1..2));


# Define all (PRIVATE + COMMON) phi expressions.
# 1 and 2 are the PRIVATE equations.
# 3 and 4 are the COMMON equations.
phix[1]:= x[3]**2+x[4]**2:
phix[2]:= x[1]   +x[4]:
phix[3]:= x[1]   +x[3]+x[1]:
phix[4]:= x[1]   +x[3]+x[1]:

for i from 1 to 2   do
f[i]:=x[iP[i]]-phix[iP[i]]:
od:


f[1];

x[1]-phix[1];

print(iP[1],iC[1]);

print(x[iP[1]]-phix[iP[1]],x[iC[1]]);

TEST1:=diff(x[1]-phix[1],x[3]);

TEST2:=diff(f[1],x[3]);

TEST3:=diff(f[1],x[iC[1]]);

TEST4:=diff(x[iP[1]]-phix[iP[1]],x[iC[1]]);

The result is 
      
                     -x[3]^2  - x[4]^2  + x[1]
                      x[1] - x[3]^2  - x[4]^2 
                              1, 3
     
                  -x[3]^2 - x[4]^2  + x[1], x[3]
                      dPdC[1, 3] - 2 x[3]
                            -2 x[3]
                            -2 x[3]
                            -2 x[3]
Where dPdC includes the implicit derivatives, which is the answer I want, but then I am forced to write by hand what the elements are. If I put the expression in a loop with the pointers, then I get the other "TEST" answers, and as you can see, the implicit dependence from alias has been ignored.
 

 how can i define constants alpha and beta are positive in maple? ;these constants are coefficints of PDE (higgs field equation)

First 887 888 889 890 891 892 893 Last Page 889 of 2215