MaplePrimes Questions

How do I make find and replace work?  Currently the replace and find button is grayed out.  What magic gets me into a state where the button can be used?

Thanks

P.S. Is there any "package" or "mode" or way some how that emacs key bindings can be made to work (including things like find and replace)?  The user interface would be much improved if I knew how to enable that.

Hi everyone,

I need some help with the following error,

How can i solve this problem?

Thanks for your time

Best regards,

Canberk

Hello,

I would to understand a code that I have where the structure of packages are often using a local variable in a particular way. A variable local _DO_CONSTRAINT with the same name as the procedure DO_CONSTRAINT is created.

The code is the following :

module () 
local _DO_CONSTRAINT; 
export DO_CONSTRAINT; 
option package; 

_DO_CONSTRAINT:=proc (phi::list, varslist::list) 
table([obj = CONSTRAINT, expr = phi, vars = varslist]) 
end proc

DO_CONSTRAINT:=proc (phi::{list, scalar}, vars::{list, scalar}) 
if type(phi, scalar) and type(vars, scalar) then 
_DO_CONSTRAINT([phi], [vars]) 
elif type(phi, list) and type(vars, list) and nops(phi) = nops(vars) then 
_DO_CONSTRAINT(phi, vars) 
else ERROR("The number of expressions <phi> and variables <vars> are not equal") 
end if 
end proc

end module
 

Question :
1) It seems me that this technique enable to adapt the procedure  (DO_CONSTRAINT) to different types of inputs that we can try on it (lists or scalars). Do I right ? May you give me more informations on how it works ?
2) Is it the only possibility to do this ? In other words, is there a possibility to make a similar code and also concise but without using this local variable ?

Thanks a lot for your help.

 

I having a hard time with defining a vector, in order to store in it some data, then plot it and export it to a file, I copied all what's in the help instructures but it doesn't work everytime, please it's urgent for my PhD thesis !

E_T := (2/mu-2/r)*exp(-r/mu)*Pi^2;

How do I extract the numbers out of the equation, so it becomes

2*Pi^2*(1/mu-1/r)*exp(-r/mu) instead? 

Hi, I was wondering, as stated in the title, if it is possible to plot/draw a triangle knowing only the sides and angles, and not the coordinates for each point making up its corners. If not, what would be the easiest way, to calculate the coordinates using the sides and angles (assuming I know the value for each side and corner) and then plot/draw it?

I'm rather green when it comes to using Maple, so if you could explain it in a simple way that would be appreciated. 

I try to solve numerically a boundary VP for ODE with different order of discontinuity of right part.

Say, the following BVP is given:

y''(x)+y'(x)+y(x)=F(x)

y(0)=1, y(2)=1

Let's use piecewise right part

F  := piecewise(x<=1, -x, x>1, 2*x+(x-1)^2)

plot(piecewise(x<=1, -x, x>1, 2*x+(x-1)^2), x=0..2,thickness=5)

The function

piecewise(x<=1, 1-x, x>1, (x-1)^2)

plot(piecewise(x<=1, 1-x, x>1, (x-1)^2), x=0..2, color=blue,thickness=5)

as obviuos, satisfies the BVP exclung the point x=1, where its 1st and 2nd derivatives are discontinuos.

Numerical solution

N0:=6:
As:=dsolve([diff(y(x), x$2)+diff(y(x), x)+y(x)=F,  y(0)=1, y(2)=1], y(x), type=numeric, output = Array([seq(2.0*k/N0, k=0..N0)]), 'maxmesh'=500, 'abserr'=1e-3):

provides the solution essentially different to exact one described above:

But if to use the right part

F := piecewise(x<=1, x^2+x+2, x>1, -x^2+x)

plot(piecewise(x<=1, x^2+x+2, x>1, -x^2+x), x=0..2, color=blue,thickness=5)

for which the function

piecewise(x<=1, 1-x+x^2, x>1, -1+3*x-x^2)

plot(piecewise(x<=1, 1-x+x^2, x>1, -1+3*x-x^2), x=0..2, thickness=5)

satisfies the BVP excluding x=1, where this function has discontinuity of 2nd derivative only, the corresponding numerical solution is very similar to this exact solution:

This reason of the difference between these two cases is clear. In the first case both 1st and 2nd derivatives are discontiuos, while in the second one -- 1st derivative is contiuos.

I wonder, if there are numerical methods, implemeted in Maple, for numerical solution of the first type BVP with non-smooth right part?

