w-Teilchen

80 Reputation

5 Badges

8 years, 145 days

MaplePrimes Activity


These are questions asked by w-Teilchen

Hi everyone,

as a very basis example I've tried to get the equipotential lines of an 1/r² potential in the x-y-plane using contourplot. However, I obtained the following very strange result. Do you get the same mistake or is there something wrong on my end?

Thanks in advance,
Sören


 

with(plots):

plots:-contourplot(1/(x^2+y^2), x = -2 .. 2, y = -2 .. 2)

 

plots:-contourplot(1/(x^2+y^2), x = -2 .. 2, y = -2 .. 2, contours = 5, numpoints = 100)

 

plots:-contourplot(1/(x^2+y^2), x = -2 .. 2, y = -2 .. 2, contours = 5, numpoints = 1000)

 

plots:-contourplot(1/(x^2+y^2), x = -2 .. 2, y = -2 .. 2, contours = 5, numpoints = 10000)

 

``

Download contourplot.mw

Good day!

As part of an exercise I've calculated the length of a hypotrochoid numerically. To check my result I repeated the calculation in Maple, but received a different result. When double checking using WolframAlpha I got the same result as with my numerics. Maybe someone of you can tell me where I made a mistake.

Thanks in advance.
Sören


Link to WolframAlpha calculation: http://www.wolframalpha.com/input/?i=x%28t%29+%3D+%281-0.6%29+cos%28t%29+%2B+0.8+cos+%28+%281-0.6%29%2F0.6+*+t%29,+y%28t%29+%3D+%281-0.6%29+sin%28t%29+-+0.8+sin+%28+%281-0.6%29%2F0.6+*+t%29+from+t%3D0+to+6*pi

restart; with(VectorCalculus)

R := 1;

1

 

.6

 

.8

(1)

x := proc (t) options operator, arrow; (R-r)*cos(t)+d*cos((R-r)*t/r) end proc:

y := proc (t) options operator, arrow; (R-r)*sin(t)-d*sin((R-r)*t/r) end proc:

plot([x(t), y(t), t = 0 .. VectorCalculus:-`*`(6, Pi)]);

 

ArcLength(`<,>`(x(t), y(t)), t = 0 .. VectorCalculus:-`*`(6, Pi))

12.67823876+0.*I

(2)

diff(x(t), t);

-.4*sin(t)-.5333333334*sin(.6666666668*t)

(3)

diff(y(t), t)

.4*cos(t)-.5333333334*cos(.6666666668*t)

(4)

sqrt(VectorCalculus:-`+`((-.4*sin(t)-.5333333334*sin(.6666666668*t))^2, (.4*cos(t)-.5333333334*cos(.6666666668*t))^2))

((-.4*sin(t)-.5333333334*sin(.6666666668*t))^2+(.4*cos(t)-.5333333334*cos(.6666666668*t))^2)^(1/2)

(5)

simplify(((-.4*sin(t)-.5333333334*sin(.6666666668*t))^2+(.4*cos(t)-.5333333334*cos(.6666666668*t))^2)^(1/2))

(.4444444445+.4266666668*sin(t)*sin(.6666666668*t)-.4266666668*cos(t)*cos(.6666666668*t))^(1/2)

(6)

int(((-.4*sin(t)-.5333333334*sin(.6666666668*t))^2+(.4*cos(t)-.5333333334*cos(.6666666668*t))^2)^(1/2), t = 0 .. VectorCalculus:-`*`(6, Pi))

12.67823876+0.*I

(7)

int(((-.4*sin(t)-.5333333334*sin(.6666666668*t))^2+(.4*cos(t)-.5333333334*cos(.6666666668*t))^2)^(1/2), t)

-1.120000000*((0.2133333334e20*cos(.8333333334*t)^2-0.2177777778e20)*(cos(.8333333334*t)^2-1.))^(1/2)*(-1.*cos(.8333333334*t)^2+1.)^(1/2)*EllipticE(cos(.8333333334*t), .9897433186)/((0.2133333334e20*cos(.8333333334*t)^4-0.4311111112e20*cos(.8333333334*t)^2+0.2177777778e20)^(1/2)*sin(.8333333334*t))

(8)

evalf(VectorCalculus:-`+`(limit(-1.120000000*((0.2133333334e20*cos(.8333333334*t)^2-0.2177777778e20)*(cos(.8333333334*t)^2-1.))^(1/2)*(-1.*cos(.8333333334*t)^2+1.)^(1/2)*EllipticE(cos(.8333333334*t), .9897433186)/((0.2133333334e20*cos(.8333333334*t)^4-0.4311111112e20*cos(.8333333334*t)^2+0.2177777778e20)^(1/2)*sin(.8333333334*t)), t = VectorCalculus:-`*`(6, Pi)), VectorCalculus:-`-`(limit(-1.120000000*((0.2133333334e20*cos(.8333333334*t)^2-0.2177777778e20)*(cos(.8333333334*t)^2-1.))^(1/2)*(-1.*cos(.8333333334*t)^2+1.)^(1/2)*EllipticE(cos(.8333333334*t), .9897433186)/((0.2133333334e20*cos(.8333333334*t)^4-0.4311111112e20*cos(.8333333334*t)^2+0.2177777778e20)^(1/2)*sin(.8333333334*t)), t = 0))))

