Maple 2022 Questions and Posts

These are Posts and Questions associated with the product, Maple 2022

 About 6 years ago I aked  a question on testing types in a package. How to Test Input Typed to a Procedure to Determine what to do? - MaplePrimes.  @Carl Love supplied the very good code below. I never used the answer back then as I really didn't understand what to do with it. I have a somewhat of a better idea now and I really need to be able to use this in general..

 Basically the code checks that all the inputs are of the same type and order (which is what the original question specified).

 Q1:- I now need to check  a mixed input type

         A:: a 2 list , B a 3 list   

          or 

           A:: a 2 Vector, and B a 3 Vector.

         etc

       I tried modifying the ModuleApply part of the code at the end, but that either causes errors or kernal looses connection.

Q2:-  What is a good way to handle different numbers of inputs to procedures (exported) here eg Proc1(a), Proc2(a,b), ....,                   ProcN(a1,...,aN)

Q3:-    Would the package exports of the module be the procedures inside the Mydispatch? Or does all of MyModule sit inside                the  package module?

  I have three different packages I would like to apply this to in general.

restart

 

MyModule:= module()
uses TT= TypeTools;
global _T1, _T2L, _T2V, _T3L, _T3V, _MyType;
local
     MyTypes:= {_T1, _T2L, _T2V, _T3L, _T3V},
     AllMyTypes:= MyTypes union {_MyType},

     ModuleLoad:= proc()
     local
          g, #iterator over module globals
          e
     ;
          #op([2,6], ...) of a module is its globals.
          for g in op([2,6], thismodule) do
               e:= eval(g);
               if g <> e and e in AllMyTypes then
                    error "The name %1 must be globally available.", g
               end if
          end do;
          TT:-AddType(_T1, algebraic);
          TT:-AddType(_T2V, 'Vector(2, algebraic)');
          TT:-AddType(_T2L, [algebraic $ 2]);
          TT:-AddType(_T3V, 'Vector(3, algebraic)');
          TT:-AddType(_T3L, [algebraic $ 3]);
          TT:-AddType(_MyType, MyTypes)
     end proc,

     ModuleUnload:= proc()
     local T;
          for T in AllMyTypes do TT:-RemoveType(T) end do
     end proc,

     MyDispatch:= overload([
          proc(A::_T1, B, C)
          option overload;
          local r:= "A, B, C are T1."; #unnecessary; just an example.
               #statements to process this type
          end proc,

          proc(A::_T2L, B, C)
          option overload;
          local r:= "A, B, C are T2L.";
               #
          end proc,

          proc(A::_T2V, B, C)
          option overload;
          local r:= "A, B, C are T2V.";
               #
          end proc,

          proc(A::_T3L, B, C)
          option overload;
          local r:= "A, B, C are T3L.";
               #         
          end proc,

          proc(A, B, C)
          local r:= "A, B, C are T3V.";
               #
          end proc,
#
#I added this
#
          proc(A, B)
          local r:= "A, B, are mixed.";
               #
          end proc
     ]),
#
# I have have  added  'Or'(....(A::_T2L,B::_T3L)
#
     ModuleApply:= proc(
          A::'Or'(And(
               _MyType,
               satisfies(A-> andmap(T-> A::T implies B::T and C::T, MyTypes) )
          ),

          (A::_T2L,B::_T3L)),
          B::_MyType, C::_MyType
     )
          MyDispatch(args)
     end proc
;
     ModuleLoad()    
end module:
 

#Example usage:
#

x:=[9,4];
y:=[5,7];
z:=[1,9];                                 
MyModule(x,y,z);

[9, 4]

[5, 7]

[1, 9]

"A, B, C are T2L."

x:=[9,4];
y:=[5,6,7];
z:=p;                                 
MyModule(x,y);  #Looses kernel connection

[9, 4]

[5, 6, 7]

p

Download Q_19-11-22_Module_Test_Types.mw

Why is the Maple giving this error. See attched file. Further, how can we eq. of the form "A+B`*sqrt(C) = 0" by eliminating the common denominator.

CM_TW.mw

Dears

Can you give me advice on how to improve the calculation time for Binomial-Beta mcmc Metropolis-Hastings algorithm?

The calculation time for 50 000 samples for my laptop (Dell XPS 9710) takes approx 22 sec.
At the same time, in MathCAD Prime 8.0, the same amount of samples is calculated (using the same procedure) in approx 0.3 s.

======

======

I will be appreciated any help

wzelik

 

dchange gives the error when I try to convert pde into ode. Why?

restarts

with(PDEtools)

