MaplePrimes Questions

i'm using maple in a research but i want to add a recursive function h_m(t) in 2 case : if m is integer positive and not, 
la formule est donnée comme suit :  if (mod(m,1) = 0  and m>0) then  h:=proc(m,t)  local  t ;  h[0,t]:=t ;   for  i from -4 to  m  by  2 do  h [m,t]:= h[0, t]-(GAMMA(i/(2)))/(2*GAMMA((i+1)/(2)))*cos(Pi*t)*sin(Pi*t)  od:  fi:  end; 
  if (mod(m,1) = 0  and m>0) then  h:=proc(m,t)  local  t ;  h[0,t]:=t ;   for  i from -4 to  m  by  2 do  h [m,t]:= h[0, t]-(GAMMA(i/(2)))/(2*GAMMA((i+1)/(2)))*cos(Pi*t)*sin(Pi*t)  od:  fi:  end;
and i wanna to know how to programmate a Gaus Hypegeometric function. Thank You

 

Dear all,

I am trying to solve the following system of equations by using dsolve, but I get the error:  error, (in RootOf) expression independent of, _Z, could you please help me to solve it. Thank you.

restart;
Digits := 20;
with(plots);
Nr := .1; Nb := .3; Nt := .1; Rb := 0; Lb := 1; Le := 10; Pe := 1; ss := .2; aa := .1; bb := .2; cc := .3; nn := 1.5;
Eq1 := nn.(diff(f(eta), eta))^(nn-1).(diff(f(eta), `$`(eta, 2)))-(nn+1)/(2.*nn+1).eta.(diff(theta(eta), eta)-Nr.(diff(h(eta), eta))-Rb.(diff(g(eta), eta))) = 0;
Eq2 := diff(theta(eta), `$`(eta, 2))+nn/(2.*nn+1).f(eta).(diff(theta(eta), eta))+Nb.(diff(theta(eta), eta)).(diff(h(eta), eta))+Nt.((diff(theta(eta), eta))^2) = 0;
Eq3 := diff(h(eta), `$`(eta, 2))+nn/(2.*nn+1).Le.f(eta).(diff(h(eta), eta))+Nt/Nb.(diff(theta(eta), `$`(eta, 2))) = 0;
Eq4 := diff(g(eta), `$`(eta, 2))+nn/(2.*nn+1).Lb.f(eta).(diff(g(eta), eta))-Pe.((diff(g(eta), eta)).(diff(h(eta), eta))+(diff(h(eta), `$`(eta, 2))).g(eta)) = 0;
etainf := 10;
bcs := f(0) = ss/Le.(D(h))(0), theta(0) = lambda+aa.(D(theta))(0), h(0) = lambda+bb.(D(h))(0), g(0) = lambda+cc.(D(g))(0), (D(f))(etainf) = 0, theta(etainf) = 0, h(etainf) = 0, g(etainf) = 0;
dsys := {Eq1, Eq2, Eq3, Eq4, bcs};
dsol := dsolve(dsys, numeric, continuation = lambda, output = procedurelist);
Error, (in RootOf) expression independent of, _Z

hi

how i can solve nonlinear differential equations with shooting method in maple?ω in equation is unknown...

thanks

eq.mw

dsys3 := {-0.326905829596411e-2*g(x)-(diff(g(x), x, x))-(diff(s(x), x))*(diff(s(x), x, x))-(4/3)*omega^2*g(x), -s(x)*omega^2-(-0.573628192993074e-1*sin(0.571756792348295e-1*x)-0.163452914798206e-2*cos(0.571756792348295e-1*x))*(diff(s(x), x))-(1.00327307112014*cos(0.571756792348295e-1*x)-0.285878396174148e-1*sin(0.571756792348295e-1*x)-1)*(diff(s(x), x, x))+0.220893539279189e-4*(diff(s(x), x, x, x, x))-(9/8)*(diff(s(x), x, x))*(diff(s(x), x))^2-(3/4)*(diff(s(x), x, x))*(diff(g(x), x))-(3/4)*(diff(s(x), x))*(diff(g(x), x, x)), (D(g))(1)+(1/2)*(D(s))(1)^2 = 0, g(0) = 0, s(0) = 0, (D(s))(0) = 0, ((D@@2)(s))(1) = 0, ((D@@3)(s))(1) = 0}

