MaplePrimes Questions

I am trying to start writing small procedures in Maple. In the attached document I do not get an answer and I do not understand why. For clarity I have also added a working construct from another program so anyone willing to help me out can better understand what I am after.

Thanks in advance for assistance.

CDI_T_cor.mw

I was trying Maple 2021.2 on this pde I saw on the net, and noticed it gives some error messages. 

Are these to be expected and known?  

interface(version);

`Standard Worksheet Interface, Maple 2021.2, Windows 10, November 23 2021 Build ID 1576349`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1127 and is the same as the version installed in this computer, created 2022, January 3, 14:33 hours Pacific Time.`

restart;

PDE := diff(u(t, x, y), t) = VectorCalculus:-Laplacian(u(t,x,y),'cartesian'[x,y]);
bc := D[2](u)(t,0,y)=0,D[2](u)(t,1,y)=0, u(t, x, 0)=0,u(t, x, 3)=0;
ic := u(0, x, y) = f(x,y);
sol := pdsolve([PDE, bc,ic], u(t,x,y))

diff(u(t, x, y), t) = diff(diff(u(t, x, y), x), x)+diff(diff(u(t, x, y), y), y)

(D[2](u))(t, 0, y) = 0, (D[2](u))(t, 1, y) = 0, u(t, x, 0) = 0, u(t, x, 3) = 0

u(0, x, y) = f(x, y)

Error, (in assuming) when calling '`assume/NormalizeBoolean`'. Received: 'invalid input: type expects 2 arguments, but received 3'

restart;

PDE := diff(u(t, x, y), t) = VectorCalculus:-Laplacian(u(t,x,y),'cartesian'[x,y]);
bc := D[2](u)(t,1,y)=0, u(t, x, 0)=0,u(t, x, 3)=0;
ic := u(0, x, y) = f(x,y);
sol := pdsolve([PDE, bc,ic], u(t,x,y))

diff(u(t, x, y), t) = diff(diff(u(t, x, y), x), x)+diff(diff(u(t, x, y), y), y)

(D[2](u))(t, 1, y) = 0, u(t, x, 0) = 0, u(t, x, 3) = 0

u(0, x, y) = f(x, y)

Error, (in PDEAdvisor/2nd_order/Series/ThreeVariables) invalid input: has expects 2 arguments, but received 1

restart;

pde := diff(u(t, x, y), t) = VectorCalculus:-Laplacian(u(t,x,y),'cartesian'[x,y]);
bc := D[2](u)(t,0,y)=0,D[2](u)(t,1,y)=0, u(t, x, 0)=0,u(t, x, 3)=0;
sol := pdsolve([pde,bc], u(t,x,y))

diff(u(t, x, y), t) = diff(diff(u(t, x, y), x), x)+diff(diff(u(t, x, y), y), y)

(D[2](u))(t, 0, y) = 0, (D[2](u))(t, 1, y) = 0, u(t, x, 0) = 0, u(t, x, 3) = 0

Error, (in PDEAdvisor/2nd_order/Series/ThreeVariables) invalid boolean expression: NULL

 

Download pde_error_messages.mw

Some small differences is unavoidable ?

 

Its not symbolic that's why i don't get he same answers ?
Later on i will investigate some values for for this formula  

Riemanns formidabele formule

 

restart:

Volgens het boekje de riemanns hypothese : de functionaal vergelijking  (zonder bewijs)
Zeta(-z) = ((-2*factorial(z))*(1/(2*Pi)^(z+1)))*sin((1/2)*Pi*z)*Zeta(z+1)

Zeta(-z) = -2*factorial(z)*sin((1/2)*Pi*z)*Zeta(z+1)/(2*Pi)^(z+1)

(1.1)

Zeta(-z) = -2*z!*sin(Pi*z/2)*Zeta(z + 1)/(2*Pi)^(z + 1);

Zeta(-z) = -2*factorial(z)*sin((1/2)*Pi*z)*Zeta(z+1)/(2*Pi)^(z+1)

(1.2)

verg:=%;

Zeta(-z) = -2*factorial(z)*sin((1/2)*Pi*z)*Zeta(z+1)/(2*Pi)^(z+1)

(1.3)

verg2:= subs(z=2+3*I,verg);

Zeta(-2-3*I) = -2*factorial(2+3*I)*sin((1+(3/2)*I)*Pi)*Zeta(3+3*I)/(2*Pi)^(3+3*I)

(1.4)

verg3:= eval(verg,z=2.+3*I);

.1329711559-.1230533004*I = (2.450819690-44.87297744*I)/(2*Pi)^(3.+3.*I)

(1.5)

evalf(rhs(verg3));

.1329711558-.1230533005*I

(1.6)

lhs(verg3)=evalf(rhs(verg3));

.1329711559-.1230533004*I = .1329711558-.1230533005*I

(1.7)

lhs(verg3)- evalf(rhs(verg3));

0.1e-9+0.1e-9*I

(1.8)

 

Download post_naar_primes_over_triemanns_geweldige_formule.mw

I am working on a modelling (simulation) program for an rf system involving DDSs, rf mixers and other components. Each component is programmed as a submodule with methods (procs) and other exports, the whole shebang wrapped into a main package loaded using with(). A loop simulates a number of scenarios with differing starting conditions. Most calculations are numeric in nature.

The code runs but is too slow and in addition seems to keep allocating memory as the main loop runs. I suspect these two are related. I am using profile() to get an idea where the time is spent and where the memory gets eaten up.

I am doing the following:

profile(DDS__Boo:-SetTW,rf__Boo:-cycles,rf__SR:-cycles); # profile these three methods (procs):
.
.
.
# the main loop:
# Loop over injection cycles

for cycle from 1 to Cycles do
  tStartRamp:=(cycle-1)/2;
  c__B0:=cB0f(tStartRamp,tStartRamp);
  cB0List[cycle]:=c__B0;
  WBsum:=0;
  DDS__Boo:-ResetTW(tStartRamp);
#
  targetBucket:=targetList[cycle];
  delta__r:=trunc((r__end-0)/(Points-1));

  for ii from 0 to Points-1 do
    r:=ii*delta__r;
    DDS__Boo:-SetTW((r-delta__r/2)/f__clk,eval(W__Boo+ramp));
    WBsum:=evalf(WBsum+eval(ramp)*delta__r);
  end do:


  BooRfPeriods:=evalf(rf__Boo:-cycles((c__ex+targetBucket)/f__SR));
  SRRfPeriodsList[cycle]:=evalf(rf__SR:-cycles((c__ex+targetBucket)/f__SR));
  BooRfPeriodsList[cycle]:=BooRfPeriods-evalf(rf__Boo:-cycles(c__B0/f__SR)); # rf periods cB0 to extr.
  evalf(BooRfPeriodsList[cycle])/432; # Booster turns c__B0 to extr  
  targetErrors[cycle]:=(%-round(%))*432; # targeting error in bucket width
  DocumentTools:-SetProperty(RotaryGauge0,'value',cycle,'refresh');
end do:
# end loop

showprofile();
function           depth    calls     time    time%         bytes   bytes%
---------------------------------------------------------------------------
SetTW                  1    10240  230.877    51.52   22851828384    72.80
cycles                 1      110  108.607    24.24    4269176160    13.60
cycles                 1      110  108.607    24.24    4269176160    13.60
---------------------------------------------------------------------------
total:                 3    10460  448.091   100.00   31390180704   100.00

My question is: how do I interpret the table of results?

"time" is in seconds? (this should really be written in the Help files). Also, SetTW() and cycles() call other routines from the package, are they included in the times reported or not?

"bytes" is my biggest concern. "SetTW" has a whopping 22 GB against it. Since the total allocation goes up to about 290 MB in this particular run (per Maple's info line) this cannot be the total memory used. Can this be the total allocation (and most of it ending up as garbage and cleaned out)?? Even the 4 GB against cycles seems out-of-line.

The two lines for "cycles" are exactly the same even though the routines differ (belong to different instances of the module and operate on differnt parameters). Is profile aware of that, or not?

I realize that people like to see the whole program or worksheet; but given that this is dependent on a large-ish package and the sheet itself is of some size and difficult to penetrate for the uninitiated I want to spare you from trying to read it. Right now I need to understand what showprofile() is reporting. Once I better understand profiling, and if I need more help, I will try to make a MWE, but I am not that far yet. I did check the Programming Guide but I did not find the info I am looking for.

Thanks much for any insight you can share.

Mac Dude.

I have the following warnings. Could you help me fix the problem?

restart;

deS:=diff(x(t),t)=-0.5*x(t)*y(t)

diff(x(t), t) = -.5*x(t)*y(t)

(1)

deI:=diff(y(t),t)=0.5*x(t)*y(t)-0.15*y(t)

diff(y(t), t) = .5*x(t)*y(t)-.15*y(t)

(2)

with(DEtools):

DEplot([deS,deI],[x(t),y(t)],t=0..40,x=0..1,y=0..0.6,[[x(0)=0.99,y(0)=0]])

Warning, plot may be incomplete, the following errors(s) were issued:
   incorrect number of arguments, got 51, expected 50

 

 

 

 

Download DEtools_example.mw

Hello.

I have two terms r and g as:

r := x*(diff(theta(t), t))^2+y*(diff(varphi(t), t))^2;

g := (4*(f+T))*(diff(theta(t), t))^2+u*(diff(varphi(t), t))^2;

Now I want to equate these as r=g and find x and y

As we see, x and y must be 4*(f+T), and u, respectively.

I used "solve" and also "solve(identity....)" and "isolate" and also "eliminate" but all of them failed and I face another solution in which x has y !!!! for example, see the result for "solve(r = g, {x, y})"

However, I can use "coeff" and get the result, but in this case, indeed I write the solution, not maple, while I have this expectation that maple does these and give me the result:

coeff(r,(diff(theta(t), t))^2)=coeff(g,(diff(theta(t), t))^2);

coeff(r,(diff(varphi(t), t))^2)=coeff(g,(diff(varphi(t), t))^2);

This example is a simple one; in complicated cases, I must write more codes, for example, perhaps I must use isolate as well.... For this reason, I want to find a short and applicable code.

If it is possible, please help me to get a true result.

Thanks in advance.

I made this observation when comapring two expression containg elliptic integrals (see attached)

Such unevaluated complex output maybe be the reason why fsolve and plot sometimes did not produce output on similar expressions in another question I posted

https://www.mapleprimes.com/questions/233304-How-To-Find-The-Inverse-Function-Of

 

_zero_times_imaginery_unit.mw

I have been experiencing an error in the 2-D math text in Maple 2021. Every time I use the shift button the command seems to double. So if I for instance want to define A:=2 it will write; AA::==2 making the command useless. This only happens in 2-D math.

I have tried restarting Maple, my PC and uninstalling then installing maple 2021 again but nothing changes. This error appeared after updating maple the 6th of january 2022 to Maple 2021.2. I have a MacBook Air M1 2020. 

Please help as I have an exam soon

I am a Mathematica user actually. And I can know x^(1/(x + 1/x)) + y^(1/(y + 1/y)) == E is closed by the code:

ContourPlot[x^(1/(x + 1/x)) + y^(1/(y + 1/y)) == E, {x, 0, 7}, {y, 0, 7}]

But Mathematica cannot calculate this integral Integrate[1,Element[{x,y},ImplicitRegion[x^(1/(x+1/x))+y^(1/(y+1/y))>=E,{{x,0,7},{y,0,7}}]]]. It just can give a numerical solution by NIntegrate, This makes me depressed. So I try to calculate it by Maple. After I read some documentation of maple, I don't know how to use a implicit function to expression a region to do integral in MultiInt. So I ask here to help. Anybody can tell me how to write this code in Maple?

Hello, I'm using Maple 2021.2 to approximate the solution to a differential equation using a pseudospectral expansion in the basis of Hermite polynomials. After setting up some equations, I get a non-linear system of equations that I try to solve using the Maple's function solve, but Maple suddenly crashes during the execution of this function.

My code is the following:

HN := (n, y) -> exp(-1/2*y^2)*simplify(HermiteH(n, y))/sqrt(sqrt(Pi)*2^n*n!):

u7 := a0*HN(0, y) + a1*HN(1, y) + a2*HN(2, y) + a3*HN(3, y) + a4*HN(4, y) + a5*HN(5, y) + a6*HN(6, y):

resid := diff(u7, y $ 2) + 4*y*diff(u7, y)*u7 + 2*u7^2:

r := evalf(allvalues(RootOf(HermiteH(7, x), x)));
equations := {evalf(eval(u7, y = 0) - 1)};
for root_r in r do
    if root_r != 0 then
        equations := {op(equations), evalf(eval(resid, y = root_r))};
    end if:
end do:

solutions := solve(equations, {a0, a1, a2, a3, a4, a5, a6}):

Does anyone have any idea about what is happening? Is there any better way of solving a non-linear system of equations?

A user wonders if they can customize Maple output to show, for example x^2 instead of x2 in 2D output. 

We suggest they either set 

interface(prettyprint=0);

globally, or use

lprint(x^2)

for individual outputs. 

Hi,

I have a MapleFlow program that perform some symbolic calculations. To test the program, I assign a numerical value to a variable, say a:=1.6, in the middle of the program. I would like to clear the variable and continuing the program development using symbolic calculations. I've tried unassigning and restart but nome worked.

Any ideas?

This was asked before: https://www.mapleprimes.com/questions/233343-Drawing-Of-Complex-Numbers-On-A-Complex-grid-#comment283684

It really showed me what was going on. But now there is something else, that really does not look the like, i tried. But there is nothing that really looks like an answer for the b. question. "Draw the following collection in the complex plane".

There really is no explanation on how to handle the numbers in the |z| part and (z) part of the argument of question a. Also, adding imaginary numbers to the argument en the |z| part is really odd. Do i multiply those numbers with the x and y components in there?  

a.

plots:-inequal([1 <= 2*sqrt(x^2+y^2), 2*sqrt(x^2+y^2) < 2, (1/4)*Pi <= arctan(2*y, 2*x), arctan(2*y, 2*x) < 3*Pi*(1/4)], x = -3 .. 3, y = -3 .. 3, optionsopen = [linestyle = dash, color = red, thickness = 2])

 

b.

plots:-inequal([1 < (4*I)*sqrt(x^2+y^2), (4*I)*sqrt(x^2+y^2) <= 1, (1/2)*Pi <= arctan((2*I)*(y, x)), arctan((2*I)*(y, x)) <= Pi], x = -3 .. 3, y = -3 .. 3, optionsopen = [linestyle = dash, color = red, thickness = 2])

 

``

This really helps out a lot if someone could explain this to me. 

Thank you!

Greetings,

The Function

Download Mapleprimes_Book_2_Question_3.1.mw

hello 
i have a long proc i am defining in a loop inside the proc for some reason it calculates the value of a1[j+1] and a2[j+1] and assigns it(in the case of the picture j=1 and in j=2 it doesnt sub) but when it is called again in the next iteration  it doesnt sub the value it just calcluated ! 
i would be so thankful for any help ive been stuck on this for a while now 

First of all I would like to wish everyone a happy, prosperous and especially healthy 2022!

I do not understand why my second formula in the attached sheet gives the wrong answers. I have added the correct answers in the vector "Correct". I still find it a bit cumbersome to work elementwise in Maple but that is most likely because still being relatively new to the program. Any help is more than appreciated 

Elementwise.mw 

First 6 7 8 9 10 11 12 Last Page 8 of 2086