MaplePrimes Questions

Hello, 

 I created my own costum package and I want to edit this package: insert procedures or modules. Is there a way?

Thank you.

restart;

with(VectorCalculus);

with(LinearAlgebra);

r1 := Vector([0, 0, 1]);

r2 := Vector([sin(theta1), 0, cos(theta1)]);

r3 := Vector([VectorCalculus:-`*`(sin(theta2), cos(phi2)), VectorCalculus:-`*`(sin(theta2), sin(phi2)), cos(theta2)]);

M := Matrix([r1, r2, r3]); ex := `assuming`([simplify(VectorCalculus:-`*`(Determinant(M), 1/VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(1, DotProduct(r1, r2)), DotProduct(r1, r3)), DotProduct(r2, r3))))], [theta1 > 0, theta2 > 0, phi2 > 0]);

dex := eval(simplify(diff(arctan(ex), phi2)), phi2 = t);

VectorCalculus:-`*`(2, Int(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(2, Int(dex, t = 0 .. phi2)), 1/VectorCalculus:-`*`(4, Pi)), VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(2, Pi), sin(theta1)), sin(theta2)), 1/VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(4, Pi), 4), Pi))), [phi2 = 0 .. Pi, theta2 = 0 .. Pi, theta1 = 0 .. Pi], method = _CubaCuhre, epsilon = 0.5e-2));

evalf(%)

 

 

Ok I deleted my other question, since there was a mistake. I actually want to integrate the following expression. The arctan is not every positive in my integral there, so I needed to go this way to make it continuous. The problem here is the nested integral inside Int(...,t=0..phi2) which leads to maple not being able to evaluate.

ψ =-0.09,-0.07,-0.04,-0.01,0,0.01,0.04,0.07,0.09

these are the ψ values.

then X=

here we can take eta =0..2 and X=-15..15
using this relation how to plot streamlines for eta against X.

Code:
restart; with(plots); fcns := {T(eta), f(eta)}; ep := .1; M := 1; kp := .5; n := 1; ec := .1; pr := 1; s := .1; N := 5; sys := diff(f(eta), eta, eta, eta)+f(eta)*(diff(f(eta), eta, eta))-(diff(f(eta), eta))*(diff(f(eta), eta))+ep*ep+(M+1/kp)*(ep-(diff(f(eta), eta))) = 0, diff(T(eta), eta, eta)+pr*(f(eta)*(diff(T(eta), eta))-n*(diff(f(eta), eta))*T(eta))+pr*(ec*(diff(f(eta), eta, eta))*(diff(f(eta), eta, eta))+ec*(M+1/kp)*(diff(f(eta), eta))^2+s*T(eta)) = 0; bc := f(0) = 0, (D(f))(0) = 1, (D(f))(N) = ep, T(0) = 1, T(N) = 0; R := dsolve(eval({bc, sys}), numeric, method = bvp[midrich], abserr = 0.1e-9, output = operator); psi = [-0.9e-1, -0.7e-1, -0.4e-1, -0.1e-1, 0, 0.1e-1, 0.4e-1, 0.7e-1, 0.9e-1]; for i to 9 do X[i] = psi[i]/f(eta); print(plots:-contourplot(X[i](X, eta), eta = 0 .. N, X = 0 .. 6)) end do

 


 

Hi, 

I am interested to find the primes in in field Zp which Have prime inverses.  In particular, for any prime p up to an arbitrary number N, the number of pairs (a,b) where a and b are mutually inverse primes <p in Zp. Obviously in this context (a,b) is the same as (b,a) so no need for double counting. What I have so far is the following simple code for finding the inverse of prime q<p, given a chosen value of p. I can then see which results are prime and which are composite.

N:=p:

for n from 1 to N do

X:=q*n-1;

if mod(X,p)=0 then print(n);

end if:

end do:

This “hand cranking” method works but is of course boring but I don’t know how to scale it up to a more efficient code as described above. I would be grateful to anyone  able to assist me with this.

Thanks in advance

David

I am currently implementing the math behind the McEliece Cryptosystem in Maple, and as such I need to do work in the Galois Field GF(2^m). In my working example I am working with p=2, k=4, and a=1+x (i.e. the rank of my polynomial is 1). Parameters are per documentation found at https://www.maplesoft.com/support/help/maple/view.aspx?path=GF.

 

When attempting to initialize this field, however, I am receiving an error that the rank is not 4=k as expected. It is, however, not a requirement for a field that the polynomial has to be of rank k. How do I go about this?

