Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello
I try to reproduce in Maple this document in pdf. In it you can see the code in MathCad to find the roots of a system of equations by the method of Draghilev.
After seeing some of the codes posted in the Maple forum where the development of the method is shown and reading the document in the Application Center, some questions arise.
When the deferential ecacuion system is divided, in this case stored in variale b [i], by b [i] / (b [1] ^ 2 + b [2] ^ 2) ^ 0.5; i = 1..n + 1
Why, as I could see in some systems, the first two differential equations are taken and in others it takes three?
And in what systems does it divide at all?

https://www.mapleprimes.com/view.aspx?sf=223821_question/Draghilev

 

In this case in my transfer of code from Mathcad to Maple I do not get the initial values of the system fsolve calculates indefinitely

sistema9.mw

 

Below is a link to my worksheet that evaluates 6 expressions that are presumably equivalent.  However, there seems to be a region for 7<n<100 where the results diverge.  All other values of n yield identical results.  I am at a TOTAL loss as to what is happening.  I hope that someone here might shed some light on this quirk.

divergent_behavior.mw

CodeTools:-Usage lists information on CPU time & memory used in later versions of MAPLE.  I do not see Usage as an option for MAPLE 12.  Is there a comparable command & can you provide an example so that I have the proper syntax?

I couldn't find an option to find a best fit line passing through a specified point in your data.  How do you do that?

I would like the best fit line to pass through [2,21]

restart

pts := [[0, 0], [1, 13], [2, 21], [6, 45], [12, 54], [15, 77]]

plot(pts)

 

pts1 := Vector([0, 1, 2, 6, 12, 15])

pts2 := Vector([0, 13, 21, 45, 54, 77])

with(Statistics)

L := LinearFit(b*x+a, pts1, pts2, x)

HFloat(8.154639175257726)+HFloat(4.474226804123712)*x

(1)

plot({L, pts})

 

``


 

Download test.mw

Hello,

I am confused by the Syntax of maple. When does maple numerically evaluates an expression? I know that maple cannot distinguish the variable "e" from the exponential function "e". So I have to use the command palette or enter the 1-D sequence "exp(1)". Maple shows the symbols if not told otherwise. I can numerically evaluate the expression using "evalf(exp(1))". 

But if I enter "I^2" for example maple behaves in a different way. It does not show "I^2" but it evaluates the expression. Same with "2+2". Maple shows me the result "4". So when does Maple numerically evaluate an expression and when does not?

Second question: When I enter "evalf(exp((I*2)*Pi))" I get "1.". What is the meaning of the point? Using "evalc(exp((I*2)*Pi))" I do not get the point - just "1".

Thank you in advance!

 

hey guys i'm new to maple i'd search the forum but i don't find any solution about my problem

how we can calculate the length of a cure like this:

y=f(x)

f(x)=sin(cos(x+Pi))

from point1={Pi,f(Pi)} to point2={(5*Pi/3),f(5*Pi/3)}

please help me

Hi

I've attached a worksheet (Solve_Problems_MWE.mw), in which I'm working on finding any solution to a list of equations, in which the parameters and variables are not neccessarilly zero. I've used the solve command in the form S=[solve([Eq1,Eq2,...])], because I've been unable to find a list of parameters and variables for which solve([Eq1,Eq2...],[var1, var2,...  ]) returns anything.

I'd like to use a function to sort through the entries of S, by converting lists into arrays, and using the array tools package to check for 0s in the entries of the converted S[1], S[2],...

However, Maple doesn't want to convert S[1],S[2]... into arrays.

Does anyone know how to make it work? or how to circumnavigate the problem?
 

I am solving a very ill-conditioned generalised matrix eigenvalue problem which has the form (Apologies, the Maple Math input option is not working at all)

Av = aBv

Where A and B are matrices, a are the eigenvalues and v the eigenvectors.

Matrix, B, has a condition number of 1E40 which means Cholesky decomposition, Schur decompositions etc... are highly unstable. I have found that by transforming all the diagonal matrix elements of matrix B to one greatly reduces the condition number (down to 1E25).

