Preben Alsholm

13728 Reputation

22 Badges

20 years, 249 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

Why do you want a perfect echo of the input?

In some cases I see the point. As an example it may be a good idea to assign a differential equation to a variable and ending the assignment with a semicolon so the output is seen. This can prevent attempts to solve the wrong equation.

The purpose of seeing an echo of (5*x+4)/(3*x)=7 could be to catch an error like writing (5*x+4)/3*x=7. If that is the problem you could use 2D input, which I personally never do, however.

Why do you want a perfect echo of the input?

In some cases I see the point. As an example it may be a good idea to assign a differential equation to a variable and ending the assignment with a semicolon so the output is seen. This can prevent attempts to solve the wrong equation.

The purpose of seeing an echo of (5*x+4)/(3*x)=7 could be to catch an error like writing (5*x+4)/3*x=7. If that is the problem you could use 2D input, which I personally never do, however.

@Markiyan Hirnyk I said that the discriminant is 8*l^2 and that the roots are correct, and indeed they are, since (when l is real) {l,-l} and {abs(l),-abs(l)} are the same sets.

Maple's answer to the roots has the advantage that it is correct even if l is not real.

 

@Markiyan Hirnyk I said that the discriminant is 8*l^2 and that the roots are correct, and indeed they are, since (when l is real) {l,-l} and {abs(l),-abs(l)} are the same sets.

Maple's answer to the roots has the advantage that it is correct even if l is not real.

 

The discriminant of the polynomial:

pol:=(2+l^2-4*l)*n^2-(4-4*l)*n+2;
discrim(pol,n);
                                 2
                              8 l
and the roots of pol are correct.


The discriminant of the polynomial:

pol:=(2+l^2-4*l)*n^2-(4-4*l)*n+2;
discrim(pol,n);
                                 2
                              8 l
and the roots of pol are correct.


Did you mean

ode1:=(1/r^2)*diff(r^2*diff(u(r,t),r),r) =v(r,t);

ode2:= diff(v(r,t),t)=u(r,t);

IBC:={u(0.2,t)=1,u(0,t)=0.5,v(r,0)=0.01};

?



 

@shinelookat You can use odeplot like this,

plots:-odeplot(sol1,[x(t),y(t),z(t)],0..10,axes=boxed,thickness=3);

Animating the orbit can be done by asking for a number of frames as in

plots:-odeplot(sol1,[x(t),y(t),z(t)],0..10,axes=boxed,thickness=3,frames=50);

@shinelookat You can use odeplot like this,

plots:-odeplot(sol1,[x(t),y(t),z(t)],0..10,axes=boxed,thickness=3);

Animating the orbit can be done by asking for a number of frames as in

plots:-odeplot(sol1,[x(t),y(t),z(t)],0..10,axes=boxed,thickness=3,frames=50);

@Vaclav 

If you try

g:=sum((-p)^n*n/(factorial(k-n)*factorial(n)), n = 1 .. k);

you will see that p=1 is an exceptional case. It could be handled by taking a limit:

limit(g,p=1) assuming k::posint;

but notice that you get the generic result (not valid for k = 1) as mentioned earlier.

@Vaclav 

If you try

g:=sum((-p)^n*n/(factorial(k-n)*factorial(n)), n = 1 .. k);

you will see that p=1 is an exceptional case. It could be handled by taking a limit:

limit(g,p=1) assuming k::posint;

but notice that you get the generic result (not valid for k = 1) as mentioned earlier.

@mehrdadparsapour 

You also need to use D instead of diff in the IBC, e.g.

D[1,1](u[2])(L,t)=0 for the condition that the second derivative w.r.t. the first variable (i.e. x) of u[2] at x=L be zero for all times t.

@mehrdadparsapour 

You also need to use D instead of diff in the IBC, e.g.

D[1,1](u[2])(L,t)=0 for the condition that the second derivative w.r.t. the first variable (i.e. x) of u[2] at x=L be zero for all times t.

This reminds me that

int(exp(-x)/(1-exp(-x)),x=0..infinity);

still in Maple 15 results in Eulers's constant gamma.

The integral is obviously divergent. This is an old error.

For my own purpose I once made a procedure called ResizePlot.

It works like this.

1. Save your worksheet with default plot sizes (2D or 3D plots including arrays of plots).

2. Read the procedure ResizePlot from wherever it has been saved (e.g. 

read "G:/MapleDiverse/resizeplot.m";

assuming that it has been saved to the file "G:/MapleDiverse/resizeplot.m" (see below) )

3. The following command will resize the plots in the worksheet in the first location to height = 100 and width = 200 (pixels). The output file is the last argument. Remember the extensions in both places.

ResizePlot("G:/MapleDiverse/MaplePrimes/resizeTEST.mw",[100,200],"G:/MapleDiverse/MaplePrimes/resizeTESTsmall.mw");

The description and comments in the procedure are in Danish (sorry), but I bring it anyway:

#####################################

ResizePlot:=proc(inputfil::string,dim::list(posint),outputfil::string,{[arraybredde,Arraybredde]::posint:=0})
local fil,r1,r2,H,W,n,aw;
description "Input en streng, der angiver en sti til et eksisterende Maple-worksheet, en liste [H,W] bestående af ny højde og bredde for plots. Tredie argument er en streng, der angiver en sti til output-filen, der skal ende med '.mw' .
Output til 'outputfil' er et nyt Maple-worksheet med de nye plotstørrelser (i pixels).
2D- og 3D-plots får samme størrelser.
Hvis 'outputfil' allerede eksisterer, bliver den overskrevet.
Valgfrit argument er arraybredde=positivt helt tal, der angiver hvor mange procent af skærmens bredde plots i en array skal fylde. Default er den i listen 'dim' angivne bredde delt med 4 (da default-bredden i pixels er 400).
'Arraybredde' kan bruges i stedet.";
uses StringTools,FileTools;
##Vi kontrollerer, at filnavnene svarer til Maple worksheets
###
r1:=searchtext(".mw",inputfil,-3..-1);
r2:=searchtext(".mw",outputfil,-3..-1);
if r1 = 0 then error "Inputfilnavnet %1 skal ende med .mw",inputfil end if;
if r2 = 0 then error "Outputfilnavnet %1 skal ende med .mw",outputfil end if;
###
###Vi henter ny højde og ny bredde:
if nops(dim)<>2 then error "Listen skal bestå af 2 positive tal (højde og bredde)" end if;
H,W:=op(dim);
###Vi indlæser inputfilen som en tekststreng:
fil:=Text:-ReadFile(inputfil);
###Antal plots findes:
n:=nops([SearchAll("<Plot",fil)]);
print(cat("Antal plots = ",n));
###Vi erstatter gammel højde og bredde med ny:
fil:=RegSubs("(<Plot height=\")([-0-9]+)(\" type=\"[twohre]+-dimensional\" width=\")([-0-9]+)(\")"
= cat("\\1",H,"\\3",W,"\\5"),fil);
###Vi ændrer størrelsen på evt. arrays af plots.
if arraybredde>0 then aw:=arraybredde else aw:=round(W/4.) end if;
fil:=RegSubs("(layout=\"Maple Plot\"><Table[^>]+width=\")([0-9]+)(%\"[^>]+>)"=
cat("\\1",aw,"\\3"),fil);
##Vi gemmer strengen fil i outputfil og lukker derefter denne:
Text:-WriteString( outputfil, fil);
Text:-Close( outputfil );
end proc:

##Saving the procedure in the place I already referred to above:

save ResizePlot,"G:/MapleDiverse/resizeplot.m";

First 206 207 208 209 210 211 212 Last Page 208 of 230