pde1 := diff(u(x, t), t)-(diff(u(x, t), `$`(x, 2), t))+3*u(x, t)^2*(diff(u(x, t), x))-2*(diff(u(x, t), x))*(diff(u(x, t), `$`(x, 2)))-u(x, t)*(diff(u(x, t), `$`(x, 3))) = 0

diff(u(x, t), t)-(diff(diff(diff(u(x, t), t), x), x))+3*u(x, t)^2*(diff(u(x, t), x))-2*(diff(u(x, t), x))*(diff(diff(u(x, t), x), x))-u(x, t)*(diff(diff(diff(u(x, t), x), x), x)) = 0

(1)

trans1 := {seq(var[i] = tau[i], i = 2), FN = Y(zz), var[1] = (zz-(sum(lambda[i]*tau[i], i = 2)))/lambda[1]}

{FN = Y(zz), var[1] = (-lambda[2]*tau[2]+zz)/lambda[1], var[2] = tau[2]}

(2)

ode1 := dchange(trans1, pde, [Y(zz), zz, seq(tau[i], i = 2)])

Error, (in dchange/info) the number of new and old independent variables must be the same. Found {zz, tau[2]} as new, while {FN, var[1], var[2]} as old

 

op(lhs(pde1))

diff(u(x, t), t), -(diff(diff(diff(u(x, t), t), x), x)), 3*u(x, t)^2*(diff(u(x, t), x)), -2*(diff(u(x, t), x))*(diff(diff(u(x, t), x), x)), -u(x, t)*(diff(diff(diff(u(x, t), x), x), x))

(3)

 

Download P_O.mw

I think I mentioned this before long time ago and never got any satisfactory answer. So I thought I will try again.

I never been able to figure why/how dsolve decides when to integrate the intermediate result vs. keeping the integral inert, even though it can integrate it.

It must use some rule internal to decide this, and this is what I am trying to find out.

Here is a very simple separable ode. So this is just really an integration problem.

restart;
ode:=diff(y(x),x)=(b*y(x)+sqrt(y(x)^2+b^2-1) )/(b^2-1);
dsolve(ode)

The first thing that comes to mind, is that Maple could not integrate it, that is why it gave inert integral. but it can integrate it but the result is a little long

int((b^2 - 1)/(b*y + sqrt(y^2 + b^2 - 1)),y)

So it could have generated the above implicit solution instead. Now notice what happens when I make very small change the ode.

restart;
ode:=diff(y(x),x)=(y(x)+sqrt(y(x)^2+b^2-1) )/(b^2-1);
dsolve(ode)

In the above I changed b*y to just y and guess what, now maple will integrate it and give an implicit solution instead of an inert integral

In both cases, Maple is able to do the integration. But in first case, it returned an inert integral and in the second it did not.

my question is why?  Does it have a rule where if the size of the integral is larger than some limit, it does not solve it? Did it say,

     "I think this result is too complicated to the user, so I will keep the integral inert instead"

If so, what are the rules it uses to decide when to do the integration and when to keep it inert? Is it based on leafcount? number of terms? something else?

infolevel does not give a hint on this, as all what it says is that it is separable.

Any one has an ideas on this?

It appears that using 2D math can generate hidden characters that make code not run. 

It seems like a lot of people think that using 1D math is a no-brainer, as if it had all the advantages and no disadvantages.

I am trying to write code for an object. I was using 2D math, because the automatic formatting of the code (italics, bold) makes it much easier to see and understand the code. Then again, I ran into an issue I face sometimes which is that code that looks absolutely perfect can't be parsed. 

I read that we can convert the code to 1D math and we will see hidden characters messing things up but that doesn't seem to be the case (or at least I can't seem to see the extra character). And in any case, it is just maddening and not a productive thing to have to do.

Is 1D math really the best user experience that is available? Is there really a tradeoff between legibility and useability in Maple 2022?

This ode from textbook, and the solution is given in back of book and I verified it is correct.

odetest gives zero also when asked to verify the solution.

but when asked to verify both the solution and the initial conditions, instead of returning [0,0] as expected, it returns [the_ode,0]

Here is an example
 

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart

ode:=diff(y(x), x) = 2*(2*y(x) - x)/(x + y(x));
ic:=y(0) = 2;
booksol:=(x-y(x))^2/( y(x)-2*x)^3 = 1/2;

diff(y(x), x) = 2*(2*y(x)-x)/(x+y(x))

y(0) = 2

(x-y(x))^2/(y(x)-2*x)^3 = 1/2

#this returns zero, so maple agree the book solution is correct
odetest(booksol,ode)

0

#when adding ic, when does it not give [0,0] ?
odetest(booksol,[ode,ic])

[diff(y(x), x)-2*(2*y(x)-x)/(x+y(x)), 0]

 


How shoulld one interpret the above answer?

