Preben Alsholm

13471 Reputation

22 Badges

20 years, 249 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

When I commented that I didn't have a problem I executed both of your plots without a restart in between.

I do indeed have a problem if I only execute the latter plot command (the one with typeset).

The following works. Execute the whole thing.

restart;
with(plots):
plotsetup('bmp', 'plotoutput' = "F://try2.bmp");
plot(0,0..1);
pointplot([seq([i,i^2],i=1..100)],legend=typeset(F[u]));


There is a syntax error in ICs. It is D(x)(0) (not Dx(0)).

But it is worse:

eq := diff(x(t), t,t)+326.1*diff(x(t),t)+3190*diff(x(t),t)^2-37500*sqrt(x(t)*(0.165e-2-x(t)))+2.825=0;

ICs := x(0)=0, D(x)(0)=0;

sol := dsolve({ICs, eq}, numeric);

Initially x''(0) = -2.825. Thus x'(t) should decrease initially from x'(0) = 0. Thus x(t) shoul decrease from x(0) = 0. But the square root will then be imaginary.

Are you trying to plot the graph of a function of 3 variables? Not quite possible, right?

Of course you can easily plot f = exp(-(r-4)^2/4) as a function of just r.

I believe I never heard of a procedure 'sphericalplot'.

For the fun of it you could try this (where the idea of introducing z_cylindrical can be found in the help:

?plot3d,coords

f:=exp(-(r-4)^2/4):
addcoords(z_cylindrical,[z,r,theta],[r*cos(theta),r*sin(theta),z]);
plot3d(f,r=0..10,theta=0..2*Pi,coords=z_cylindrical,axes=boxed);

Maybe 'indets' can do what you want.

If you provided an example more detail could be given.

Again answering your latest question:

In order to make it possible to follow this I bring the whole code:

restart;
with(plots):
eq := z-> (H^2+(-1)*.27*(1+z)^3-(1/20000)*(1+z)^4)/(H^2)^.1 = .7299500000;
Y := z->if not type(z,numeric) then 'procname(z)' else fsolve(eq(z), H=1) end if:
p := dsolve({D(L)(z) = L(z)/(1+z)+(1+z)/Y(z),L(0)=0}, type=numeric, range=0..5,known=Y);
odeplot(p,[z,L(z)],0..5);

#The integral you are asking about:

R := evalf(Int(1/Y(z), z=0..10));

#If by undefined integral you meant to say indefinite integral (i.e. in this case something like G(z1)=int(1/H(z),z=0..z1) considered as a function of z1) then it is best to consider the systems approach used earlier and this time introduce a differential equation for G(z).

yp := implicitdiff(eq(z), H, z);
ode:=diff(H(z),z)=subs(H=H(z),yp);
ode2:=diff(G(z),z)=1/H(z);
p := dsolve({D(L)(z) = L(z)/(1+z)+(1+z)/H(z), ode,ode2,L(0)=0,H(0)=1,G(0)=0}, numeric, output=listprocedure);

odeplot(p,[z,G(z)],0..10);
Gp,Hp,Lp:=op(subs(p,[G(z),H(z),L(z)]));
Gp(10);

You are using G as a function, thus it must be defined as one:

G := Heaviside: #No x

int(G(x)*G(t-x), x = 0 .. 3);

If I'm correct in assuming that A has entries that are homogeneous polynomials then the problem is equivalent to asking the following question:

Given n  nxn matrices A_i.

Can we determine vectors b_i such that the sequence of equations A_i . z = b_i (i = 1..n) have a common solution vector z.

Solution: Pick any z-vector, and let b_i be determined by the equations.

As Axel Vogt suggests all int's have been replaced by Int's, and no evalf's are present. I let plot do that itself.

Re and Im have been replaced by evalc(Re(...)) and evalc(Im(..)). evalc makes the assumption that any variable name represents a real number as  in your case where t and epsilon are real. Thus assume(epsilon,real) has been removed.

In a couple of places superfluous Re's have been removed.

The plot took less than half a minute.

I have uploaded my revised version MaplePrimes10-11-0.mw

F := X-> Vector([f(X[1],X[2],X[3]),g(X[1],X[2],X[3]),h(X[1],X[2],X[3])]):

mtaylor~(F(X),[[X[1],X[2],X[3]]$3],3);
G := X-> Vector([exp(X[1])+X[2],(X[1]-X[2])^3]):

mtaylor~(G(X),[[X[1]=a,X[2]=b]$2],3);

Notice that you need a list of lists as the second argument for the elementwise operation to understand the situation correctly. The problem is that the second argument to mtaylor is a list with as many elements as F(X).

Something like this adapted to your situation:

 

for k to 5 do FileTools[Rename]( cat("F:/testfile",k,".bla" ), cat("F:/Newtestfile",k,".bla" ) ) end do;

There is a procedure Rename in the FileTools package.

What happens in the call F(2) is that x = 2 is passed to int, so that it reads -int(p(2),2), which is not acceptable since the second argument to int cannot be a number.

You can do like this:

p := x->10*x-20*piecewise(x < 2, 0, x-2);
F1:=unapply(-int(p(x),x),x);

#or like this:

F2:=x->-int(p(t),t=0..x);

# a third version

simplify(-int(p(t),t=0..x));
F3:=unapply(%,x);

The latter two versions use a definite integral, which also ensures that F(0) = 0 (if that is what you want).

For a start you could do something like

with(Student:-NumericalAnalysis);
Lx:=[$-10..10];
Ly:=[i^2$i=-10..10];
for i to nops(Lx) do f(Lx[i]):=Ly[i] end do:
op(4,eval(f));
Quadrature(f(x),x=0..9,partition=9,method=trapezoid);

You will need to do some interpolation to get the integral from 0.5 to 9.1.

With Maple 6 came the LinearAlgebra package. It replaced the old linalg package. Not quite true of course since the linalg package is still part of Maple because of backwards compatibility.

At the same time 'Matrix' and 'Array' were introduced and replacing 'matrix' and 'array', again not quite true.

For 'matrices' the multiplication operator is `&*`, where it is `.`for 'Matrices`.

Try this

A:=LinearAlgebra:-RandomMatrix(2);
B:=LinearAlgebra:-RandomMatrix(2);
A&*B;
C:=evalm(%);
whattype(C);
type(C,Matrix);
type(C,matrix);

For 'Matrices' I have been using `&.`as a neutral operator which is sometimes convenient in exhibiting structures. Then I have extended 'value' to do what eval does below:

A&.B;
eval(%,`&.`=`.`);

restart;
vars:=[a,b,c,d,e,f,g,h,i,j,k]:
for ii from 1 to 10 do
p[ii]:=randpoly(vars,degree=1,homogeneous);
end do:
res:=table():
for var in vars do res[var]:=nops(select(has,[seq(p[ii],ii=1..10)],var)) end do:
eval(res);

First 144 145 146 147 148 149 150 Last Page 146 of 158