To do this I divide the elements on each row by the row element which sits on the diagonal of the matrix, which is shown for a basic 3x3 example:

[1,2,3]
|4,5,6|
[7,8,9]

Becomes:

[1,2,3]
|4/5,1,6/5|
[7/9,8/9,1]

Is there a name for this particular matrix transformation? I also do the same operation to matrix A but using the diagonal elements of B.

Many thanks

-Yeti

We conjecture that the polynomial h(n) = n^2 + n + 41 is prime for an infinite number of values n.
We furthur conjecture that p(n) = n^2 + 1 is prime an infinite number of times.

I have shown that the set (x,y) with h(y) mod x is congruent to 0 can be written down.  It is p(x,y).  p(x,y) is the set of all divisors of h(n).  See

https://sites.google.com/site/primeproducingpolynomial/

landau.mw

Regards,

Matt

Am I applying improper syntax for the is command?  Out of the 5 attempts to equate X with the time derivative of S11 only the combine command yields the expected result.  If only combine works then why do the others not work?
 

Ck1 := sin(Pi*k)/(Pi*k); 1; Ck2 := (1-cos(Pi*k))/(Pi*k); 1; S11 := a[0]+int(sum(2*Ck2*Pi*k*cos(2*Pi*k*x/T)/T, k = 1 .. m), x = 0 .. t); -1; Q1 := 2*sin(alpha)*(diff(S11, t)); -1; Q3 := sum(2*Ck2*Pi*k*(sin(alpha+2*Pi*k*t/T)+sin(alpha-2*Pi*k*t/T))/T, k = 1 .. m); -1; is(Q1 = Q3)

true

(1)

sum1 := sum(2*Ck2*Pi*k*cos(2*Pi*k*x/T)/T, k = 1 .. m):

true

(2)

subs(x = t, simplify(expand(combine(2*sin(alpha)*sum1)))) = simplify(expand(combine(Q3)))"(->)"true

NULL

m := 2*n;

-4*sin(Pi*t/T)*sin(Pi*t*n/T)*cos(Pi*t*n/T)*(2*cos(Pi*t*n/T)^2-1)/(T*cos(Pi*t/T)*(-1+cos(Pi*t/T)^2))

(3)

is(`assuming`([X = diff(S11, t)], [n::integer])), is(`assuming`([expand(X = diff(S11, t))], [n::integer])), is(`assuming`([combine(X = diff(S11, t))], [n::integer])), is(`assuming`([eval(X = diff(S11, t))], [n::integer])), is(`assuming`([value(X = diff(S11, t))], [n::integer])), simplify(`assuming`([combine(X-(diff(S11, t)))], [n::integer]))

false, false, true, false, false, 0

(4)

X

-4*sin(Pi*t/T)*sin(Pi*t*n/T)*cos(Pi*t*n/T)*(2*cos(Pi*t*n/T)^2-1)/(T*cos(Pi*t/T)*(-1+cos(Pi*t/T)^2))

(5)

`assuming`([combine(X-(diff(S11, t)))], [n::integer])

0

(6)

`assuming`([X-combine(diff(S11, t))], [n::integer])

-4*sin(Pi*t/T)*sin(Pi*t*n/T)*cos(Pi*t*n/T)*(2*cos(Pi*t*n/T)^2-1)/(T*cos(Pi*t/T)*(-1+cos(Pi*t/T)^2))-(2*cos((-Pi*t+4*Pi*t*n)/T)-2*cos((Pi*t+4*Pi*t*n)/T))/(T*cos(Pi*t/T)-T*cos(3*Pi*t/T))

(7)

"(=)"

0

(8)

``


 

Download syntax_for_is.mw

 