{-0.326905829596411e-2*g(x)-(diff(diff(g(x), x), x))-(diff(s(x), x))*(diff(diff(s(x), x), x))-(4/3)*omega^2*g(x), -s(x)*omega^2-(-0.573628192993074e-1*sin(0.571756792348295e-1*x)-0.163452914798206e-2*cos(0.571756792348295e-1*x))*(diff(s(x), x))-(1.00327307112014*cos(0.571756792348295e-1*x)-0.285878396174148e-1*sin(0.571756792348295e-1*x)-1)*(diff(diff(s(x), x), x))+0.220893539279189e-4*(diff(diff(diff(diff(s(x), x), x), x), x))-(9/8)*(diff(diff(s(x), x), x))*(diff(s(x), x))^2-(3/4)*(diff(diff(s(x), x), x))*(diff(g(x), x))-(3/4)*(diff(s(x), x))*(diff(diff(g(x), x), x)), (D(g))(1)+(1/2)*(D(s))(1)^2 = 0, g(0) = 0, s(0) = 0, (D(s))(0) = 0, ((D@@2)(s))(1) = 0, ((D@@3)(s))(1) = 0}

(1)

``

 

Download eq.mw

Hi

We know determinant of a square matrix A[ij] (i,j ∈ {1,2,3}) is equal to the following expression

det(A) = 1/6 * e[ijk] * e[pqr] * A[ip] * A[jq] * A[kr] 

in which e[ijk] is a third order Tensor (Permutation notation or Levi-Civita symbol) and has a simple form as follows:

e[mnr] = 1/2 * (m-n) * (n-r) * (r-m).

The (i,j) minor of A, denoted Mij, is the determinant of the (n − 1)×(n − 1) matrix that results from deleting row i and column j of A. The cofactor matrix of A is the n×n matrix C whose (i, j) entry is the (i, j) cofactor of A,

C[ij]= -1 i+j * M[ij]

A-1=CT/det(A)

The general form of Levi-Civita symbol is as bellow:

 

I want to write a program for finding inverse of (NxN) matrix:

N=2 →

restart;
N := 2:
with(LinearAlgebra):
f := (1/2)*(sum(sum(sum(sum((m-n)*(p-q)*A[m, p]*A[n, q], q = 1 .. 2), p = 1 .. 2), n = 1 .. 2), m = 1 .. 2)):
A := Matrix(N, N, proc (i, j) options operator, arrow; evalf((37*i^2+j^3)/(2*i+4*j)) end proc):
f/Determinant(A);

N=3 →

restart;
N := 3:
with(LinearAlgebra):
f := (1/24)*(sum(sum(sum(sum(sum(sum((m-n)*(n-r)*(r-m)*(p-q)*(q-z)*(z-p)*A[m, p]*A[n, q]*A[r, z], m = 1 .. N), n = 1 .. N), r = 1 .. N), p = 1 .. N), q = 1 .. N), z = 1 .. N)):
A := Matrix(N, N, proc (i, j) options operator, arrow; 10*i^2/(20*i+j) end proc):
f/Determinant(A);

The results of above programs are equal to 1 and validation of method is observed.

If we can write the general form of determinant then we can find the inverse of any square non-singular matrices.

Now I try to write the mentioned program.

restart;
with(linalg):
N := 7:
Digits := 40:
e := product(product(signum(a[j]-a[i]), j = i+1 .. N), i = 1 .. N):
ML := product(A[a[k], b[k]], k = 1 .. N):
s[0] := e*subs(`$`(a[q] = b[q], q = 1 .. N), e)*ML:
for i to N do
s[i] := sum(sum(s[i-1], a[i] = 1 .. N), b[i] = 1 .. N)
end do:
A := Matrix(N, N, proc (i, j) options operator, arrow; evalf((3*i+j)/(i+2*j)) end proc): # arbitrary matrix
CN:=simplify(s[N]/det(A));

Therefore det(A)= CN-1 * e[a1,a2,..an] * e [b1,b2,.., bn] * A[a1,b1] * A[a2,b2] * ... * A[an,bn].

The correction coefficient is CN(for N)/CN(for N-1) = N!/(N-1)! =N.

restart:
with(linalg): N := 4: Digits := 20:
e := product(product(signum(a[j]-a[i]), j = i+1 .. N), i = 1 .. N):
ML := product(A[a[k], b[k]], k = 1 .. N):
s[0] := e*subs(`$`(a[q] = b[q], q = 1 .. N), e)*ML:
for r to N do s[r] := sum(sum(s[r-1], a[r] = 1 .. N), b[r] = 1 .. N) end do:
A := Matrix(N, N, proc (i, j) options operator, arrow; evalf((3*i+2*j)/(i+2*j)) end proc):
DET:=S[N]:
for x to N do for y to N do
e := product(product(signum(a[j]-a[i]), j = i+1 .. N-1), i = 1 .. N-1):
ML := product(AA[a[k], b[k]], k = 1 .. N-1):
S[0, x, y] := e*subs(`$`(a[q] = b[q], q = 1 .. N-1), e)*ML:
for r to N-1 do S[r, x, y] := sum(sum(S[r-1, x, y], a[r] = 1 .. N-1), b[r] = 1 .. N-1) end do:
f[y, x] := (-1)^(x+y)*subs(seq(seq(AA[t, u] = delrows(delcols(A, y .. y), x .. x)[t, u], t = 1 .. N-1), u = 1 .. N-1), S[N-1, x, y])
end do: end do:
Matrix(N, N, f)/(DET)*(24/6);
A^(-1);

