Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I am attempting to add the contents of a variable based on the contents of another. There should be some way to do this without looping. I get errors when trying to do this with seq. I seem to not understand evaluation...

How do I do this?

restart;
## generate some values like in the real app
roll:=rand(1..9):
N := sort([seq(seq(10*(2+jdx)+roll(),jdx=1..5),idx=1..10)]):
V := 10*seq(roll()+10*trunc(N[idx]/10),idx=1..nops(N)):

## generate index for sum. This groups the values for sum
sumidx := [seq(floor(N[idx]/10)-2,idx=1..nops(N))];

## create and zero sum variable
S := 0 *~convert(convert(trunc~(N/10),set),list);

## calc sum and display it - This works
for idx to nops(sumidx) do
    S[ sumidx[idx] ] += V[idx]:
end do:
S;

## error because sumidx[idx] is not evaluated ?????
S := 0 *~convert(convert(trunc~(N/10),set),list):
seq('S'[ sumidx[idx] ] += V[idx], idx=1..nops(N));
S;

## This works 'S' delays evaluation and sumidx[idx] is evaluated in
## the function call
f := proc( A, B )
    A += B:
end proc:
## zero sum variable
S := 0 *~convert(convert(trunc~(N/10),set),list):
seq(f('S'[ sumidx[idx] ], V[idx]),idx=1..nops(N)):
S;
 

Hello all,

I am considering the function f(t,u)=e^(t^2+10*u-1)

I am also considering the tangent plane g(t,u)=-121+22*t+10*u at point (11,-12).

I would like to draw a 3Dplot in maple that shows the tangentplane touching the graph of f(t,u) at point (11,-12). 

I have typed the following :
 

plot3d([exp(t^2 + 10*u - 1), -121 + 22*t + 10*u], t = -1 .. 1, u = -0.7 .. 0.7, color = [red, green])
 

The 3Dplot is not correct. I have spent much time getting it to work. Could someone please assist me?

Thanks.

I can export a worksheet (to many different formats), but the normal way of doing this requires a human in the loop and several mouse operations.

Is there a way to automate this?

I have on the order of 100 different worksheets and would like to capture them in an archival format (e.g., PDF).

I am trying to find the minimum of a function TF defined by a procedure over an interval. The function depends on variable x and fixed parameters x0, L, k, alpha_0, alpha_L. Here is the function

TF := proc(x, x0, L, k, alpha_0, alpha_L) if x0 <= x then evalc(abs(cos(k*(x - L) - alpha_L)*cos(k*x0 + alpha_0)/(cos(alpha_L)*cos(k*x0 + alpha_0)))); else evalc(abs(cos(k*(x0 - L) - alpha_L)*cos(k*x + alpha_0)/(cos(alpha_L)*cos(k*x0 + alpha_0)))); end if; end proc;

When I use

Minimize('TF'(x, 0, 0.03, 55.11566060, Pi/2, Pi/4), x = 0 .. 0.03);

I get an error "Error, (in Optimization:-NLPSolve) cannot determine if this expression is true or false: 0 <= x". What is my mistake ?

Thanks.

> with(LinearAlgebra) :
> a:=<<.1,.2>|<.3,.4>>:
> ScalarMultiply(a,.1);

INTEL MKL ERROR: /home/jet08013/maple2022/bin.X86_64_LINUX/libmkl_gf_lp64.so: undefined symbol: mkl_blas_cdgmm_batch_strided.
Intel MKL FATAL ERROR: Cannot load libmkl_gf_lp64.so.
maple: fatal error, lost connection to kernel

This is EXTREMELY inconvenient.

NULL

Programm zur Brechnung der Kreisteilungspolynome_2022-04-05 Ki

 

NULL

restart; with(Algebraic); with(NumberTheory)

n := 6

6

(1)

 

cyclo_poly := Vector[row](1 .. n, 0)

Vector[row](%id = 36893489967244295332)

(2)

i := 1; cyclo_poly[1] := X-1

1

 

X-1

(3)

NULL
c_poly := proc (i, kt_poly) local j, hz1, hz2, X; j := i+1; hz1 := X^j-1; hz2 := kt_poly; kt_poly := Quotient(hz1, hz2, X) end proc

cyclo_poly[2] := c_poly(i, cyclo_poly[i])

Error, (in c_poly) illegal use of a formal parameter

 

i := 1; kt_poly := X-1

1

 

X-1

(4)

j := i+1; hz1 := X^j-1; hz2 := kt_poly; kt_poly := Quotient(hz1, hz2, X)

2

 

X^2-1

 

X-1

 

X+1

(5)

NULL

Download Programm_zur_Brechnung_der_Kreisteilungspolynome_2022-04-05_Ki.mw

