Carl Love

Carl Love

28020 Reputation

25 Badges

12 years, 300 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

restart:

eq[1]:= 0.223569*c_1+2.35589*c_2*c_1^2+0.002356*c_1*c_2^2;

eq[2]:= 1.277899*c_1*c_3-2.350023*c_2*c_3^2+7.5856*c_3*c_2^2;

eq[3]:= 3.225989*c_1^2-2.35589*c_3*c_1^2-7.28356*c_3*c_2^3;

.223569*c_1+2.35589*c_2*c_1^2+0.2356e-2*c_1*c_2^2

1.277899*c_1*c_3-2.350023*c_2*c_3^2+7.5856*c_3*c_2^2

3.225989*c_1^2-2.35589*c_3*c_1^2-7.28356*c_3*c_2^3

fsolve({eq[1], eq[2], eq[3]}, {c_1, c_2, c_3});

{c_1 = -.288345360009260, c_2 = .329488436747954, c_3 = .587670492604662}

F:= unapply(<eq[1], eq[2], eq[3]>, c_1, c_2, c_3):

NewtonsMethod:= proc(F, x0, {maxiters::posint:= 99}, {epsilon::positive:= 10^(3-Digits)})
local
     x, y, z,
     J:= unapply(VectorCalculus:-Jacobian(F(x,y,z), [x,y,z]), x, y, z),
     X:= x0,
     newX:= <1,1,1>,
     err:= <1+epsilon, epsilon, epsilon>,
     k
;
     for k to maxiters while LinearAlgebra:-Norm(err)/LinearAlgebra:-Norm(newX) > epsilon do
          newX:= X - LinearAlgebra:-LinearSolve(J(X[1],X[2],X[3]), F(X[1],X[2],X[3]));
          err:= newX - X;
          X:= newX
     end do;
     if k > maxiters then  WARNING("Did not converge.")  end if;
     X
end proc:

NewtonsMethod(F, <-1, 2, 2>);

Vector(3, {(1) = -.288345360009260, (2) = .329488436747954, (3) = .587670492604662})

 

That's one solution. There are several others. Obviously < 0, 0, 0 > is a solution.

Download MultiNewton.mw

You have two separate problems. The problem that is preventing the plotting is that Pi in Maple is spelled with a capital P when you mean the well-known mathematical constant; lowercase pi is just a variable that prints the same way.

The problem with s(2) is that you haven't made s a procedure; rather, s is an expression. To make it a procedure, do

s:= theta-> piecewise(...);

and change the plot command to plot(s(theta), theta= 0.01..2*Pi) or plot(s, 0.01..2*Pi).

If you want to keep s as an expression, then to evaluate it at 2 do

eval(s, theta= 2);

Just use the collect command.

P:= (1+1/z)^2*(1+z)^2*(r[1]*z+r[0]+r[1]/z):
collect(%, z);

Maple does not ordinarily show negative exponents, using denominators instead; although the negative exponents do appear in the internal representation.

In some cases, it is necessary to use expand before collect.

Use dsolve followed by odeplot.

The next problem is your initial conditions. Clearly there is no solution for u1(0)=0, since u1(t) appears as a denominator in the system.

Sol:= dsolve(sys union {u1(0)=1, u2(0)=1, u3(0)=1}, range= 0..15, numeric):
plots:-odeplot(Sol, [u1(t),u2(t),u3(t)], t= 0..15);

A key observation is that an upper bound for the exponents is the base-2 log of the largest element.

f:= proc(ns::seq(And(posint, Not(identical(1)))), $)
local Ns:= [ns], M:= ilog2(max(Ns)), k, R:= Vector(1, [nops(Ns)]);
     if Ns=[] then  return []  end if;
     for k from 2 to M do
          R(k):= nops(select(n-> iroot(n,k)^k=n, Ns))
     end do;
     for k from M by -1 while R(k)=0 do  R(k):= ()  end do;
     convert(R, list);
end proc:

f(27);
                          
[1, 0, 1]
f(2,3,4,9,81,1024);
                
[6, 4, 0, 1, 1, 0, 0, 0, 0, 1]

Did you recently study a section on Bezier curves?

Start with a piece of graph paper. Write your name in large letters as simply as possible. Designate an arbitrary point on the paper as the origin (0,0). Mark all the significant points: endpoints, intersections, sharp turns. Get their coordinates. For the straight sections, just plot as the line segment between two points. For the curved pieces, pick two more "control points" in addition to the endpoints (the control points are not necessarily on the curves). Parmetrically plot the unique cubic Bezier curve for each group of four points (for each curve). Then put the plots together with plots:-display.

Your function definition doesn't work because the syntax of a function definition is

f:= (x,y)-> ...

not

f(x,y):= ....

But, instead of a function, it would be much easier to make f an Array, like this:

LL:= [[-11, -6, -1, 5, 5, 5, 5, 5], [-6, 1, 3, 6, 9, 9, 9, 9], [0, 5, 10, 13, 8, 6, 6, 6],
[9, 11, 12, 10, 10, 9, 9, 9], [9, 10, 11, 12, 12, 5, 5, 5], [11, 11, 11, 11, 10, 7, 7, 7],
[12, 12, 11, 13, 12, 7, 7, 7], [12, 12, 11, 11, 13, 8, 8, 8]]:
f:= 150+Array(0..7, 0..7, ListTools:-Transpose(LL)):
add(f[0,y], y= 0..7);
                              1236

Note that to save typing I made each original entry the difference of the number from 150. Then I added 150 to everything at the end.

Here's how (one way) to enter this system of PDEs into Maple. Like Preben, I need some clarification on the initial conditions.

restart:
alias(X= x(t,tau), Y= y(t,tau), Z= z(t,tau), Q= q(t,tau)):
xd,yd,zd,qd:= map(diff, [X,Y,Z,Q], t)[]:
xt,yt,zt:= map(diff, [X,Y,Z], tau)[]:
M:= (xt*(-Y-Z)+yt*(X+a*Y)+zt*(b-Z*(X-mu)))/(xt^2+yt^2+zt^2):
XM:= -Y-Z-xt*M:  YM:= X+a*Y-yt*M:  ZM:= b+Z*(X-mu)-zt*M:
pde1:= xd = XM+epsilon[x]*Q:
pde2:= yd = YM+epsilon[y]*Q:
pde3:= zd = ZM+epsilon[z]*Q:
pde4:= qd = a__x*XM+a__y*YM+a__z*ZM+beta*Q:

#Boundary conditions
BCs:= x(t,0)=x(t,2*Pi), y(t,0)=y(t,2*Pi),
     z(t,0)=z(t,2*Pi), q(t,0)=q(t,2*Pi),
     D[2](x)(t,0)=D[2](x)(t,2*Pi), D[2](y)(t,0)=D[2](y)(t,2*Pi),
     D[2](z)(t,0)=D[2](z)(t,2*Pi), D[2](q)(t,0)=D[2](q)(t,2*Pi)
:
#Initial conditions
# Need clarification on these.
ICs:= NULL:

#Parameters:
mu:= 1.85:  beta:= -2.23:  a:= 1/2:  b:= 3/4:
epsilon[x]:= -1/2:  epsilon[y]:= -1:  epsilon[z]:= -1/2:
a__x:= -1:  a__y:= 2:  a__z:= -1:

#Get the solution.
#The command is pdsolve, not dsolve, since these are PDEs, not ODEs.
Sol:= pdsolve({pde||(1..4)}, {BCs, ICs}, numeric):


Error, (in pdsolve/numeric) initial/boundary conditions must be defined at one or two points for each independent variable


How about

ex:= f(h*a[3]+x, y+h(a[3]-b[32])*k[1]+h*b[32]*k[2]):
mtaylor(ex, [x=0, y=0]);

Why not this?

xlist:=[seq(X1(i), i=1..10)]:
flist:=[seq(F(xlist[i],i), i=1..10)]:

The inner integrand has a singularity of order O(1/x^3) at x=0, so this can't be integrated over. This can be determined by looking at the leading term of the Laurent series.

f:= HankelH1(1, x*exp(I*Pi/4))^2/x;

series(f, x=0, 0);

 

Okay, here is a point plot in the complex plane of the roots of the numerator and denominator.

f:= 6*(20*z^5+137*z^4+450*z^3+850*z^2+900*z+420)
     /(300*z^6-1490*z^5+4197*z^4-7800*z^3+9600*z^2-7200*z+2520):
R1:= [fsolve(numer(f), complex)]:  R2:= [fsolve(denom(f), complex)]:
plot((L-> [Re,Im]~(L)) ~ ([R1,R2]), style= point, symbolsize= 16,
      legend= [numer,denom], labels= [Re,Im]);

The (only) command that you need to use is PDEtools:-dchange.

restart:
macro(E=E(x,y,z,t)):
PDE:= diff(E,x$2)+diff(E,y$2)+diff(E,z$2) = mu0*eps0*diff(E,t$2):
PDEtools:-dchange({x= r*cos(theta), z= r*sin(theta)}, PDE, simplify);

 

The error message indicates that broSet is not initialized. There needs to be a line somewhere such as

broSet:= {};

If that is not enough information for you to be able to solve the problem, then please post the whole code.

restart;
ode:= diff(y(t),t) = t*(1-0.3*t)-t*y(t)/(1+0.6*t):
ic:= y(0)=1:
Sol1:= dsolve({ode,ic}, numeric):
Sol2:= dsolve({ode,ic}, numeric, method= classical[foreuler], stepsize= 0.1):
P1:= plots:-odeplot(Sol1, [t,y(t)], t= 0..1, color= red, legend= rkf45):
P2:= plots:-odeplot(Sol2, [t,y(t)], t= 0..1, color= green, legend= euler):
plots:-display(P1,P2);

First 330 331 332 333 334 335 336 Last Page 332 of 395