Carl Love

Carl Love

28095 Reputation

25 Badges

13 years, 100 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

I suspect that what you created was a table, not a list. I'd be able to tell instantly if I saw your code. So, try

display(convert(plotlist, list));

I suspect that you did something like the below, which creates a table, not a list:

for k to 5 do
     plotlist[k]:= plot(x^k, x= 0..1)
end do:

There's nothing wrong with the above code; indeed, one of the best ways to make a list is to first make a table and then convert it to list.

Yes, I can confirm it. To workaround, include the option linestyle= solid. This is also required if you want to see the wireframe or grid or mesh lines of surface plots.

Your input has been mangled horribly by Maple's 2D-input. In particular, most of your function applications have been misinterpretted as multiplications. For example, x(t) has been changed to x*t in several places. This is probably because you entered x (t) rather then x(t). I suggest that you use the 1D-input: Go to the Tools menu, select Options, then the Display tab. From the Input display pull-down, select Maple notation. Then select the Interface tab. From the "Default format for new worksheets" pull-down, select Worksheet. Then click on Apply Globally. Then open a new worksheet and retype your program.

Do you mean that you want the abcissa to be the circumference of a circle of radius R?

R:= 5:
plot(
     [
          [cos(t)*(cos(7*t)+R), sin(t)*(cos(7*t)+R), t= 0..2*Pi],
          [R*cos(t), R*sin(t), t= 0..2*Pi]
     ],
     color= [red, black], axes= none
);

plot3d([cos(t)*sin(p), sin(t)*sin(p), cos(p)], t= 0..2*Pi, p= 0..Pi);

You wrote:

I have another question: ... how could I find the values of root on vertical axis? In this figure I want to know the value of F(0) that cut the vertical axis?

Simply enter F(0), or in this case K(0), and you'll get the answer, 1. How is it possible that you are working with Kummer and Heun functions, and yet you don't know this basic math? It's called the y-intercept.

Yes, there is a shortcut. This can be done with a single call to dsolve with three parameters. Then the returned procedure is used for all n plots, resetting the parameters for each one. One parameter is the random value, and the other two are the starting values of t and for the segment. This runs very fast if is set to 36.

n:= 3:
Ra:= RandomTools:-Generate(float(range= 0.1e-1..0.5, method= uniform), makeproc):

b:= 0.1e-2:
T:= 10:

eq:= diff(L(t),t) = A*L(t)-b:
sol:= dsolve({L(T0) = L0, eq}, L(t), parameters= [T0, L0, A], numeric):

sol(0):= [L(t)=100]: #Load remember table with first initial condition.
for i to n do
     sol(parameters= [T*(i-1), eval(L(t), sol(T*(i-1))), Ra()]);
     p[i]:= plots:-odeplot(sol, [t,L(t)], t= T*(i-1)..T*i)
end do:

plots:-display(convert(p, list));

 

z:= Int(f(t-s), s= 0..1):
F:= unapply(subs(s= convert(s, `local`), z), t);

F(s);

There's no ambiguity in the above result: The two ss are distinct, and only the global one is accessible by name.

eval(%, s= q);

Try D(f)(-1) instead of diff.

Change

add((aver[1]-ma[j][2][1])^2, j = 1 .. 3)

to

add((rhs(aver[1])-rhs(ma[j][2][1]))^2, j = 1 .. 3)

Here are three solutions. My preference is strongly for the third of these, which avoids the need for any assign statements and any unevaluation quotes. Note that in the first solution, each variable name is surrounded by two pairs of single quotes, not one pair of double quotes.


restart:

ma[1]:= [-885.880598855072776, [''bh''= 0., ''g0h''= 0., ''g1h''= 0.825946224722250e-4]]:

ma[2]:= [-877.957885609114328, [''bh''= 347.116836805625, ''g0h''= 0., ''g1h''= 0.164861392564e-3]]:

ma[3]:= [-863.445203144006655, [''bh''= 0., ''g0h''= 0., ''g1h''= 0.787090377403668e-4]]:

avb:= 90.5276611129000:  avg0:= 0:  avg1 := 0.92225359e-4:

for j to 3 do

     assign(ma[j][2]);

     A[j]:= [(avb-bh)^2, (avg0-g0h)^2, (avg1-g1h)^2]

end do;

[8195.257426, 0., 0.9275108611e-10]

[65838.00509, 0., 0.5275993377e-8]

[8195.257426, 0., 0.1826909404e-9]

restart:

ma[1]:= [-885.880598855072776, [0., 0., 0.825946224722250e-4]]:

ma[2]:= [-877.957885609114328, [347.116836805625, 0., 0.164861392564e-3]]:

ma[3]:= [-863.445203144006655, [0., 0., 0.787090377403668e-4]]:

avb:= 90.5276611129000:  avg0:= 0:  avg1:= 0.92225359e-4:

for j to 3 do

     assign(['bh', 'g0h', 'g1h']=~ ma[j][2]);

     A[j]:= [(avb-bh)^2, (avg0-g0h)^2, (avg1-g1h)^2]

end do;

[8195.257426, 0., 0.9275108611e-10]

[65838.00509, 0., 0.5275993377e-8]

[8195.257426, 0., 0.1826909404e-9]

restart:

ma[1]:= [-885.880598855072776, [bh= 0., g0h= 0., g1h= 0.825946224722250e-4]]:

ma[2]:= [-877.957885609114328, [bh= 347.116836805625, g0h= 0., g1h= 0.164861392564e-3]]:

ma[3]:= [-863.445203144006655, [bh= 0., g0h= 0., g1h= 0.787090377403668e-4]]:

avb:= 90.5276611129000:  avg0:= 0:  avg1:= 0.92225359e-4:

for j to 3 do

     A[j]:= eval([(avb-bh)^2, (avg0-g0h)^2, (avg1-g1h)^2], ma[j][2])

end do;

[8195.257426, 0., 0.9275108611e-10]

[65838.00509, 0., 0.5275993377e-8]

[8195.257426, 0., 0.1826909404e-9]

 


Download Three_solutions.mw

Here are two ways that rely on the fact that op(0,f(t)) extracts f:

D~(map2(op, 0, x(t))) =~ 0:
(D@(x-> op(0,x)))~(x(t)) =~ 0:

The first method is more efficient.

Your code refers to signum in the line defining eq. The signum requires an argument---signum of what? In other words, it should be signum(...with some algebraic expression in the parentheses. After you correct that, then proceed like this:

sol_2:= dsolve({cond, eq}, numeric, parameters= [X]);
sol_3:= proc(X)
     sol_2(parameters= [X]);
     eval(V(z), sol_2(3*l))
end proc;

Digits:= 4:
fsolve(sol_3);

I'm not sure about the precision control. You may need to adjust Digits or the error options of dsolve. I can't adjust it until you fix the signum.

 

You didn't enter the procedure dsnumsort (like we discussed before)! But, actually, with a small modification to the rest of the code, you don't need it. That procedure is just a very, very crude substitute for two-argument eval (or subs) applied to the result returned by dsolve. (It's amazing how bad the Maple code is in some otherwise great books---this one being Solving Problems in Scientific Computing Using Maple and Matlab by W. Gander & J. Hrebicek.) You just need to replace the line

X[i] := rhs(NsT[C1]); Vx[i] := rhs(NsT[V1]); Y[i] := rhs(NsT[C2]); Vy[i] := rhs(NsT[V2]);

with

(X[i],Y[i],Vx[i],Vy[i]):= eval([x(t),y(t),diff(x(t),t),diff(y(t),t)], NsT)[];

Use the above if you want to save the values XVxYYx, and MofI. If you just want the plot, then Preben's Answer suffices.

 

It's hard to figure out what exactly you're talking about without you providing an example. But, anyway, here's an example that may help. I create a random polynomial with several independent variables:

p:= randpoly([x,y,z,w]):

Now I extract the independent variables into a set. Note that the order that they appear in the set is not the order that I originally listed them. The order that they appear is actually well-defined, but it may appear random to you.

S:= indets(p, name);

     S := {w, x, y, z}

Now I loop through the independent variables, are get the derivative with respect to each.

for v in S do dpd||v:= diff(p,v) end do;

 

First 266 267 268 269 270 271 272 Last Page 268 of 395