G16 := GF(2, 4, 1+x);
Error, (in GF) polynomial 1+x does not determine an extension of degree 4

Hello! 

I tried to find Killing vectors of a certain metric, but Maple gives an error, which is reproduced with the following piece of code (the metric which I need is more difficult, so I would like to refrain from using "Physics" package). Could anybody tell me what the problem is and how I should solve it, please?

 

exampleError.mw
 

restart

with(DifferentialGeometry); with(Tensor); with(LieAlgebras)

DGsetup([xi, chi, u1, u2, v1, v2], P)

`frame name: P`

(1)
P > 

g := evalDG(1/2*(`&t`(dxi, dxi)+`&tensor`(du1*v1+du2*v2+dchi, du1*v1+du2*v2+dchi)*exp(-2*xi)+`&t`(dv1, dv1)+`&t`(dv2, dv2)))

_DG([["tensor", P, [["cov_bas", "cov_bas"], []]], [[[1, 1], 1/2], [[2, 2], (1/2)*exp(-2*xi)], [[2, 3], (1/2)*exp(-2*xi)*v1], [[2, 4], (1/2)*exp(-2*xi)*v2], [[3, 2], (1/2)*exp(-2*xi)*v1], [[3, 3], (1/2)*exp(-2*xi)*v1^2], [[3, 4], (1/2)*exp(-2*xi)*v1*v2], [[4, 2], (1/2)*exp(-2*xi)*v2], [[4, 3], (1/2)*exp(-2*xi)*v1*v2], [[4, 4], (1/2)*exp(-2*xi)*v2^2], [[5, 5], 1/2], [[6, 6], 1/2]]])

(2)
P > 

KV := KillingVectors(g)

Error, (in DifferentialGeometry:-Tensor:-Christoffel) expected 1st argument to be a metric tensor. Received: _DG([["tensor", P, [["cov_bas", "cov_bas"], []]], [`...`]])

 
P > 

``


 

Download exampleError.mw

 