I originally was trying to verify that the determinant of an nxn matrix of binomial coefficients is zero if n is a multiple of 6. A description of the coefficients is shown in my program below under Row 1, Row 2 etc, using the old fashioned notation for binomial coefficients nCr=n!/r!/(n-r)!    I came across this in the interesting book 'Single Digits: in praise of small numbers' by Marc Chamberland. page 167.

   My pathetic attempt is below.  I tried to create a 5 x 5 matrix of binomial coeffs.  There is a procedure shft which attempts to create the rows of the matrix: the rows are just shifted along.  I've been successful in obtaining two rows, then after that gave up:-(  Thinking I'd try something easier, I thought I'd find the determinant of the matrix using the determinant command in the linear algebra package - without success.

  Any help would be most appreciated. 

 

 restart:

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Matrix program - intro to learn matrices

# The proc shft shifts the elements of an array one to the right and the

# first becomes the last

# # # # # # # # # # # # # # # # # # # # # # # # # # # #

with(plots):

with(plottools):

#with(linalg);

with(LinearAlgebra);

#a:=array([1, 2, 3, 4, 5]);

#Row 1   1 nC1  nC2  nC3…    …nC(n-1)

#Row 2   nC(n-1)  1  nC1…      …nC(n-2)

#Row 3  nC(n-2)  nC(n-1)  1…  …nC(n-3)

#...

#Row n  nC1  nC2 nC3…        …1

n:=5:

a:=array([seq(binomial(n,i), i=0..n-1)]);

acopy:=array([seq(binomial(n,i), i=0..n-1)]);

 

#shift := (f::procedure) -> ( x->f(x+1) ):

#shift(a[1]);

shft := proc(a::array)

local i, b::array:

global n:

#printf("n=%d\n",n);

for i from 1 to n do

#printf("n=%d\n",n);

b[i]:=a[i]:

end do:

#nn:=n-1:

for i from 1 to n-1 do

if i<>n-1 then

a[i+1]:=b[i]:

      else

a[1]:=a[5]:

a[n]:=b[n-1]:

end if:

printf("In loop a[%d}=%5.3f\n", i, a[i]);

end do:

end proc:

 

shft(a);

for i from 1 to n do

#printf("n=%d\n",n);

   bnew[i]:=a[i];

printf("bnew[%d]=%d\n",i,bnew[i]);

end do:

bmatrix:=array(1,n,[seq(bnew[i], i=1..n)]);

 

#for m from 2 to n do

   #shft([seq(bmatrix[1,kk], kk=1..m)],[seq(bmatrix[1, k], k=1..n-m)]);

    shft(bmatrix);

printf("In for loop:  bnew[%d}=%5.3f\n", m, bnew[m]);

#end do:

#s:={seq((1,j)=eval(A[1,j]), j=1..n), (2,2)=1,(3,3)=1,(4,4)=1, (5,5)=1}:

s:={(1,1)=1,(1,2)=5,(1,3)=10,(1,4)=10,(1,5)=5, (2,2)=1,(3,3)=1,(4,4)=1, (5,5)=1}:

 

SSs:=Matrix(5,5,s);

determinant(SSs);

simplify(evalf @(determinant(SSs)));

Determinant(SSs,method=float);

 

#A := Matrix(2,2,[[9,9],[1,2]]);

print(`Printing matrix`);

#A[3,3]:=1;

A := Matrix(m,5,[[seq(acopy[i], i=1..5)],[seq(bnew[j], j=1..5)]]);

#end do;

for i from 1 to n do

  printf("a[%d}=%5.3f\n", i, a[i]);

end do:

 

Need help understanding the following code fragment (skipping the implementation details of procedure A). I am a  student and program primarily in Java and I do not have Maple s/w. I browsed through Maple programming guide but have not yet deciphered the code. Any help will be greatly appreciated.

Thank you.

_____________________________________________________________________________

f:=proc(J)

L:=map((x)->[x[1], (x[2] + x[3] * I) / x[1] + 50 * (1+I) / abs(J[1][2])], J);

R:=Vector([L]);

T,r:=abs(L[1][3]),L[1][4];

A(L[1][5],L[2][6],L[3][7],L[1][8],L[2][9],L[3][10],R,T,r);

A(L[1][11],L[2][12],L[4][13],L[1][14],L[2][15],L[4][16],R,T,r);

