Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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 > >

The question is all in the title really. I am struggling to make a subsection on my macbook, using 2018 Maple software. The cmd + shift + . will only make sections, regardless of where i place my cursor.

Hi,

I am trying to solve a 2dof system numerically. What is the best way to find x1 and x2 by given initial conditions?

My first try to solve it is in the attached file.2DOFnumerical.mw

Thanks,

Baharm31

 

 

Insertion and processing of data (independent and dependent) with Maple syntax and using traditional equations. In the same way we reach the same result. We can also calculate a, b, Sa, Sb and r (pearson correlation coefficient). It can be used for students and researchers.

Regression_with_Maple.mw

Lenin Araujo Castillo

Ambassador of Maple

First 755 756 757 758 759 760 761 Last Page 757 of 2219