acer

32328 Reputation

29 Badges

19 years, 318 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I'm glad that you've been able to make progress.

Now that you have found your own way, and for your amusement,

> restart:
> a:=proc(n) option remember;2+ln(procname(n-1));end proc:
> a(0):=1.0:
> for i while abs(a(i)-a(i-1))>=1.0e-5 do end do:
> i, a(i);
                                13, 3.146191522

acer

I'm glad that you've been able to make progress.

Now that you have found your own way, and for your amusement,

> restart:
> a:=proc(n) option remember;2+ln(procname(n-1));end proc:
> a(0):=1.0:
> for i while abs(a(i)-a(i-1))>=1.0e-5 do end do:
> i, a(i);
                                13, 3.146191522

acer

Can you use fprintf or printf? Those won't insert a line break unless you explicitly include it ("\n").

acer

Can you use fprintf or printf? Those won't insert a line break unless you explicitly include it ("\n").

acer

I don't see exactly what you are trying to do. But there are quite a few issues in the code.

The situation is the same for n. It is declared local and gets used, but is unassigned , in both procedure cycvel and procedure treach.

In the test section, you call cycvel(pos,speed,L,vmax) but vmax is not assigned. Did you mean to pass some value instead?

There is a line in the posted code that is missing something. Possibly a cut'n'paste problem with this site. Namely,

else if pos[n] > end if; end if;

acer

I don't see exactly what you are trying to do. But there are quite a few issues in the code.

The situation is the same for n. It is declared local and gets used, but is unassigned , in both procedure cycvel and procedure treach.

In the test section, you call cycvel(pos,speed,L,vmax) but vmax is not assigned. Did you mean to pass some value instead?

There is a line in the posted code that is missing something. Possibly a cut'n'paste problem with this site. Namely,

else if pos[n] > end if; end if;

acer

Right. Of course. Thanks. So, charfcn[0] it is.

acer

> ztrans(charfcn[0](t),t,z);
                                       1


> ztrans(Heaviside(t),t,z);
                                       z
                                     -----
                                     z - 1

I'm not sure why it doesn't like Dirac(t).

That was all in Maple 6.

acer

Isn't the idea that it's better not to give full explicit answers to course work questions?

Anyway, the above is not correct. It is returning a[i] for the latest value of i. The result should be a[i+2] for the latest value of i, using the code given above.

acer

Isn't the idea that it's better not to give full explicit answers to course work questions?

Anyway, the above is not correct. It is returning a[i] for the latest value of i. The result should be a[i+2] for the latest value of i, using the code given above.

acer

This worked for me, using Maple 11.02.

> for i from 1 to 5 do
> plotsetup(ps, plotoutput="/tmp/test"||i||".eps",
>   plotoptions=`color,portrait,noborder,width=16cm,height=12cm`);
> plot(cos(i*x), x = -5..5);
> plotsetup(inline);
> end do;

I did it on Linux, and used /tmp/ as the base location. Modify the location for Windows accordingly. (Try backslash, perhaps?) The .eps files that came out were OK.

acer

This worked for me, using Maple 11.02.

> for i from 1 to 5 do
> plotsetup(ps, plotoutput="/tmp/test"||i||".eps",
>   plotoptions=`color,portrait,noborder,width=16cm,height=12cm`);
> plot(cos(i*x), x = -5..5);
> plotsetup(inline);
> end do;

I did it on Linux, and used /tmp/ as the base location. Modify the location for Windows accordingly. (Try backslash, perhaps?) The .eps files that came out were OK.

acer

"Substituting x=a^3, factoring, and then inverting that substitution on x."

It is similar to doing this,

> subs(a=x^(1/3), factor( subs(x=a^3,x-1) ) );
                        (1/3)        (2/3)    (1/3)
                      (x      - 1) (x      + x      + 1)

> subs(x=a^3,x-1);
                                     3
                                    a  - 1

> factor(%);
                                       2
                             (a - 1) (a  + a + 1)

> subs(a=x^(1/3),%);
                        (1/3)        (2/3)    (1/3)
                      (x      - 1) (x      + x      + 1)

See also the help-page ?@ for help on the composition operator.

acer

Someone suggested to me the following syntax and result,

   RootOf(sin(_Z), condition={cos(_Z)<0}) ,

   RootOf(sin(_Z)*_Z^2+sin(_Z)-2*_Z, condition={cos(_Z)>=0})

It uses a slightly different "fake syntax" from Doug's above. I like it because it looks even simpler as an encapsulation of the whole solution.

Checking the graphs is one way to see that both this and Doug's suggestion cover all the correct roots. Or do the algebra.

p1 := plot(signum(cos(x))-signum(x*sin(x)-1),x=-20..20,thickness=5,color=red):
p2 := plot(signum(cos(x)),x=-20..20,color=green):
g := sin(x)*x^2+sin(x)-2*x:
f := cos(x)-x*sin(x)+1:
pf := plot(f,x=-20..20,color=blue):
pg := plot(g,x=-20..20,color=black):
plots[display]([pf,pg,p1,p2]);

How can Maple have gotten by for so long without such a construct? Is there already some better formulation available?

acer

Sure, I did see where the other wrong answers were coming from. However, I was looking at (only) the sentence "Here, it appears that the only real problem is avoiding the zeroes where sin(x)=0, i.e. all multiples of Pi." I didn't see context to suggest that those other roots weren't covered by this. Sorry, if that was a misunderstanding.

How about RootOf(cos(_Z)-_Z*sin(_Z)+1) as a result? Isn't that at least better than RootOf(sin(_Z)*_Z^2+sin(_Z)-2*_Z)) being returned?

acer

First 520 521 522 523 524 525 526 Last Page 522 of 591