MaplePrimes Questions

Maple 2022:

It appears that one can use push_back() with an empty DEQueue(), but not push_front().

Since the queue is double-ended and empty, this doesn't make much sense to me. So should this be considered a "bug"?

See the attached

  restart:

#
# This works
#
  A:=DEQueue();
  empty(A);  
  push_back(A,2);
  

module DEQueue () local num, head, tail, storage, dsp; option object; end module

 

true

 

module DEQueue () local num, head, tail, storage, dsp; option object; end module

(1)

#
# But this results in an error!
#
  B:=DEQueue();
  empty(B);
  push_front(B,2);

module DEQueue () local num, head, tail, storage, dsp; option object; end module

 

true

 

Error, invalid return value from method moduledefinition: 'NULL'

 

 

Download DEQueue_Prob.mw

I have just started using the GR functions available in Maple and have struggled to implement locally flat coordinates whilst using an arbitrary metric. I would like Maple to know that the first partial of g_ is 0 but that the second may not be. This knowledge would help simplify down some of the bulky expressions for the Riemann tensor in terms of g_. Any suggestions would be great as I have very little background knowledge with the submodule.

Thanks!

For_mapleprimes.mw

restart;
g := 9.81;
with(DEtools);
with(plots);

odeplot(dsolve({diff(x(t), t, t) = 0, diff(y(t), t, t) = -g + y(t)^2, x(0) = 1, y(0) = 0, D(x)(0) = 0, D(y)(0) = 0}, numeric), numpoints = 1000);

Hi, do you know why this plot is ragged? and my second question do you know how to get a single function x(t) or y(t) from this numeric solution instead getting parametrization plot [x(t),y(t)]? Thanks in advance.

Hi Im not sure how to solve this issue, I am new to maple and can't figure out what is going wrong. Any help is very much appreciated.

Thanks

 

I am trying to find the solution (\Psi) as approaches zero. However, after applying the limit the solution becomes zero. See the attached .mw file.limit.mw

A question by @Shameera  I was working on has disapeared meanwhile.
It was related to this previous thread 233822-How--To-Solve-This-Equation-By-Using but has not been displaced in it.
Did a regolaror do this or was it  @Shameera ?

Why do I get 2 wrong answers here?

I see that they are all false but the last answer is close enough for my purposes

restart

  with(RealDomain)

 

"`f__1`(x):=6.-sqrt(-x^(2)+8*x+9.)" = proc (x) options operator, arrow, function_assign; 6.-RealDomain:-sqrt(-RealDomain:-`^`(x, 2)+8*x+9.) end procNULL

  l__ength := solve(10 = int(f__1(x), x = 0 .. l), l) = 8.855609656, -.4725737205, 6.810993084NULL

10 = int(f__1(x), x = 0 .. l__ength[1]) = 10 = 16.02268001"(->)"false

10 = int(f__1(x), x = 0 .. l__ength[2]) = 10 = -1.586294894"(->)"false``

10 = int(f__1(x), x = 0 .. l__ength[3]) = 10 = 10.00000001"(->)"false 

 

NULL

Download Not_working.mw

I have a routine which returns a certain result. In the simplest case the result should be p[[1]].

The result is indeed p[[1]]. However, when I ask whether the result is equal to p[[1]], Maple says false.

Why does is not recognize these two things as being equal?

 

I have seen that this is possible (for example in the example:  2-D Flexible Spin-up Beam).

When I copy an image to the Windows10 clipboard it does paste to other applications but not to MapleSim. Instead, I get an audio notification from the system that is played on other instances when an action cannot be performed.

Within MapleSim copy and paste works (also between models). However, copying an image from a Maplesim Model to another Windows App does not work.

Can someone confirm that pasting images works in recent verions?

(Clearing the Clipboard removes images copied with MapleSim.

Observed on 2 Windows 10 installations with the version 2022 and 2021.)

I want to integrate the function int(1/(A^2 - B^2*cos(t))^(1/2), t = 0 .. 2*Pi), I get the correct solution, but I want to prevent all the "if" statements from appearing. I have tried to use "assume" but the if statement still does not disappear.  

FunWithFibonacci.mw contains a short program with curious behaviour.

f := proc(n) option remember; if n < 2 then 1; else f(n - 1) + f(n - 2); end if; end proc;
F := Compiler:-Compile(f);

This gives a warning message that I don't understand, but never mind*.  I don't know much about the compiler, except that it uses float[8] or complex[8] as universal data types somehow. And maybe I am wrong about that, too.

Now F(n) returns the same number as combinat[fibonacci](n+1) for small n.  This is fine, the difference is one of indexing.  Both f and F return the same thing for small n.  Good.  Both return *integers*.  Checking with whattype confirms that.

Now, F(100) returns a large NEGATIVE integer.  Ok then, this looks like an overflow of an unsigned integer somewhere.

