Preben Alsholm

13728 Reputation

22 Badges

20 years, 243 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

`simplify/size/size` is just an example of a quoted name. Another (made up one) is `Once upon a time`.

The quotes are needed in the first case to prevent the two slashes from being interpreted as division signs. In the second case quotes are needed because spaces are not allowed in unquoted names.

See ?names

As far as I checked, the result of dsolve/numeric is correct.

How did you get your shooting and finite difference results? And what did you find for D(theta)(0)?

You may want to give us some details, but in the meantime you can try the following.

restart;
p1:=proc(x) x:=5 end proc:
p1(4);
p2:=proc(x,y) y:=5; x^2 end proc:
p2(3,k);
k;
p2(3,k);
p3:=proc(x,y::uneval) y:=5; x^2 end proc:
p3(3,hh);
p3(3,k);
k;
hh;

You may try this.

with(plots):
p1:=polarplot([cos(t), sin(t), t = (1/16)*Pi .. 3*Pi*(1/16)],color="Green",thickness=4);
plottools:-getdata(p1);
A:=%[-1]:
B:=< <0|0>, A>;
p2:=polygonplot(B,color=blue,style=patchnogrid);
display(p1,p2);

You don't tell us what f is, but my guess is

f:=x->-1+exp(-x);

#So you can do as follows
int(diff(f(x),x)*f(t-x),x=0..t);
combine(expand(%));

Or using the laplace transform and assuming that f(0) = 0 we can find f:

f:='f':
A:=int(diff(f(x),x)*f(t-x),x=0..t);
with(inttrans);
eq:=laplace(A,t,s) = laplace(1-exp(-t)-t*exp(-t),t,s);
solve(eq,{laplace(f(t),t,s)});
map(invlaplace,subs(f(0)=0,[%]),s,t);



In the posted text several multiplication signs were missing.

eqns := {(x[1]+1)^2+y[1]^2 = (x[2]-1)^2+y[2]^2, (x[1]-c[1])^2+(y[1]-c[2])^2 = (x[3]-1)^2+y[3]^2, (x[2]-c[1])^2+(y[2]-c[2])^2 = (x[3]+1)^2+y[3]^2, y[1]*(x[3]+1) = y[3]*(x[1]+1), y[2]*(x[3]-1) = y[3]*(x[2]-1), (x[2]-c[1])*(y[1]-c[2]) = (x[1]-c[1])*(y[2]-c[2])};
vars := {x[1], x[2], x[3], y[1], y[2], y[3]};
#With my limited patience I didn't wait for a possible answer from 'solve', but proceeded to 'fsolve', which of course expects c[1] and c[2] to be of type numeric.
solve(eqns, vars);
fsolve(eval(eqns,{c[1]=1.234,c[2]=2.345}), vars);

You will see one problem when you do

f:=proc(expr::evaln)
unapply(expr,y::float,a::float, b::float)
end proc:

f(H);

f2:=proc(expr)
unapply(expr,y::float,a::float, b::float)
end proc:

f2(H);

So remove the type check expr::evaln.

 

As for the original question replace int() by evalf(Int()):

myint:= proc(u::float)::float;
evalf(Int(exp(x^6), x=0.0..u))
end proc:

'createcomp' I don't quite understand.

Instead of map you could use the elementwise operation trunc~ (Maple 13 and later) as in the following example. Incidentally be aware of the difference between 'trunc' and 'round'.

A:=LinearAlgebra:-RandomMatrix(5,generator=-9.0..9.0);
trunc~(A);
round~(A);

It should be 'Pi' not 'pi'.

If I read the picture correctly, then (here in Maple 12) do as follows:

Int(Int(Int(N^2*exp(-2*alpha*r^2)*r^2*sin(t),r=0..infinity),t=0..Pi),rho=0..2*Pi);
value(%) assuming alpha>0;

If you add type checking Compile works for me (both in Maple 12 and 15).

ggg:=(y::float,a::float,b::posint)->
(2*(-a+6*y^2*a^2+2*b*y^2*a^2+9*b*y^3*a .........

g:=Compiler:-Compile(ggg);

g(1.23,.89,2);

#That resulted in   6.39854925121287010

The commands

'264/6.';

and

264/6.;

both result in 44.00000000, so 246/6. automatically simplies to 44.00000000.

But

'eval(264)/6.';

evaluates to .1666666667*(eval(264))

which after the ditto command

%;

evaluates to 44.00000001 due to the roundoff.

You may also try

264;
%/6.;
r:=264;
'r/6.';
%;

sqrt(16-x^2) is defined in the entire complex plane, but you are obviously assuming that x is real and want  sqrt(16-x^2) to be so too.

You could try

f:=sqrt(16 - x^2);
solve({y=f,y^2>=0});
#and it won't hurt to plot (Maple's plotting procedure ignores imaginary output)
plot(f,x=-10..10);

restart;
p:=t->t-2*sin(t);
plot(p,0..2);
Digits:=32: #Need Digits to conform to your error tolerance remembering rounding
Error:=1;

x:=Vector(); #Will use programmer indexing as opposed to mathematical indexing

DesiredError:=1e-30;# (error tolerance)

x(1):=1.5; #(initial guess)

for n from 1 to 20 while Error>DesiredError do
  x(n+1):=evalf(x(n)-p(x(n))/D(p)(x(n)) );
  Error:=abs(x(n+1)-x(n));
end do:

x;
x(-1);
n;

In the line assigning 'zeros'there are 3 typos. It ought to be

zeros := [RootFinding:-Analytic(eq161,alpha,re=0..10,im=0..10,digits=8)];

However, I didn't get anything in a reasonable time in Maple 15, but did in Maple 12.

Instead I did as follows.

eq:=eq161/alpha^4:
solve(eq=0,alpha);
evalf(%);
eval(eq,alpha=%);
evalf(%);
#One nontrivial solution found!

#The 3d plot suggests that there are only real or purely imaginary solutions.

plot3d(eval(ln(abs(eq)),alpha=x+I*y),x=0..10,y=0..10,axes=boxed);

#Your expression has symmetry properties, which imply that if alpha is a solution so is I*alpha (and -alpha and -I*alpha). Thus we may restrict ourselves to real positive values of alpha.

plot([Re(eq),Im(eq)],alpha=0..10,-10..10,thickness=2);
#Attempting 'Analytic') on the following narrow rectangle exceeded my patience, so I restricted it as seen below.
#RootFinding:-Analytic(eq,alpha,re=0..10,im=-0.1..0.1);
RootFinding:-Analytic(eq,alpha,re=0..1,im=-0.1..0.1);
eval(eq,alpha=1/2);
RootFinding:-Analytic(eq,alpha,re=1..2,im=-0.1..0.1);
RootFinding:-Analytic(eq,alpha,re=4..5,im=-0.1..0.1);
RootFinding:-Analytic(eq,alpha,re=7..8,im=-0.1..0.1);

Here are two ways.

#First a general use of 'animate' (see help page for animate):

animate(odeplot,[LS1,dvars,t=0..T,axes=frame,numpoints=2400,color=blue,orientation=[-20,75],title="Lorenz Attractor"],T=0.1..55,frames=100);

#The second method is simpler, but relies on the fact that the plot procedure is odeplot.

odeplot(LS1,dvars,t=0..55,axes=frame,numpoints=2400,color=blue,orientation=[-20,75],title="Lorenz Attractor",frames=100);



First 129 130 131 132 133 134 135 Last Page 131 of 160