What's going on here? Am I missing something, or is it a bug? If it's a bug, then it's by far the deepest and most profound bug that I've ever found or seen in Maple (and I've seen thousands over the decades). And since that surprises me, my guess is that I'm missing something obvious.

restart:
Op:= (R,F)-> F(['R()'$2]):
Op(rand(1..9), [f,f]);
                     [f([7, 6]), f([2, 4])]

The expected output is [f([7,6]), f([7,6])]. The same thing happens if I replace with seq, or if I replace -> with proc.

make a program that generates 20 numbers between 1 and 100, calculate the sum and the average of even numbers

please help, I do not know how to do it and the teacher wants this with "for, do and an external accountant

Limit((2x-3)/(x-2),x=2)->

How type this expression?

Can anyone advise me on the difference between the Internally and Externally Standardized Residuals from the LinearFit procedure? 

 

Sincerely

 

Jo

Hi!

I am a relatively new user of Maple. I am trying to find the partial fractions of a polynomial expression. All the values are constants determined by an outside system (that I am trying to model). The function is in terms of s. The denominator was simplified via substitution (more combinations of constants) to see if I could find the problem. There is no other code in the file, so I don't know if I have to define the constants (Cdl, RL, R1, R2, C1, C2) separately.

f:=(V[0](s^3+(2 s^2)/(C[dl] R[L])+(s^2)/(C[2] R[L])+(s^2)/(C[2] R[2])-(s^2)/(C[1] R[L])+(s)/(C[dl] C[2] R[L]^2)+(2 s)/(C[dl] C[2] R[L] R[2])+(s)/(C[dl]^2 R[L]^2)-(s)/(C[dl] C[1] R[L]^2)+1/(C[dl]^2 C[2] R[L]^2 R[2])))/(s^4+as^3+bs^2+cs+d)

convert(f, parfrac, s)

Running convert parfrac gives me an error that the argument is not a rational function. Any help is greatly appreciated!

 

or am I missing something?

Consider:

A:=Matrix(2, 2, [1, 4, 5, 1]);
x0:=Vector([2,1]); #initial condition

sol := DETools:-matrixDE(A, t);

M:=(Matrix(convert(sol[1], listlist)));  #convert to modern day Matrix from array that is returned by matrixDE

#the solutoion according to the documentation:

x:=M.x0;

#should match x0 at t=0, but does not:

subs(t=0, x);

 

#using this instead seems to work. But the docs claim this is method is meant to work for constant coeffs.

sol := DETools:-matrixDE(A, t, method=matrixexp);

 

Am i missing something? or is matrixDE not to be trusted (especially in cases where method is not provided)?

as a side note, the documentation is very out of date; claims matrixDE returns Matrix and vector, but these are just the old array types; means LinearAlgebra operations do not work.

 

 

 Hi guys,

I dont know much about maple, please looking for someone to help me check this maple code as to why it is not running sign.mw . The ode is copied from singh2000-thermometer.pdf.

Thank you for your help

Can someone please tell me my mistake. The plot is not responing to slider changes.

Many thanks


PolarPlotB.mw

pls help me cirrect this. i am trying to use finite element method to siolve a fluid equation. The code is give below

> pde := alpha^2*(diff(u(t, r), t))+2*(-1/2)^(1/n)*(diff(u(t, r), r))/r-(-1/2)^((1-n)/n)*(diff(u(t, r), `$`(r, 2)))*(diff(u(t, r), r))^(1/n-1)/n+2*theta/r-4*(1+e)+4*B*cos(.2) = 0; /1\ |-| \n/ /-1\ / d \ 2 |--| |--- u(t, r)| 2 / d \ \2 / \ dr / alpha |--- u(t, r)| + ----------------------- \ dt / r /1 - n\ /1 \ |-----| |- - 1| \ n / \n / /-1\ / d / d \\ / d \ |--| |--- |--- u(t, r)|| |--- u(t, r)| \2 / \ dr \ dr // \ dr / 2 theta - ---------------------------------------------------- + ------- - 4 - 4 e n r + 3.920266311 B = 0 > tmax := 0.5e-1; > rmin := 0; > rmax := 10; > N := 6; > bc1 := diff(u(t, r = rmin), r) = 1/mu; > bc2 := u(t, r = rmax) = 0; > ic1 := u(0, r) = 0; > PDE*Boundary*condition*colllection; > bcs := {u(0, r) = rhs(ic1), D[1](diff(u(t, r = rmin), r)) = rhs(bc1), (D[1](u))(t, r = rmax) = rhs(bc2)}; / / d \ 1 \ { u(0, r) = 0, D[1]|--- u(t, r = 0)| = --, D[1](u)(t, r = 10) = 0 } \ \ dr / mu / > > Collocation*method; > Typesetting[delayDotProduct](Define*a*simple*function*with*known*solution.one, can, true)*choose*either*a*trigonometric*function, othorgonal*polynomia, (Typesetting[delayDotProduct](legendre*polynomia*etc.we, want, true)*will*choose*a*simple*polynomia*which*will)*make*our*work*easier; > basis := r^i; > uhat := sum(A[i](t)*basis, i = 0 .. N-1); > Alist := indets(uhat, function(identical(t))); > Here, we*will*determine*the^2*two*unknowns*(A1, A2)*using*boundary*conditions; > duhat := diff(uhat, r); > knownAs := solve({subs(r = rmin, duhat) = rhs(bc1), subs(A[1](t) = 0, r = rmax, duhat) = rhs(bc2)}, {A[1](t), A[2](t)}); > unknownAs := `minus`(Alist, {seq(lhs(knownAs[i]), i = 1 .. nops(knownAs))}); > `and`(uhat*after*substituting*A1, A2); > uhat := subs(knownAs, uhat); > uhat := collect(uhat, Alist); > Residual*function*is*obtai*ned*after*substituting*uhat*into*the*original*pde; > residual := eval(subs(u(t, r) = uhat, pde)); > residual := collect(residual, r); > `and`(Typesetting[delayDotProduct](Now*we*choose*points*where*exact*solution*must*be*matched.since, we, true)*have*point*A[1], A[2]), we*will*only*need*N-2*points; > odes := {seq(subs(r = i*rmax/N, residual), i = 1 .. nops(unknownAs))}; > Find*ICs*of*unknown*A(t)*s; > iceqs := {seq(subs(t = 0, r = i*rmax/N, uhat) = rhs(bc2), i = 1 .. nops(unknownAs))}; > ics := solve(iceqs, subs(t = 0, unknownAs)); > > sols := dsolve(`union`(odes, ics)); Warning, computation interrupted > Approximate*solution; > uhat := subs(sols, uhat); Error, invalid input: subs received sols, which is not valid for its 1st argument > uhat := collect(uhat, r); > Plot*solution; > plot3d(uhat, r = 0 .. rmax, t = 0 .. tmax, axes = boxed, lightmodel = light4, orientation = [-120, 40], shading = zhue, transparency = .3); Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct > >
First 647 648 649 650 651 652 653 Last Page 649 of 2308