Even before that, though, F(91) returns an integer that is *plausible* but *wrong* :  7540113804746345472 where it should be 7540113804746346429.

So.  My explanation is that the compiler is, indeed, using float[8] internally, and then (for whatever reason) silently converting to integer on return.  Because floats are being used internally, numbers bigger than 2^53 cannot be represented exactly and rounding errors occur.  This happens at f(78) and F(78) which return 14472334024676221 and 14472334024676220 respectively.  

The sign error happens with F(92), where f(92) is just bigger than 2^63.  This suggests that an unsigned 64 bit integer is what the compiler is silently casting its result as.

The help file says "Integer data are limited to word-sized integers on the current hardware. Computations that produce larger integers will raise an overflow exception." So, the overflow exception is being suppressed?

* I may have figured out the error message: if I replace "f" internally by procname, maybe that will fix it.  Will try. Ok, if I do that, the warning message is suppressed, great.  G(30) works, great, though curiously slowly.  G(100) goes into an infinite loop.

Documentation doesn't talk about recursive programs or interaction with option remember.  So maybe that's not allowed?

The spectral radius  is maximum of the absolute values of the eigenvalues of the matrix A.  We can use the function SpectralRadius in Student package. But we noticed a sentence in the help document:

The output from this procedure will be as symbolic as computationally feasible. If the exact spectral radius of A is too time-consuming to compute, it may be computed numerically.

This means that SpectralRadius will evaluate the exact value when it can. Anyway, the internal evaluation process will take time. So for the sake of efficiency, we just want the numerical results of the spectral radius of a matrix. 


I tried to write the following function, but I feel that it is not very efficient, especially for solving characteristic polynomials and their roots.  I even feel that there is a way to find the spectral radius without taking the absolute value of all the eigenvalues and ordering them. 

Spectralradius := proc(A::Matrix)
 local Spectrum;
 Spectrum := sort(abs~([fsolve(LinearAlgebra:-
 CharacteristicPolynomial(A,x)=0,x )]),`>`);
 Spectrum[1]
end proc:

 

One example: In general, the matrices I encounter come from adjacency matrices of graphs, which are always real symmetric. So their eigenvalues are always real. But the Eigenvalues command very slow because it's always trying to get the exact value. So If we use Eigenvalues  to find all the eigenvalues and then sort them, it will be very slow.  Thus  I'm thinking about finding the numerical results.


 

with(LinearAlgebra):
with(GraphTheory):
G2:=Graph({{1,2},{2,3},{3,1},{3,4}}):
A2:=AdjacencyMatrix(G2):
Eigenvalues(A2);

Vector(4, {(1) = -1, (2) = (1/3)*(1+(3*I)*sqrt(111))^(1/3)+(10/3)/(1+(3*I)*sqrt(111))^(1/3)+1/3, (3) = -(1/6)*(1+(3*I)*sqrt(111))^(1/3)-(5/3)/(1+(3*I)*sqrt(111))^(1/3)+1/3+((1/2)*I)*sqrt(3)*((1/3)*(1+(3*I)*sqrt(111))^(1/3)-(10/3)/(1+(3*I)*sqrt(111))^(1/3)), (4) = -(1/6)*(1+(3*I)*sqrt(111))^(1/3)-(5/3)/(1+(3*I)*sqrt(111))^(1/3)+1/3-((1/2)*I)*sqrt(3)*((1/3)*(1+(3*I)*sqrt(111))^(1/3)-(10/3)/(1+(3*I)*sqrt(111))^(1/3))})

(1)

evalsN:=evalf(%);

Vector(4, {(1) = -1., (2) = 2.170086486-0.4000000000e-9*I, (3) = -1.481194304-0.5062177830e-9*I, (4) = .3111078169+0.7062177830e-9*I})

(2)

``

(3)

with(Student):
SpectralRadius(A2)

2.170086487

(4)

 

Maybe I need a way to find all the numerical eigenvalues of a real symmetric matrix not using  CharacteristicPolynomial or Eigenvalues.

Download zlc_1.mw

function is F(x)= x-tanh(4*x/T) and diff(F(x))= 1-(4/T)*(1/T*Cosh(4*x/T)^2). x and t variable T max value=7, i want to do plots ising models function. Anyone can help me?

Graphich will be this 

https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTSo2BHyF5fvb8Dy6bWhELRAAIoaWmxp89G3w&usqp=CAU

Hi everyone.

Let M and N square matrices of same order (over finite fields).

Is there an easy way to find the positive integer "i" so that M^i - N = 0 ?

Best, Gustavo

Download Plot.mw

Is there any way to save "explore plot" in such a way that the slider of constants should appear in the extension file?

So that I can see the constant changing in the extension file too.

First 207 208 209 210 211 212 213 Last Page 209 of 2308