Download question_on_odetest_nov_14_2022.mw

Consider the following system of differential equations

sys := diff(y(x), x) = z(x)*f1(i), diff(z(x), x) = y(x)*f2(i)

where f1 and f2 are functions that depend on the current iteration. Ultimately, I'd like to index into an array that has the length of the number of iterations, to obtain a value that will be part of the differential equations. It's an array of random numbers, but I'd rather not have to generate them on the fly while dsolve is working.

I've been investigating the use of Events for this, but the documentation is quite atrocious and outdated (and I only know this because, for example, when I try to use certain arguments to dsolve some error messages show that the arguments have changed name)

I've read the documentation on events, and as far as I can tell after an hour or two, I am doing exactly what is in the documentation but not getting the expected result.

Here is a worksheet illustrating the issue: dsolve_events.mw

Basically there is a very simply system of two differential equations and I would simply like to see an event triggered when the dependent variable is above 2. 

This event has no useful interpretation, it was just my attempt at trying to get something to trigger (I have tried multiple things). As far as I can tell from the docs I am using an event specification of form 

[0, c(t,y(x)) < 0]: discrete event with a conditional trigger

ie, [0,2-x<0]

and when that is triggered I set i(x) to something like i(x)+1 (but even something as simple as assigning it to some constant like 7, given that the initial value i(0)=0, would allow me to check when the event is being triggered), where i(x) is defined as a discrete variable (my ultimate goal is to trigger the event on every iteration and have i be the iteration counter. I want to use this iteration counter in the equations)

I run the dsolve command, assign the result to a variable and then call, for example p(3). I would expect to see the event triggered and i(3) not equal to the initial value i(0). But the value of i(x) doesn't change.

The following example shows clearly that timelimit is still broken in Maple.

I tried this 10 times, and it hangs each time. I could wait 30 minutes and it still hangs. timelimit simply does not work. I set timelimit to 20 or 30 seconds.  This really makes developing software in Maple very difficult when timelimit itself hangs as it means the whole program comes to halt and becomes frozen and I see no workaround this problem.

 

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;

ode:=1/2*sqrt((diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)^2 + 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2)/a - 1/2*b^2*ln((2*b^2/a^2 + 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + 2*sqrt(b^2/a^2)*sqrt((diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)^2 + 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2))/(diff(y(x), x) - sqrt(-a^2*(a - b)*(a + b))/a^2))/(a^3*sqrt(b^2/a^2)) + 1/2*sqrt((diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)^2 - 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2)/a - 1/2*b^2*ln((2*b^2/a^2 - 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + 2*sqrt(b^2/a^2)*sqrt((diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)^2 - 2*sqrt(-a^2*(a - b)*(a + b))*(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2)/a^2 + b^2/a^2))/(diff(y(x), x) + sqrt(-a^2*(a - b)*(a + b))/a^2))/(a^3*sqrt(b^2/a^2)) - 1/2*b*ln(a^2*diff(y(x), x)^2 + a^2 - b^2)/a^2 - y(x) - _C1 = 0:

try
  print("Before calling timelimt on odeadvisor");
  timelimit(20,DEtools:-odeadvisor(ode,y(x)));
  print("Did not time out");
catch:
  print("TIMED OUT");
end try;

"Before calling timelimt on odeadvisor"

 


 

Does this hang on your version of Maple? I am using 2022.2 on windows 10.

I was hoping this problem with timelimit has finally been fixed in Maple 2022.2. From this post almost 2 years ago!  it says

"You will also be pleased to know that Maple 2021 addresses the timelimit() issue that you mentioned."

But it is clearly not yet fixed.

 

Some important observations

1) sometimes I noticed if timelimit is small (say 5 or 10), it does not hang. So it the above does timeout for you, please try with larger time out, say 40 or 60 seconds. Since it depens on how fast the PC is.

2)sometimes I  noticed if I close Maple and start new sesstion, the very first time it could timeout OK, but the second time it is called, it hangs. May be because the server caches something to cause this.

All this means, it is completely not predictable what wil happen when starting the maple run. I have no idea how long it will take from one time to another, or even if it will hang or not. For all the years I used Maple, I never had one single time where one run completed without having to restart it at least 2 or 3 times in order to reach the finish line.  This is in addition to all those server.exe crashing on its own many times in between. I noticed more and more of these in Maple 2022.2.  But that is for another topic.

The following screen shot showing one instance when I run the above timelimit (been wainting now for 15 minutes, using timeout of 30 second)., It shows Maple server taking 81% of the CPU

 

And the following is screen shot of the worksheet itself when I took the above screen shot

 

Download timelimit_hangs_on_odeadvisor.mw

 

 

I have an expression and I want to find its maximum value.

