MaplePrimes Questions

I am trying solve on the outout of odetest, in order to determine range of which x makes this output zero.

It works sometimes and  does not work another times. I mean, it gives correct domain something, and other times, it overlooks some domain. 

Here is an example

restart;
ode:=x*diff(y(x),x)*y(x) = (y(x)^2-9)^(1/2):
ic:=y(exp(4)) = 5:
sol:=dsolve([ode,ic],y(x)):
res:=odetest(sol,ode);
solve(simplify(res),x,allsolutions = true) assuming real;

It is true than when x=1, then is zero.  But so all values x>1 as well.

How to get solve to find those values as well and not just x=1?

I tried PDEtools:-Solve as well. It did not better

PDEtools:-Solve(simplify(res),x,allsolutions = true) assuming real;

Compare to Mathematica

Are there other commands in Maple which could obtain all the solutions like in the above?

Maple 2020.2 on windows 10

 

 

My problem is a hickup in the Maple 2020 version as compared to earlier versions :

In the Maple 2020 listtorec from package gfun asks for unknown value u(0) in recognition of series.

Example from the Maple help page:

with(gfun);
l := [1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786];
rec := listtorec(l, u(n));
Error, (in gfun:-listtorec) invalid unknown function, u(0)

This error also happens with the second example in the Maple help page:

rec2 := seriestorec(series(add(l[i]*x^(i - 1)*(i - 1)!, i = 1 .. nops(l)), x, 12), u(n), ['egf']);
Error, (in gfun:-seriestorec) invalid unknown function, u(0)

How to feed this unknown value in the  call?
 


 

I have the following piece of code:

beta := 16250.25391;

tlow := 11.92817468;

y0 := t -> 1/4*4^(7/8)/(beta*(tlow - t))^(1/8);

r0 := 1;

r2 := 1.194444444;

r3 := -2.071877530;

dyr := t -> M*(-2*r0*diff(y0(t), t)/y0(t)^3 + 2*r2*y0(t)*diff(y0(t), t) + 4*r3*y0(t)^3*diff(y0(t), t));

plot(dyr(t))

Everything seems to work out fine until this point and I obtain a good plot. The problem occurs when I try calling the value of dyr at a specific point t. Here is an example:

dyr(5)
Error, (in dyr) invalid input: diff received 5, which is not valid for its 2nd argument

I understand there is something wrong with the diff part. I tried writing the following simple code and I have the same problem.

y := t -> t^2

z := t -> diff(y(t), t)

z(1);
Error, (in z) invalid input: diff received 1, which is not valid for its 2nd argument

I start with a function that has only one argument and it seems like introducing the diff requires that I use two arguments. y0 is a function of t solely and I would like dyr to have the same argument, so that I can call dyr(t) at any point t I want. Please take a look at this. Thanks in advance.

I can't figure exactly why adding export on module wide variable when using option package makes the variable not writable from a function inside the module

restart;

dsolver :=module()
option package;
export X::boolean := true;

export foo:=proc()
   dsolver:-X :=false;
end proc;
end module;

dsolver:-foo();

Error, (in foo) attempting to assign to `X` which is protected.  Try declaring `local X`; see ?protect for details.

But this works

dsolver :=module()
export X::boolean := true;

export foo:=proc()
   dsolver:X :=false;
end proc;
end module;

dsolver:-foo();

    false;

I wanted to make the variable export, so it can be set from anywhere (by other modules for example, directly). if I make it local, then other modules can no longer access it?

I know I can change the export to local as the error says. But why is this needed? Only thing I found so far, is this

"Not all modules are packages. Package semantics differ from module semantics in two ways. First, (module-based) package exports are automatically protected. Second, packages can be used as the first argument to"

So the above says function inside module, can't change module wide variable, if this variable is exprted, when using option package? Why?

In general, I am still not sure when to use option package or not. 

Are there any general rules as to when one needs to add option package vs. Not using this option? i.e. just use module() without this option? or the question is: When must one use option package?

I put everything (all modules) eventually in an .mla file and both cases work the same in this respect, so not sure when to use this option now. 