CN for N=4 and N=3 is 24 and 6 respectively i.e. CN(4)/CN(3)=24/6.

When I use bellow procedure the error "(in S) bad index into Matrix" is occurred.

Please help me to write this algorithm by using procedure.

Thank you 

restart; with(linalg): Digits := 40: n := 7:
S := proc (N) local e, ML, s, i:
e := product(product(signum(a[j]-a[i]), j = i+1 .. N), i = 1 .. N):
ML := product(A[a[k], b[k]], k = 1 .. N):
s[0] := e*subs(`$`(a[q] = b[q], q = 1 .. N), e)*ML:
for i to N do s[i] := sum(sum(s[i-1], a[i] = 1 .. N), b[i] = 1 .. N) end do
end proc:
A := Matrix(n, n, proc (i, j) options operator, arrow; evalf((3*i+j)/(i+2*j)) end proc): # arbitrary matrix
CN := simplify(S(n)/det(A))

with(Statistics):
X := RandomVariable(Normal(0, 1))

DensityPlot(X,filled=true)

I don't know why the plot doesn't produce a shaded plot.

 

Hi all,

I seem to be quite stuck on figuring out how to leave certain letters (e.g. planck's constant h) inside the equation without having to assign it as some particular number. 

What I am trying to do is find the value of a when the following equation is at a minimum:

E = (a*(h^2)/2m) + 0.3989422804/sqrt(a)

Here h and m are what I want to set as constants without actually setting them to h := 1 because I want a in terms of h and m. I have already found the derivative dE/da:

((h^2)/2m) - 0.1994711402/a^(3/2)

But I cannot use fsolve to find the value of a at the minimum because it keeps saying that h and m are variables and unsolved for.

Any help would be greatly appreciated.

How to solve following recurrence equation:

 

a(0)=2;

a(n+1)=a(n)+a(n)^2

 

I tried,but it doesn't work.

How to find the sequence an ?

Maple_worsheet.mw

Mariusz Iwaniuk

Below is a custom distribution created based on a function that takes a parameter.

It is possible to create the custom distribution e.g. as D1 and then use it afterwards to find e.g. Mean, but it is not possible to call Mean directly with the creation of the distribution in the call.

Why is that ?

Hi!!

 

I am trying to plot the above curve:

 

restart; with(plots)

> f0 := proc (t) options operator, arrow; t, (-1)*3.9*t*(t-1) end proc; 

> IFS := proc (i, x, y) if i = 1 then return (1/2)*y, (1/2)*x end if; if i = 2 then return (1/2)*x, (1/2)*y+1/2 end if; if i = 3 then return (1/2)*x+1/2, (1/2)*y+1/2 end if; if i = 4 then return -(1/2)*y+1, -(1/2)*x+1/2 end if end proc; 

> g := proc (t) local j; for j to 4 do if evalf((1/4)*j-1/4) <= evalf(t) and evalf(t) <= evalf((1/4)*j) then return IFS(j, f0(4*t-j+1)); break end if end do end proc; 

 

Thus, the instruction  parametricplot(['g'(t),t=0..1]) return the message  

Error, (in plot) incorrect first argument [g(t), t = 0 .. 1]

Some idea or hit to plot this?

 

Thank you for your time

 

This is the coding till i do dhe decryption process. 

Do(plaintext=GetProperty("message",value));
Do(plaintext=convert(GetProperty("message",value),name));
Do(plaintextInt = convert(plaintext, bytes));
Do(plaintextBin = `~`[convert](plaintextInt, binary));
Do(plaintextBin2 = map2(nprintf, "%07d", plaintextBin));
Do(n0 = plaintextBin2[]);
Do(length1 = length(n0));
Do(plaintextCode = cat("", plaintextBin2[]));
Do(length2 = length(plaintextCode));
Do(z = convert(plaintextCode, decimal, binary));
Do(z1 = z+1);
Do(z2 = z1+%sk1);
Do(z3 = convert(z2, base, 2));
Do(b = cat("", z3[]));
Do(z4 = length(b));
Do(z5 = [Bits:-GetBits(-z2, -1 .. 0, bits = z4)]);
Do(z6 = cat("", z5[]));
Do(z7 = convert(z6, decimal, binary));
Do(%C = `mod`(Power(z7, %txte), %txtN));
Do(%C1 = `mod`(Power(%sk1, %txte), %txtN));

Do(%m = `mod`(Power(%C, %d), %N));

Do(%sk2=`mod`(Power(%C1,%d),%N));

Then nw i need to decrypt back to the original message with the coding:

Do(z8 = [Bits:-GetBits(-%m,-1 .. 0, bits = z4)]);
Do(c = cat("", z8[]));
Do(z9 = convert(c, decimal, binary));
Do(z10 = z9-sk2);
Do(z11 = z10-1);
Do(z12 = [Bits:-GetBits(z11, -1 .. 0, bits = length2)]);
Do(d = cat("", z12[]));
Do(plaintextBin2 = [StringTools:-LengthSplit(d, length1)]);
Do(plaintextInt2 = `~`[convert](plaintextBin2, decimal, binary));
Do(%message1 = convert(plaintextInt, bytes));

when i execute the program it shows the error

so how should I solve this as although i think that it should be problem of parsing the number z4 in the sentence that i highlighed, but whenever i correct it it still can't work.Thus anyone who know please help.Thanks.

 

How can I use a matrix in timeseriesanalysis?

 

m3 := Import("d:\\bok6.xlsx")

 

Areachart works fine:

AreaChart([m3], color = "pink" .. "niagara Navy", title = "Tidslinje Tilluft og avtrekk")

 

But when matrix m3 is entered in timeseriesanalysis it gives a error:

ts1 := TimeSeries([m3], startdate = "2016-08-1", header = "Tilluft VAV setpunkt", enddate = "2016-08-01");

Error, (in TimeSeriesAnalysis:-TimeSeries) invalid input: too many and/or wrong type of arguments passed to TimeSeries:-ModuleCopy; first unused argument is [Array(1..4, 1..1, {(1, 1) = 155.0, (2, 1) = 142.0, (3, 1) = 133.0, (4, 1) = 122.0})]

 

 

I have loaded the following packages:

with*matrix  with*linearalgebra  with(plots)  with(Statistics)  with(TimeSeriesAnalysis)

 

Regards

 

Kristian

Maple tech support sent me a third party application for my Maple 2016 to solve a problem that I'm working on. I was instructed to copy and paste a few items from the download: "to your "<maple>/lib" folder" Unfortunately I cannot access "lib" in my Maple "Applications" folder on my OS X MacBook Pro.

This is what Maple Tech Support sent me:

"Another option you may want to look into is the "DirectSearch" package (which is third-party, and not supported by us), which would need to be downloaded from the Maplesoft Application Centre:

 

                http://www.maplesoft.com/applications/view.aspx?SID=101333

 

There is a function "GlobalOptima()", which allows one to search for a global minimum to the objective function, as opposed to a local minimum like commands such as "LSSolve()". To install, you can extract the files "DirectSearch.mla", "DirectSearch.help", and "DirectSearch.hdb" to your "<maple>/lib" folder."

 

Any suggestions?

I need to do Huffman Coding by using Document Tools thus i can produce user interface by using coding that referred in this post by Alec Mihailovs. Below is the coding and Document Tools interface:

Do(plaintext=GetProperty("message2",value));
Do(plaintext=convert(GetProperty("message2",value),name));
Do(Freq = proc (message) options operator, arrow; map(proc (x) options operator, arrow; rhs(x) = lhs(x) end proc, {StringTools:-CharacterFrequencies(message)}) end proc);
Do(Fr = Freq(plaintext));
Do(HuffmanTree = proc (message) options operator, arrow; if nops(message) <= 1 then rhs(message[]) else procname(`union`(message[3 .. -1], {lhs(message[1])+lhs(message[2]) = [rhs(message[1]), rhs(message[2])]})) end if end proc);
Do(HT = HuffmanTree(Fr));
Do(HuffmanCoding = proc (message, r := "") if message::string then message = r else procname(message[1], cat(r, 0)), procname(message[2], cat(r, 1)) end if end proc);
Do(HD = HuffmanCoding(HT));
Do(C = table([HD]));
Do(HC = cat(map(proc (x) options operator, arrow; C[x] end proc, StringTools:-Explode(message))[])

It still can get result for first part of the coding.During execute the second part of the coding(as bolded), it produces error ,the error show below.So how should I modified so that the error won't pop out @Alec Mihaivols

 

When defining a plain standard distributed stochastic variable X, and can find the probability of X <= 0.6 using the Probability function, but how can I get the value for a certain probability, as is done with the fsolve function for example below.

However, the fsolve used to defined Prev above appears to be a bad way to do it, since the Prev function can't for example plot.

Is there some build in way of doing reverse of Probability for a stocastical variable ?

I want to plot a curve of the form |z*e^(1-z)| = 1 (the Szego curve). I am not sure how to call complexplot() to make this happen. Just calling complexplot(abs(z*exp(1-z)) = 1) does not work, and I don't know what else to specify. Any help?

First 1121 1122 1123 1124 1125 1126 1127 Last Page 1123 of 2428