Good morning

Why doesn't Quotient(x,y,z) not work within a procedure whereas it works well standing alone? See example.

Greetings  Heinz

Dear all,

I'm using Maple to calculate the geodesics of the Poincare' Half Plane:

restart:
with(LinearAlgebra): with(DifferentialGeometry): with(Tensor): with(Tools): with(plots): 
DGsetup([x,y],M1)
g1 := evalDG(1/y^2*(dx &t dx+dy &t dy))
R1 := CurvatureTensor(g1)
K := SectionalCurvature(g1,R1,D_x,D_y)
Gamma := Christoffel(g1)
C := [x(t), y(t)]
V := GeodesicEquations(C, Gamma, t)
DE := Tools:-DGinfo(V, "CoefficientSet")

simplify(dsolve(DE, explicit))

I receive this error message

Error, (in simplify/siderels:-simplify/siderels) specified variables must be names or functions

How can I fix this error?

Thanks, Nicola

Please, how do I find the minimum of the real part of a complex function? I tried min ( ) function it didn't work. 

Find attached the fileFinding_min_zero.mw
 

Import packages

 

restart: with(ArrayTools): with(Student:-Calculus1): with(LinearAlgebra): with(ListTools):with(RootFinding):with(ListTools):

Parameters

 

gamma1 := .1093:
alpha3 := -0.1104e-2:
k[1] := 6*10^(-12):
d:= 0.2e-3:
xi:= -0.01:
theta0:= 0.1e-3:
eta[1]:= 0.240e-1:
alpha:= 1-alpha3^2/(gamma1*eta[1]):
c:= alpha3*xi*alpha/(eta[1]*(4*k[1]*q^2/d^2-alpha3*xi/eta[1])):
theta_init:= theta0*sin(Pi*z/d):
n:= 10:

``

``

Assign g for q and plot g

 

g := q-(1-alpha)*tan(q)-c*tan(q):
plot(g, q = 0 .. 3*Pi, view = [DEFAULT, -30.. 10]);

 

Set q as a complex

 

Assume q = x+I*y and subsitute the result into g and equate the real and complex part to zero, and solve for x and y.

f := subs(q = x+I*y, g):
b1 := evalc(Re(f)) = 0:
b2 := evalc(Im(f)) = 0:

Compute the Special Asymptotes

 

This asymptote is coming from the c from the definition of "q."

``

qstar := (fsolve(1/c = 0, q = 0 .. infinity)):NULLNULL``

``

``

Compute Odd asymptote

 

First, Since tan*q = sin*q*(1/(cos*q)), then an asymptote occurs at cos*q = 0. In general, we have
"q= ((2 k+1)Pi)/(2). "
Next, we compute the entry of the Oddasymptotes that is close to qstar (special asymptote) as assign it to
ModifiedOaddAsym, and then find the minimum of the ModifiedOaddAsym. Searchall Function returns

the index of an entry in a list.

OddAsymptotes := Vector[row]([seq(evalf((1/2*(2*j+1))*Pi), j = 0 .. n)]);
ModifiedOddAsym := abs(`~`[`-`](OddAsymptotes, qstar));
qstarTemporary := min(ModifiedOddAsym);
indexOfqstar2 := SearchAll(qstarTemporary, ModifiedOddAsym);
qstar2 := OddAsymptotes(indexOfqstar2);

OddAsymptotes := Vector(4, {(1) = ` 1 .. 11 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

ModifiedOddAsym := Vector(4, {(1) = ` 1 .. 11 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

.6952012913

 

1

 

1.570796327

(4.2.1)

Compute x and y

 

Here, we solve for xand y within the min. and max. of qstar2 and qstar, and substitute the results into q.

AreThereComplexRoots := type(true, 'truefalse');
try
   soln1:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = 0 .. infinity});
   soln2:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = -infinity .. 0});
   qcomplex1 := subs(soln1, x+I*y);
   qcomplex2 := subs(soln2, x+I*y);
catch:
   AreThereComplexRoots := type(FAIL, 'truefalse');
end try;

 

true

 

{x = 1.348928550, y = .3589396337}

 

{x = 1.348928550, y = -.3589396337}

 

1.348928550+.3589396337*I

 

1.348928550-.3589396337*I

(4.3.1)

Compute the rest of the Roots

 

In this section we compute the roots between each asymptotes.

OddAsymptotes := Vector[row]([seq(evalf((1/2)*(2*j+1)*Pi), j = 0 .. n)]);
AllAsymptotes := sort(Vector[row]([OddAsymptotes, qstar]));
if AreThereComplexRoots then
gg := [qcomplex1, qcomplex2, op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])), seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)];
elif not AreThereComplexRoots then
gg := [op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])), seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)];
end if:

OddAsymptotes := Vector(4, {(1) = ` 1 .. 11 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

AllAsymptotes := Vector(4, {(1) = ` 1 .. 12 `*Vector[row], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(4.4.1)

``

Remove the repeated roots if any

 

qq := MakeUnique(gg):

``

Redefine n

 

m := numelems(qq):

``

Compute the `&tau;_n`time constants

 

for i to m do
p[i] := gamma1*alpha/(4*k[1]*qq[i]^2/d^2-alpha3*xi/eta[1]);
end do;

93.91209918-98.41042341*I

 

93.91209918+98.41042341*I

 

8.521555786

 

2.990232721

 

1.515805379

 

.9145981009

 

.6114591994

 

.4374663448

 

.3284338129

 

.2556221851

 

.2045951722

(4.7.1)

``

Minimum of the Re(`&tau;_n`)

 

for i to m do
p[i] := min(Re(gamma1*alpha/(4*k[1]*qq[i]^2/d^2-alpha3*xi/eta[1])));
end do;

93.91209918

 

93.91209918

 

8.521555786

 

2.990232721

 

1.515805379

 

.9145981009

 

.6114591994

 

.4374663448

 

.3284338129

 

.2556221851

 

.2045951722

(4.7.1.1)

## I expected 0.20459 but return all the entries in the list.

``

Download Finding_min_zero.mw

The random connected graphs used to be connected in Maple 2020. But then ...

restart;
with(GraphTheory):
with(RandomGraphs):
N:=100: n:=20: m:=30:
add(`if`(IsConnected(RandomGraph(n,m,connected)), 1, 0), 1..N) <> N;

        54 <> 100

Hello,

I would like to print the current values of both displayed functions for x=1 in each frame of the animation. My example code is below:

plot1 := animate(plot, [a*x^2, x = -1 .. 1, color = "Green", thickness = 3], a = 0.2 .. 1.2);
plot2 := animate(plot, [a*x^2 + 0.3, x = -1 .. 1, color = "Red", thickness = 3], a = 0.2 .. 1.2);
display([plot1, plot2]);

I would be grateful for any tips.

Thank you,

Iza

Hello all, 

Would you allow me to ask this one question?
[moderator: See also this previous question]

Is there any possible way to treat the differentiation operator (e.g., 'D') as an ordinary coefficient of a polynomial?

For example, as described in the attached worksheet, I was wondering if there is a way to re-write the LHS of the expression 'eq_e5_9b' as the expression 'desired'. 

In Kwon Park 

restart;

with(DEtools):

eq_e5_9b := psi__d0*Delta__delta(t) + psi__q0 * D(Delta__delta(t))/omega__0 = p_(Delta__psi__d(t))/omega__0 - Delta__psi__q(t);

psi__d0*Delta__delta(t)+psi__q0*D(Delta__delta(t))/omega__0 = p_(Delta__psi__d(t))/omega__0-Delta__psi__q(t)

(1)

collect(lhs(eq_e5_9b), Delta__delta(t));

psi__d0*Delta__delta(t)+psi__q0*D(Delta__delta(t))/omega__0

(2)

desired := Delta__delta(t) * (psi__d0 + psi__q0 * D/omega__0);

Delta__delta(t)*(psi__d0+psi__q0*D/omega__0)

(3)

 

Download Q20220404.mw

How do I create a pointplot with different values of a parameter?

I tried

pointplot([seq([k, a(k, a0)], k = 0 .. 10, a0 = [0, 50, 100, 150, 200])]);
Error, invalid input: seq expects its 3rd argument, step, to be of type numeric, but received a0 = [0, 50, 100, 150, 200]
NULL;

ImportGraph reads one or more graphs from a file. For a file containing multiple graphs, the supported formats are digraph6, graph6, and sparse6. I notice that one option is "output = graph or list, or iterator". However, in my programming with Maple, I was reminded several times that list is only good for a small amount of data.  

Although I can convert the list to an array using the convert function, the time spent in the conversion process needs to be considered.

restart: 
with(GraphTheory):
L:=ImportGraph("C:/Users/eul10c.g6", graph6, output=list):#31026 connected eulerian graphs on 10 vertices graphs and Change to your path here.
convert(L,Array) 

So does it make more sense to provide an "output=Array" as an output option?

eul10c.txt

I am trying to decide O of times fo a computer process. I thought it was n^2*log(N) or something like that.

With 12  points, it may be hard to determine if O(N^4), etc.

See big-o.mw

First 200 201 202 203 204 205 206 Last Page 202 of 2097