Maple 2020.2 on windows 10

Hello everyone;

There is itterative scheme and i have written a code. I want to know time and bytes used in each itteration. I have used the command "Usage" and code is showning results which are not right i thin becasue momery used should increase with itterations i.e., computaion is increasing so. CPU time is alos a issue here in my code.

Note: Code is also uploaded.

Thanks in advance. 

The code 

S:=sum(1/x__i,i=1..5)

will give us the following ouput

Why not 

S:=add(1/x__i,i=1..5)

 also give same result. why?How to do?

I also note that:

S:=add(1/x||i,i=1..5)

S:=sum(1/x||i,i=1..5)

 

Hey everyone,

f_1 and f_2  are satisfying the set of non-linear integral equations I have attached to this message.
I know that I need to solve them numerically by iterations. Probably, the first guest of the function f_1 and f_2  is the driving term. a is just a parameter which can be fixed (I guess smaller than \pi/4). * is the convolution product and k is the momentum space parameter. I learnt that in order to solve them I should solve them in the Fourier space. I know also that I need to discretize these function in the “real ” space between {-L,+L} before applying the FFT or one of its relatives. Thank you for any suggestions or leads.

Hi to all community. I am trying to integrate a lengthy-expression but could not get the result after waiting of 1 and 2 hours even. is there any way to control such integration


 

Integration_Help.mw

 

 


 

 

Hi, 

This is the context                                                                                             
A mathematical expression f has been coded by a two stage process of the form 

(u and s are character strings)
I do not know what f is, but I know what P1, P2 are and I know s too. 
I would like to recover f.

Here is the particular couple of coding processes that I consider

f := sqrt(x);    # assumed to be unknown

u  := sprintf("%Zm", f);                     # "process" P1
s  := StringTools:-Encode(u,':-base64');     # "process" P2

# The "inverse" of P2 is
v := StringTools:-Decode( s, 'encoding' = ':-base64' );

# Does it exist an operation to recover f from v?


Thanks in advance

 

Hey there, I´m new to maple and running into some syntax issues when calculating the Euler-Lagrange equation.

The Euler Lagrange equation in general looks like this:

I´ve got  the Lagrangian for my task figured out:

Here´s the code for this line, be aware that the function definition part of this is not working.

L:=((x),(varphi),t)->(J)/(2)*(((x))/(R))^(2)+(`m__R`)/(2)(*(x))^(2)+(`m__p`)/(2)(((x)+l*(varphi)*cos(varphi))^(2)+(l*(varphi)*sin(varphi))^(2))+`m__p`*g*l*cos(varphi)

phi is obviously a function of t, I´m not sure if I should have written phi(t)

 

In the first step to solve the Euler-Lagrange, I have to partially differentiate L w.r.t xdot. preferably with a command something like the following:

How do I do that, how do I set L up to be able to do that? The way I defined the function above is not correct because xdot and phidot cant be used an argument apparently.

If all is working perfectly I´d be able to partially differentiate L w.r.t xdot, phidot, x, phi and subsequently be able to differentiate the first two w.r.t t again.

I´ll spare you the detail but I´ve tried for hours now with redefining xdot as xdot:= diff(x(t),t) and all sorts of other ways but nothing seems to really work.

 

Thanks for your help.

Hi,

I have three equations in terms of the following variables:

X,Y,X1, X2

How do I get an equation in terms of (X1,X2)  with Maple from Equations 1-3?

E.mw

A very simple question (by example):

Consider two polynomials g and h:

with(PolynomialTools):

g:=FromCoefficientList([1,2,3],x);

h:=FromCoefficientList([4,5,6,7],x);

 

What is the syntax for computing the composition of g with h? (As a polynomial.)

For instance, I would like to use CoefficientList on the result.

 

I know the @ operator and the subs command and have tried using them in various ways, but with no success.

(Of course, my question is general; the above is just an example.)

---

Edit: Additional question (which is my real question):

I'm writing a procedure that takes two polynomials g and h, and in which I define an unknown polynomial f. I want to compute its coefficients so that

f "composition" g = h

I write:

fCoeff:=seq(a[i],i=0..t) (to define the unknown coefficients. I can compute t.)

f := FromCoefficientList([fCoeff],x);

Then I would like to do something like:

comCoeff:=CoefficientList(f "composition" g,x)

If I have this, then I know how to solve for the unkown coefficients in f.

Hello. Tell me, please, is it possible to somehow remove the labels on the axes in Maple when plotting graphs? I mean labels 1, 2, 3 and so on. Thank you for your help.

Maple will give error when one tries to make a variable of the same name as a Maple command. Which is good ofcourse. So this gives an error

Vector:=5;

But Maple also uses hundreds of other names, as options, which are not protected like this. Even when adding this

adding interface(warnlevel=4);
kernelopts('assertlevel'=2):

There was no warning when a user makes a variable of same name as one of those Maple option names.

So if a user make a variable with such a name, it will cause serious problem. For example Vector constructor takes the name row as an option. But this name is not protected. So one can write  row:=5 and there is no warning generated by Maple.

Using Vector['row'] does not actually help. Here is an example, where Maple crashes due to this

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):
A:=Matrix([[1,1],[2,3],[4,5]]);
row:=convert([a,b],Vector['row']);
res:=ArrayTools:-Concatenate(1,A,row); #this works, no problem

ArrayTools:-Concatenate(1,A,convert([a,b],Vector['row'])); #this will crash Maple

 

A workaround this, it to use double '' in the second call. Like this:

ArrayTools:-Concatenate(1,A,convert([a,b],Vector[''row''])); 

And if this to used again, to use

ArrayTools:-Concatenate(1,A,convert([a,b],Vector['''row'''])); 

And so on.  Ofcourse this is no way to do things.

So the user should not use row as variable name. May be use the_row instead, or a_row, and so on.

But this comes back to my question. The above is a made up example. How is the user supposed to remember there is some option used by Maple somewhere with such a name and avoid using it as a variable name? 

There are may be thousands of such names in Maple, with common names, like color and so on, and it is very easy to make a variable of this name by the user without noticing.

I also tried maplemint() and it gave no warning that a user variable have the same name as a Maple option name.

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):

foo:=proc()
local A,row,res,a,b;
A:=Matrix([[1,1],[2,3],[4,5]]);
row:=convert([a,b],Vector['row']);
res:=ArrayTools:-Concatenate(1,A,row); #this works, no problem
ArrayTools:-Concatenate(1,A,convert([a,b],Vector['row'])); #this will crash Maple
end proc;

maplemint(foo);

foo()

 

Finally, I found that if I use Vector(:-row) instead of Vector('row'), then the crash goes away and now it works

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):

foo:=proc()
local A,row,res,a,b;
A:=Matrix([[1,1],[2,3],[4,5]]);
row:=convert([a,b],Vector[:-row]);
res:=ArrayTools:-Concatenate(1,A,row); #this works, no problem
ArrayTools:-Concatenate(1,A,convert([a,b],Vector[:-row])); #this will now work
end proc;

foo();

But this worked because there was no global variable of the name row before calling foo. That is all. To make the above crash, all what I had to do is this
 

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):

foo:=proc()
local A,row,res,a,b;
A:=Matrix([[1,1],[2,3],[4,5]]);
row:=convert([a,b],Vector[:-row]);
res:=ArrayTools:-Concatenate(1,A,row); #this works, no problem
ArrayTools:-Concatenate(1,A,convert([a,b],Vector[:-row])); #this will now work
end proc;

row:=5;
foo();

And now it crashes again.

This is all a big mess. Maple should warn users they are using variable of same name as Maple own option names, or make all Maple option names use some standard prefix. May be have them all start with or _ and have this special first letter be allowed only for Maple own use.

This will help prevent name clashes.

In Mathematica, this issue does not happen. Since all Mathematica names and symbols used, even as options, are protected or are strings. So no such possibility of name clash happen.

Is there a 100% robust way in Maple to prevent such name clash between user variable names and names used as options to Maple commands?

 

First 202 203 204 205 206 207 208 Last Page 204 of 2173