Float(undefined)

(9)

simplify(diff(-1.120000000*((0.2133333334e20*cos(.8333333334*t)^2-0.2177777778e20)*(cos(.8333333334*t)^2-1.))^(1/2)*(-1.*cos(.8333333334*t)^2+1.)^(1/2)*EllipticE(cos(.8333333334*t), .9897433186)/((0.2133333334e20*cos(.8333333334*t)^4-0.4311111112e20*cos(.8333333334*t)^2+0.2177777778e20)^(1/2)*sin(.8333333334*t)), t))

.9333333334*(1.-.9795918367*cos(.8333333334*t)^2)^(1/2)

(10)

``

Download hypotrochoid.mw

Hello guys,

I was just playing around with the Shanks transformation of a power series, when I noticed that polynomials aren't evaluated as I would expect.
I created this minimal working example; the function s should evaluate for z=0 to a[0], however it return simply 0.
Is there something I messed up?

restart

s := proc (n, z) options operator, arrow; sum(a[k]*z^k, k = 0 .. n) end proc;

proc (n, z) options operator, arrow; sum(a[k]*z^k, k = 0 .. n) end proc

(1)

series(s(n, z), z = 0)

series(a[0]+a[1]*z+a[2]*z^2+a[3]*z^3+a[4]*z^4+a[5]*z^5+O(z^6),z,6)

(2)

The value of s in z=0 should be a[0], however it returns 0:

s(n, 0)

0

(3)

s(1, 0)

0

(4)

Download evaluate_sum.mw

 

Thanks for your help,

Sören

Hi guys,

I'm doing some heavy analytical calculations, as the calculations take hours to finish, I want to save the results, which is easily done, however when I load the saved results, it behaves differently, somehow I can no longer substitute the variables. I extracted the main problem into the following minimal working example.

Thanks for any useful insight,

Cheers, Sören

restart():

assume(`in`(n, real))

x := n+1

n+1

(1)

subs(n = 1, x)

2

(2)

save x, "./myfunction.m";

read "./myfunction.m";

x

n+1

(3)

Now we can't substitute n in x:

subs(n = 1, x)

n+1

(4)

subs(n = 1, n+1)

2

(5)

y := x:

Download assume_and_save.mw

Hej guys,

in some of my Maple worksheets I'm using Maples fit-function to obtain a rational function fit to some data, as I'm interested in the zeros of enumerator and denominator, I chose my fit function accordingly. Afterwards I need to extract the results (mainly the zeros) and do some more calculation steps with them. When evaluating rational functions of high degree, I noticed that my way of extracting the results (I'm using patmatch) becomes increasingly slow up to the point where it takes a couple of minutes to extract 10 numbers.
E.g. the following minimal example (download link at the bottom) takes more than 20 minutes on my machine (Maple 18.01 Build ID 935137; Red Hat Version 6.6 running on system with an i5-3570, 8 GB of RAM). Additionally, the calculation requires an unreasonable amount of RAM.
I can work around the problem to some degree by extracting the leading coefficient beforehand, resulting in a substantial speed up, still I think that there might be some error in the code or my usage of patmatch.

Is there another way to extract these numbers in a similarly simple fashion?

Cheers,

Sören


restart

a pathmatch with 9 variables requires roughly 200 MB of memory and takes about 7 s to finish on an i5-3570 CPU:

p := (1+x)*(2+x)*(3+x)*(4+x)*(5+x)/((11+x)*(12+x)*(13+x)*(14+x));

(1+x)*(2+x)*(3+x)*(4+x)*(5+x)/((11+x)*(12+x)*(13+x)*(14+x))

(1)

pattern := (a__1::realcons+x)*(a__2::realcons+x)*(a__3::realcons+x)*(a__4::realcons+x)*(a__5::realcons+x)/((b__1::realcons+x)*(b__2::realcons+x)*(b__3::realcons+x)*(b__4::realcons+x)); patmatch(p, pattern, 'la'); assign(la)

(a__1::realcons+x)*(a__2::realcons+x)*(a__3::realcons+x)*(a__4::realcons+x)*(a__5::realcons+x)/((b__1::realcons+x)*(b__2::realcons+x)*(b__3::realcons+x)*(b__4::realcons+x))

 

true

(2)

a__1; a__2; a__3; a__4; a__5; b__1; b__2; b__3; b__4

1

 

2

 

3

 

4

 

5

 

11

 

12

 

13

 

14

(3)

a pathmatch with 9 variables requires roughly 2.2 GB (!) of memory and takes about 20 min (!) to finish on an i5-3570 CPU:

q := 9*p;

9*(1+x)*(2+x)*(3+x)*(4+x)*(5+x)/((11+x)*(12+x)*(13+x)*(14+x))

(4)

a__1 := 'a__1':

(a__1::realcons+x)*(a__2::realcons+x)*(a__3::realcons+x)*(a__4::realcons+x)*(a__5::realcons+x)*a::realcons/((b__1::realcons+x)*(b__2::realcons+x)*(b__3::realcons+x)*(b__4::realcons+x))

 

true

(5)

a;

1

 

1

 

2

 

3

 

4

 

5

 

11

 

12

 

13

 

14

(6)

NULL

Download patmatch-breakdown.mw

1 2 3 Page 1 of 3