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

The problem is that your procedure WindowN does not know what to do when passed a symbolic value of Ci. Remember that arguments are evaluated before they are passed, so it's trying to evaluate WindowN(RP0,Ci,CangleWidth+Ci).

There are two solutions. The first is to use unevaluations quotes on the call to WindowN:

'WindowN(RP0,Ci,CangleWidth+Ci)'

The second, the one I'd prefer, is to have WindonN return unevaluated when appropriate. Include this line near the beginning  of WindowN:

if not args[2]::realcons then return 'procname(args)' end if;

You can (and should) substitute the actual second parameter name where I have args[2].

First, you misspelled restart.

The type command will not apply any simplifications before checking the type. So, for example,

x:= (sqrt(3)-sqrt(2))*(sqrt(3)+sqrt(2)):
type(x, integer);
                         false

In other words, type only checks the properties that an expression has manifestly and explicitly. So, you need to simplify. Butthe simplify command is not good enough for this task. I did the following to your code:

p:=simplify((a+b+c)/2);
S:=expand(combine(sqrt(p*(p-a)*(p-b)*(p-c)), radical));
Now, setting N:= 4, I got 48 solutions in 5-8 minutes.

In Maple, an expression with an arrow (->) is equivalent to a procedure definition. So

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

defines f as a recursive procedure. All that is fine and legal in Maple.  Where you run into problems is when there is no base case to the recursion. Note that the error message was "too many levels of recursion", not "recursive assignment" which you would get if you attempted x:= x. The solution to your problem is to use unapply instead of the arrow, as Preben says.

I think that you have unfairly maligned Maple. Maple is no different in this respect from other languages that allow directly recursive procedures.

It seems that powsolve (and hence powseries) fails on this equation.

This dsolve solution doesn't explicitly derive one solution from the other, but it may be useful to you:

dsolve(myode, y(x), type= series);

Let V be the Vector of strings. Then do

sprintf(
     cat(
          "http://quandl.com/api/v1/multisets.csv?columns=",
          "%s," $ upperbound(V)-1, "%s"
     ),
     convert(V, list)[]
);

You need intial conditions for your system. I made up some completely arbitrarily for the code below. These are nonlinear ODEs, by the way---not that that distinction makes any difference in the code below.

sys:=
      diff(x(t), t) = 10*(y(t)-x(t)),
      diff(y(t), t) = x(t)*(28-x(t)) - y(t),
      diff(z(t), t) = x(t)*y(t) - 8*z(t)/3
;
ICs:= x(0)=1, y(0)=2, z(0)=3: #Initial conditions.
Sol:= dsolve({sys, ICs}, numeric):
plots:-odeplot(Sol, [x(t), y(t), z(t)], t= 0..100, numpoints= 10000);

With the specified initial conditions, y=0 is the complete solution. This is considered a linear ODE, by the way.

If you change the initial conditions to y(0)=1, D(y)(0)=0 and give the commands

ode:= x^2*diff(y(x), x$2) + x*diff(y(x), x) + x^2*y(x) = 0:
Order:= 11: #One more than the order of series that you need
dsolve({ode, y(0)=0, D(y)(0)=0}, y(x), type= series);

then you get

Add a table Color and add the color and legend options to the plot. Like this

(I had to add the tickmarks option to correct an unrelated bug.) Also add the variable Color to the list of locals. You can do the same with the option linestyle. The resulting plot is

And here's the updated worksheet: Equações_H,_S_e_G_(.mw

That a rather impressive thing you did with the try statements.

By adding the options abserr= 1e-4, relerr= 1e-4, minstep= .01 to the dsolve command, I was able to get the same plot that you showed in your link.

With the following changes, I get the plot in one minute. The most important change is making the interval of integration finite.

f:= x-> 1/(1+x^2):
u:= x-> Int(exp(-(x-xi)^2)*f(xi), xi= -infinity..infinity, digits= 5):
IntegrationTools:-Change(u(x), xi= tan(tau)):
u:= unapply(%, x);

plot(u, -10..10, numpoints= 50);

The command implicitdiff can also be used in the parametric case. Suppose that you have parametric equations x = cos(t), y = sin(t). If you want dy/dx, the command is

implicitdiff({x=cos(t), y=sin(t)}, {y,t}, y, x);

If you want d^2y/dx^2, it's

implicitdiff({x=cos(t), y=sin(t)}, {y,t}, y, x, x);

These results can be simplified, of course.

Since you mentioned polar plotting in your title, here's how to do both of your examples as polar plots:

plot(a*tan*~[1,-1], -Pi/2..Pi/2, coords= polar, colour= red);

plot(a^3*cos^3*sin^2, -Pi..Pi, coords= polar, colour= red);

It boils down to Maple's failure to simplify  arccos(x)+arcsin(x)  to Pi/2. But,

convert(arccos(x)+arcsin(x), arcsin(x));

So,

simplify(convert(eq1 - eq2, arcsin));

0

It is not clear what is meant by the eleventh coefficient. Does it mean the coefficient of (x-Pi)^11? That is 0---this series has no (nonzero) odd powers. Is the constant term (the coefficient of (x-Pi)^0) considered a[0] or a[1]? Does it mean the eleventh nonzero coefficient?

Once you answer those questions, the command coeftayl can be used to extract just the desired coefficient without giving you the whole series. If you want the eleventh nonzero coefficient, it is the coefficient of (x-Pi)^20:

coeftayl(exp(-(x-Pi)^2), x=Pi, 20);

which is 1/10!

Simply factor(a)

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