expr:=sin(sqrt(3)*t)*cos(sqrt(3)*t)*(sqrt(3)*cos(sqrt(3)*t) - sin(sqrt(3)*t))/3

It is easy to find its maximum value in a numerical form.

Optimization:-Maximize(sin(sqrt(3)*t)*cos(sqrt(3)*t)*(sqrt(3)*cos(sqrt(3)*t) - sin(sqrt(3)*t))/3)

[0.324263244248023330, [t = 1.39084587050767]]

The images of the expression is as follows.

 

But does it exist an acceptable maximum value in symbolic form?  As the function maximize seems to take a lot of time, I don't see any hope so far. Perhaps the expression is indeed complex.

maximize(expr)# it runs long time.

We try to find the derivative of expr and get some points where thier derivatives are 0.

s:=[solve(diff(expr,t),t)]
evalf~(s) # Some solutions seem to have been left out.

[0.7607468963 + 0.*I, -0.4229534936 - 0.*I, 0.2668063857 + 0.*I]

ex:=convert(expr,exp):
s:=[solve(diff(ex,t)=0,t)]:
s1:=evalf~(s);# choose the 6th item: 1.390845877 + (4.655829150*10^(-9))*I
fexpr := unapply(ex, t);
evalf(fexpr(s1[6]));
fexpr (s[6]); # a very long expression that is not quite acceptable.

-I/6*(-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) + 6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44)))*(-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(12*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) - 3*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44)))*(sqrt(3)*(-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(12*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) - 3*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))) + (-sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44))/(6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)) + 6*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)/sqrt(-(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3)*((1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3)*sqrt(3)*I - 2*I*sqrt(3)*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) + (1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(2/3) + 36*I*sqrt(3) + 2*(1404*I*sqrt(3) - 1396 + 36*sqrt(-3018 - 3018*I*sqrt(3)))^(1/3) - 44)))*I/2)

An interesting problem is that an acceptably concise expression (although it is very subjective) for the maximum value may not exist mathematically. But knowing this in advance is difficult.

Download compute_zlc.mw

During my reaserch on diffusion I am arrived at the integral with argument

exp(-1/sqrt(x^2 + 1)) which Maple is not able to solve.

If some experts in solving integrals is able to solve it please keep me informed.

The file in Maple 2022 is below

primes_integral_diffusion.mw

Procedure returns two values. I would like to print a comment after them if possible, without it being a returned value


foo := proc(a, b) 
local x, y; 
x := a^2 - b; 
y := b^2 - a; 
# return x,y, "test on foo"  # returns 3 values
return x, y, print(" tests on return"); end proc;

A, B := foo(6, 3);
                       " tests on return"

                         A, B := 33, 3  #would like "tests on return here"

 

I was trying New-Display-Of-Arbitrary-Constants-And-Functions- but found a small problem.

in my code I build the constants of integrations using parse("_C"||N); where N is an integer that can go up to as many constants of integration are needed. For example, for 4th order ode, there will be 4 of them.

I noticed only the first 2 come out using the nice c__1,c__2 notation, but anything after 2 ,they come out using old notation _C3, _C4.

Here is a MWE

restart;

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1346 and is the same as the version installed in this computer, created 2022, October 7, 13:4 hours Pacific Time.`

restart;

dsolve(diff(y(x),x)=1,arbitraryconstants=subscripted);
pdsolve(diff(psi(x,t),x$2)=0,arbitraryfunctions=subscripted);

y(x) = x+c__1

psi(x, t) = f__1(t)*x+f__2(t)

_C1

c__1

for N from 1 to 4 do
    parse("_C"||N);
od;

c__1

c__2

_C3

_C4

 


So now my solution comes out with mixed looking constants. Why does this happen for N>2?

Download problem_with_C.mw

So for now, I went back to using the old method of using alias as follows

restart;

alias(seq(c[k] = _C||k, k = 0..10)):

_C1

c[1]

for N from 1 to 4 do
    parse("_C"||N);
od;

c[1]

c[2]

c[3]

c[4]

 

Download problem_with_C_alias.mw

conjcl := proc(k, p, n) local t, L, q; L := []; t := 0; q := p^n - 1; while k*p^t <> k mod q do t := t + 1; L := [op(L), t mod q]; end do; return L; end proc

I'm fairly new to coding with Maple / in general, but basically for my course I need to do the following:
For each t=0,1,... I need to first check if kp^t = k mod (p^n-1), and if it isn't, I compute t mod (p^n-1) then add it to my list. The problem I have is I just can't seem to get it to work. I incliuded both the screenshot of the code and typed it out. Thanks in advance

First 24 25 26 27 28 29 30 Last Page 26 of 39