Maple returns this: and I want to move the exp out of root so it becomes exp(

Ex3 := Pi*sqrt((4/mu+4/r)*exp(-r/mu))

and I want to move the exp out of root so it becomes exp(-r/2*mu), and I want to take the 4s out so it become 2*Pi instead of just Pi.  How do I do it? thank you for all the help

Hello dear Maple,

My name is Bulat, I'm student of Kazan National Research Technical University ( Russia). In our High Program we used your product ( Maple V, Release 4). Now I have two problems and I haven't no idea how I resolve their. I am forced to ask for your help. I upload PrintScreen of my two problems. Please help me to solve them. I' ll be grateful for your help. Sorry for my English :(.

Yours very truly, Bulat

I'm trying to use the Grid package to speed up my computations somewhat, however Grid[Map] does not seem to play well with add.

Erroran := proc (e, g, f, T)
 local k, errorterm, terms, n, ma, i;

 ma := proc (n) options operator, arrow; evalf(T*(1/2)*maximize(int(f*f, x = 0 .. 1)-add(int(f*sqrt(2)*sin(k*Pi*x), x = 0 .. 1), k = 0 .. n), s = 0 .. T)/(Pi*Pi)) end proc;

 errorterm := proc (n) options operator, arrow; int(g*g, x = 0 .. 1, numeric)-add(int(g*sqrt(2)*sin(k*Pi*x), x = 0 .. 1, numeric), k = 1 .. n)+ma(n) end proc;

 i := 1;

 while e < Grid[Map](errorterm, i) do i := i+1 
end do;
 return i
 end proc

h := piecewise(x <= 0, 0, 0 < x and x < 1, 3, x >= 1, 0)

Erroran(0.1e-3, h, 1, 1)

 

When I run the above code I get the error "Error, (in Grid:-Map) unable to execute add." Does anyone know of a workaround to this? Or another way to speed up my code? If so it would be much appreciated. 

The code works perfectly well if I don't use Grid and just use "errorterm(i)" in my while loop instead.

Hi,

Ive been trying to use the global optimization toolbox to optimize a model I extract from the maplesim environment.
It works fine with the regular Optimization toolbox. but when I run the optimization on the Global toolbox I get this error:

Warning, Error at t=0.0000000000000000e+000: index-1 and derivative evaluation failure

to explain a little,
I use the getCompiledProc command to turn the maplesim model into a module to be used in maple.

pjf

with(plots):
with(Grid):

HeatPC := proc (f, g, n, lambda, N, T)
 local k, u, i, L,fcoef;
 fcoef := proc (y) options operator, arrow; sqrt(2)*sin(lambda*y) end proc;
 u := proc (y, t) options operator, arrow; sum((int(fcoef(x)*g, x = 0 .. 1, numeric))*exp(-k*lambda*t)+exp(-k*lambda*t)*(int(exp(k*lambda*s)*(int(f, x = 0 .. 1, numeric)), s = 0 .. t, numeric)), k = 1 .. n) end proc;
 L := [Grid[Seq](plot(u(x, (i*T-T)/N), x = 0 .. 1, color = COLOR(HUE, i/N), legend = typeset((i*T-T)/N, "s")), i = 1 .. N)]; 
return u(1, 1), display(L, legendstyle = [location = right])
 end proc;

h := piecewise(x <= 0, 0, 0 < x and x < 1, 3, x >= 1, 0)

HeatPC(1, h, 100, Pi, 10, 1.5)

I'm trying to use the above procedure to plot graphs for different inputs. To make the code easier on the eye I want to split my main function u into several smaller functions. To that end I added the function fcoef. Now when I try to run the procedure for simple input values I get the error "Warning, expecting only range variable x in expression 100.*int(fcoef(x)*piecewise(x <= 0.,0.,0. < x and x < 1.,1.,1. <= x,0.),x = 0. .. 1.) to be plotted but found name fcoef". However u still evaluates nicely at (1,1) so obviously my function fcoef is well defined. How do I go about getting plot to recognize this?

 

 

Dear Friends, 

I would appreciate your help in resolving some issues. Let me describe my dummy code and the issues I am having. 

1. I have two functions f(x,a) and g(x,a) are well defined. 

2. I need to get roots of f(x,a). I am using the command soln := Roots(f(x,a)) which gives me a list of all possible values of x. 

3. I need to choose only one element -- say x* -- from the list "soln" such that x*=argmax{g(x,a) | g(x,a)>0 for x in soln}.

I am not able to find a technique (i) to evaluate g(x,a) for all elements of the list "soln", (ii) and select x* that maximizes g(x,a). 

Picking and choosing elements of the list one by one is difficult since the number of elements in the list can vary with parameter "a" and it would complicate the matter in numerical studies. 

I would sincerely appreciate any inputs in this regard. 

Thank you,

Omkar

 

How can I get maple2016 to simplify sqrt(3579757) to 151*sqrt(157) ?

Hello.

Can I ask maple to give me a vector parametrization of any arbituary surface? Lets say I am given some surface in the form z=(g(x,y) or f(x,y,z).

In some cases finding a vector parametrization can be tidous and hard. I have looked at the algcurves help page, it is helpful in som cases but not that much for surfaces.

Lets for the purpose of this exampl say I wanted to obtain a parametrization for the torus (C-sqrt(x^2+y^2))^2+z^2=a^2

Is maple able to help me with this process beside making the plot and start the manual visualization and work?

First 1047 1048 1049 1050 1051 1052 1053 Last Page 1049 of 2428