A(L[1][17],L[3][18],L[4][19],L[1][20],L[3][21],L[4][22],R,T,r);

A(L[2][23],L[3][24],L[4][25],L[2][26],L[3][27],L[4][28],R,T,r);

plots[display](seq(plottools[circle]([Re(R[i][29]),Im(R[i][30])],abs(1/R[i][31])),i= 1..numelems(R))):

end proc:

_____________________________________________________________________________

Procedure is called as:

f([[-1, 0, 0], [2, 1, 0], [2, -1, 0], [3, 0, 2]]);

_____________________________________________________________________________

Hi

Please download and check the attached file.
It seems when you run the code more than one time, various results are obtained each time.

What is the reason? How it can be fixed?

Thanks


 

restart; Digits := 20; tm := time(); with(LinearAlgebra); m := 6; a := .1; b := 10*a; E := 1; h := 1; nu := .3; ur := -w*z+u0; u0 := 0; ut := add(add(T[n, i]*r^n*t^(i-n), n = 0 .. i), i = 0 .. m); w := (r-b)^2*(r-a)^2*add(add(W[n, i]*r^n*t^(i-n), n = 0 .. i), i = 0 .. m); er := diff(ur, r); et := ur/r+(diff(ut, t))/r; ert := 1/2*(diff(ut, r)-ut/r+(diff(ur, t))/r); u := -(1/2)*E*(2*er*et*nu+er^2+et^2)/(nu^2-1)+2*E*ert^2/(2+2*nu); N := sum(i+1, i = 0 .. m); PI := int(int(int(u*r, z = -(1/2)*h .. (1/2)*h), t = 0 .. 2*Pi), r = a .. b)-.5*P*(int(int(r*(diff(w, r))^2, r = a .. b), t = 0 .. 2*Pi)); s1 := seq(indets(add(add(T[n, i], n = 0 .. i), i = 0 .. m))[k] = c[k], k = 1 .. N); s2 := seq(indets(add(add(W[n, i], n = 0 .. i), i = 0 .. m))[k] = c[k+N], k = 1 .. N); PI := subs(s1, s2, PI); for k to 2*N do diff(PI, c[k]); if % = 0 then ex := `union`({}, {k}) else eq[k] := % end if end do; NE := seq(ex[j], j = 1 .. numelems(ex)); M := GenerateMatrix([`$`(eq[j], j = 1 .. 2*N)], [`$`(c[j], j = 1 .. 2*N)])[1]; M := DeleteColumn(DeleteRow(M, NE), NE); Determinant(M); 12*fsolve(%, P = 0 .. 1)*(-nu^2+1)*a^2/(E*h^3); Time = time()-tm

Time = 85.363

(1)

``


 

Download Stability.mw

Units seem to be interfering with elementwise square roots.  I have with(Units[Standard]): in my .mapleprofile since I frequently use units.  I am working on a document which uses units but also requires computing the elementwise square root of a 2x1 vector.

If I boil this down to the very simple document attached, you can see that the units package is somehow interfering with the square root of a vector of numbers without units, but doing an elementwise square root doesn't work either.  I have tried removing the with(Units[Standard]): line in the startup file for this document and recomputing, but nothing changes.

I don't see how to do elementwise square roots in this situation.  Is there a workaround, or am I missing something?

Thanks,

Gerrit

Elementwise_Square_Root.mw

Does anyone know how the sum command works? If I set

f:=proc(x) if x<=1 then 1 else 2

then compute

sum(f(i),i=1..10)

I get an error, as it tries to check "i<=0", for the symbol 'i'. Curiously if the comparison in 'f' is "x=1" it goes through fine. Another place this comes up is using "op" on lists. If I set

z:=[[1,2],[3,4],[5,6]]

then compute

sum(foldl((x,y)->x*vars[y],1,op(z[i])),i =1..3)

it doesn't give the desired answer. When i=1 for example, I think it computes op(z[i]) as op(z[i])->i->1, rather than op(z[i])->op(z[1])->op([1,2])->1,2.

First 856 857 858 859 860 861 862 Last Page 858 of 2216