Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello,

I am currently doing this thing:

unapply(piecewise(x>37-0.25*t and x<37+0.25*t,-(11*sin(t/2+1.145)-10)*((x-37)^2)+(-3.5*sin(t)+ 1),10),x);

(It is used with "for t from 0 to 8 do *things* end do", hence why I use "t")

The problem I have is I don't want this (over) complicated function to go over y=10, but the conditions I tried were not working that well.

I saw on the Help page that it should be possible, but my attempts were unsuccessful...

Maple 2018.2 generates wrong latex in this example. In Latex a space in command name is important. So "\tau L" is not the same as "\tauL".  Since in the later case, Latex will complain that there is no command "\tauL"

Maple generates "\tauL" in the latex, when it should be "\tau L" in the following example, so the latex fails to compile because there is no command called "\tauL" in Latex.

Here is screen shot showing the problem and the Maple command to reproduce it

 

 

restart;
interface(showassumed=0);
pde :=  diff(u(x,t),t)=k*diff(u(x,t),x$2)+(exp(-c*t)*sin(2*Pi*x/L));
ic  :=  u(x,0)=f(x);
bc  :=  D[1](u)(0,t)=0, D[1](u)(L,t)=0;
sol:=pdsolve({pde,ic,bc},u(x,t)) assuming L>0,t>0,k>0;

latex(sol)

Any chance Maplesoft could fix this?

Possible workaround for now is to use something like "\newcommand{\tauL}{\tau L}" in preamble for this specific case.

 

Hello,

 

Assume we have the following "intervals" (I am not sure what is its formal name in Maple)

 

C :=[0,1/11],[1/11,1/9],[1/9, 1/7],[1/3,1/2],[1/2,1]

 

How can we get the "union" of these intervals? That is to say, obtain  [0,1/7],[1/3,1] 

 

Many thanks in advance for your comments and suggestions.

 

 

Hi,

I'm trying to plot a 3 dimensional vector equation of motion in Maple for my dissertation. The equation is as follows:

vec(vr) = (vb)*i + (vg*cos(Omega*t))*j + (vg*sin(Omega*t))*k

where Omega is the gyrofrequency, vb is the velocity parallel with the i direction, and vg is the perpendicular velocity of gyration. vg and vb are both in terms of the velocity of incidence and two angles, which are all just numerical values that I've introduced.

It should look like a helix spiralling around the i axis, but I'm fairly new to Maple and I've tried everything I can think of and I can't get it to work.

When I use plot3d it turns out looking like a sphere or a cylinder. When I use spacecurve, it doesn't work at all and I get the error message " Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct.".

 

Any help is greatly appreciated.

I am trying to find the number a and b (-20 < a < 20, -20 < b <20) so that two circles (x+1)^2+(y+3)^2 = 125 and (x-a)^2+(y-b)^2 = 225 cut at two points A and B and coordinates A and B are pairs of integers.
I tried
 

restart; L := []; 
for a from -20 to 20 do 
for b from -20 to 20 do 
for x from -20 to 20 do 
for y from -20 to 20 do 
if (x+1)^2+(y+3)^2 = 125 and (x-a)^2+(y-b)^2 = 225 and nops({a, b, x, y}) = 4 and x*y*a*b <> 0 then 
L := {op(L), {[a, b], [x, y]}} 
od: od: od: od:
nops(L); 
L

How to select the number a and b so that the system of equations (x+1)^2+(y+3)^2 = 125  and (x-a)^2+(y-b)^2 = 225 have two integral solutions. For example
 

restart; 
solve({(x-6)^2+(y+2)^2 = 225, (x+1)^2+(y+3)^2 = 125}, {x, y})


restart;

Digits := 32;

t0 := 1;

eq := 1-w*v^2-2*v*exp(-t/v);

equ := eval(eq, v = -t/ln(u));

us := solve(eval(equ, t = t0), u);

vs := -t0/ln(us);

plot(Re(vs), w = 0 .. 10, view = 0 .. 1)

 

 

I want to plot the solution of this equation, but it doesn't quite work. I tried to transform it, because I thought the singularity in the denominator of the exponential causes the issues.

any suggestions?

Dear all.

Trying to plot the function below:

         epsilon                                            
    f := ------- = 0.78417289325174246201875653872811303 + (
          2 Pi                                              
    -24.020590879328464004990474127244023 + Y 

      (671.68643760557259657756434855357346 + (
    -314.15926532756339731350799859659950 Y

       - 48.382487297515945228479754993851165)^2))^(1/2)

want the (x-axis) be epsilon/(2*Pi) and the y-axis is Y
implicitplot(f,epsilon=0..100,Y=0..10,numpoints=1000,axes=boxed,thickness=2,color=black,font=[1,1,20],tickmarks=[3, 3],linestyle=1);

many thanks in advanced.

example1 := (x -> (2 + 3));
example2 := (x -> int(1, y));

When I execute these, Maple evaluates the "2 + 3" into 5, but it does not evaluate the "int(1, y)" into "y". Why does it evaluate the former but not the latter?

Also, how can I modifiy example 2 so that it evaluates the "int(1, y)" and returns "x -> y"?

I try to plot this matrix as shown below and I keep getting this error. First how do I simplify these units? Secondly how do I plot this because it seems like it doesn't let plot with units.

 

Just a simple use of DataFrames.  Looking for a new flashlight, I decided to compile a small selection of flashlights for comparison.
 

interface(rtablesize = 20)

Type := `<,>`(LED, LED, LED, Incandescent, Incandescent)``

BType := `<,>`(AAA, AA, AAA, AA, AAA)

Make := `<,>`(Maglite, Maglite, Maglite, Maglite, Maglite)

Batteries := `<,>`(1, 2, 3, 2, 1)

Lumens := `<,>`(47, 245, 200, 14, 2)

Model := `<,>`(Solitaire, `Pro+`, XL50, mini, Solitaire)

Minutes := `<,>`(105, 135, 405, 315, 225)

Cost := `<,>`(17.49, 41, 46.99, 16.50, 10)

NULL

Note:The values for cost used is in Canadian dollars, and the stores for the prices taken were from the following - MEC, Lowes, Canadian Tire and Amazon.ca

NULL

NULL

NULL

Flashlight := DataFrame(`<|>`(Make, Model, Type, BType, Batteries, Lumens, Minutes, Cost), columns = `<,>`("Make", "Model", "Type", "BType", "Batteries", "Lumens", "Minutes", "Cost"))

_m652460160

(1)

NULL

numelems(Flashlight)

40

(2)

sort(Flashlight, "Cost")

_m653259008

(3)

sort(Flashlight, "Lumens")

_m629071232

(4)

NULL

No surprise that the cheapest and lowest light outputs were incandescent flashlights.  The list isn't very large so lets add a few more flashlights to our list

NULL

new1 := DataFrame(`<,>`(`<|>`(Thrunite, Ti3, LED, AAA, 1, 130, 30, 26.95), `<|>`(Police*Security, Stealth, LED, AA, 1, 80, 60, 7.99), `<|>`(Police*Security, Shield, LED, AA, 1, 120, 90, 15.99), `<|>`(Fenix, E12, LED, AA, 1, 130, 90, 37), `<|>`(Fenix, E20, LED, AA, 2, 265, 30, 50.75), `<|>`(Fenix, E05, LED, AAA, 1, 85, 45, 31.99), `<|>`(Maglite, mini, LED, AAA, 2, 84, 345, 22)), 'columns' = ["Make", "Model", "Type", "BType", "Batteries", "Lumens", "Minutes", "Cost"], 'rows' = [6, 7, 8, 9, 10, 11, 12])

_m624778752

(5)

F1 := Append(Flashlight, new1)

_m647087136

(6)

sort(F1, "Cost")

_m627084608

(7)

F2 := convert(sort(F1, "Cost", `<`), DataFrame)

_m650479744

(8)

Interesting to note that Police Security generally seems to be the cheapest.

 

 

sort(F2, "BType")

_m629097504

(9)

 

 

Adding yet more flashlights

 

new2 := DataFrame(`<,>`(`<|>`(Pelican, 1910*Gen3, LED, AAA, 1, 106, 150, 38), `<|>`(Pelican, 1920*Gen3, LED, AAA, 2, 224, 135, 41)), 'columns' = ["Make", "Model", "Type", "BType", "Batteries", "Lumens", "Minutes", "Cost"], 'rows' = [13, 14])

_m629911872

(10)

F3 := Append(F2, new2)

_m625417184

(11)

sort(F3, "Cost")

_m641386752

(12)

NULL

Now lets select just the Maglite models

 

F3[`~`[`=`](F3[() .. (), "Make"], Maglite)]

_m650462944

(13)

``

Or select the flashlights that have a burn time longer than 100 minutes

 

F3[`~`[`>`](F3[() .. (), "Minutes"], 100)]

_m689998912

(14)

NULL


 

Download flashlight3.mw

Using allvalues (twice) I can uncover the three roots of this expression: 1 real, 2 complex. But fsolve gives me just one real and 1 complex. Interestingly the free version of Woldframalpha.com gives the same single complex root.

Is there any way of coercing fsolve to give both?

Many thanks for any advice

Fsolve5.mw
 

 

Examples of the fsolve command: not all complex roots found

restart

expr := exp(x)+sin(x)-2

exp(x)+sin(x)-2

(1)

w := solve(expr)

RootOf(_Z-ln(-sin(_Z)+2))

(2)

w1 := evalf(allvalues(w))

.4486719164

(3)

w2 := allvalues(w)

RootOf(_Z-ln(-sin(_Z)+2), .4486719164), RootOf(_Z-ln(-sin(_Z)+2), 1.837819685+2.792964964*I), RootOf(_Z-ln(-sin(_Z)+2), -4.707337346-1.315656030*I)

(4)

q0 := evalf(w2[1])

.4486719164

(5)

q1 := evalf(w2[2])

1.837819685+2.792964964*I

(6)

q2 := evalf(w2[3])

-4.707337346-1.315656030*I

(7)

eval(expr, x = q0); eval(expr, x = q1); eval(expr, x = q2)

0.

 

0.1e-8+0.1e-8*I

 

0.-0.786e-9*I

(8)

r1 := fsolve(expr)

.4486719164

(9)

r2 := fsolve(expr, complex)

1.837819685+2.792964964*I

(10)

NULL

``


 

Download Fsolve5.mw

 

What is the simplest method for adding a color bar for plottings? (a scale that shows the correspondence 
between numbers and colors)

and could you interpret the graphics and the color bar?  I need your valuable comments.


I use Maple 2018.

For example;  

question.mw

I mean

Hello Everyone,

First of all I want to thank you to pay attention to my post.

For some reasons I want to know when does the root of my solution is equal to 0 isolating α, which yields the following equation
 

(6*alpha^4*l^2-7*alpha^3*l^2+6*alpha^3*l+2*alpha^2*l^2-6*alpha^2*l+alpha*l+3*alpha-2*sqrt(alpha^3*l^2*(alpha*l-l+1)*(9*alpha^4*l-13*alpha^3*l+9*alpha^3+6*alpha^2*l-12*alpha^2-alpha*l+6*alpha-1))-1)*(-1+2*alpha)/(alpha^2*l-3*alpha+1)^2 = 0
``

  1/2, -1/l, (1/8)*(3*l+(9*l^2-16*l)^(1/2))/l, -(1/8)*(-3*l+(9*l^2-16*l)^(1/2))/l``

``

NULL

 

NULL

``

 

 

When I substitute 1/2 it verifies the equation, but when I substitute other solutions my equation is not verified. For instance substituting "α=-1/l" I get something different from 0 as you can see

``

``

(6*alpha^4*l^2-7*alpha^3*l^2+6*alpha^3*l+2*alpha^2*l^2-6*alpha^2*l+alpha*l+3*alpha-2*sqrt(alpha^3*l^2*(alpha*l-l+1)*(9*alpha^4*l-13*alpha^3*l+9*alpha^3+6*alpha^2*l-12*alpha^2-alpha*l+6*alpha-1))-1)*(2*alpha-1)/(alpha^2*l-3*alpha+1)^2
"(->)"(-2/l-2*(1/l^2)^(1/2))*(-2/l-1)/(4/l+1)^2"(=)"2*((1/l^2)^(1/2)*l+1)*(2+l)/(4+l)^2

``

My question is what are these "solutions" if they are not solutions ?

I attach the file in case you would take a look at it

Download Maple_question2.mw

This code used to work OK in an earlier version of Maple 2018. I do not know what changed and if it some change in Physics package that caused it.

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(r,0)=0,u(r,Pi)=0,u(0,theta)=0,u(1,theta)=f(theta);
sol:=pdsolve([pde,bc],u(r,theta),HINT = boundedseries(r = 0));

Now it gives the error 

Error, (in assuming) when calling 'assume'. Received: 'invalid arguments'

Workaround is to remove the HINT above. So the following now works

restart;
pde:=diff(u(r,theta),r$2)+1/r*diff(u(r,theta),r)+1/r^2*diff(u(r,theta),theta$2)=0;
bc:=u(r,0)=0,u(r,Pi)=0,u(0,theta)=0,u(1,theta)=f(theta);
sol:=pdsolve([pde,bc],u(r,theta));

Should this error message show up when using the HINT option?

Maple 2018.2 with Physics package cloud version 205.

Here is screen shot showing it was working in Physics 170

 

From time to time, people ask me about visualizing knots in Maple. There's no formal "Knot Theory" package in Maple per se, but it is certainly possible to generate many different knots using a couple of simple commands. The following shows various examples of knots visualized using the plots:-tubeplot and algcurves:-plot_knot commands.

The unknot can be defined by the following parametric equations:

 

x=sin(t)

y=cos(t)

z=0

 

plots:-tubeplot([cos(t),sin(t),0,t=0..2*Pi],
   radius=0.2, axes=none, color="Blue", orientation=[60,60], scaling=constrained, style=surfacecontour);

 

plots:-tubeplot([cos(t),sin(t),0,t=0..2*Pi],    radius=0.2,axes=none,color=

 

The trefoil knot can be defined by the following parametric equations:

 

x = sin(t) + 2*sin(2*t)

y = cos(t) + 2*sin(2*t)

z = sin(3*t)

 

plots:-tubeplot([sin(t)+2*sin(2*t),cos(t)-2*cos(2*t),-sin(3*t), t= 0..2*Pi],
   radius=0.2, axes=none, color="Green", orientation=[90,0], style=surface);

 

plots:-tubeplot([sin(t)+2*sin(2*t),cos(t)-2*cos(2*t),-sin(3*t),t= 0..2*Pi],    radius=0.2,axes=none,color=

 

The figure-eight can be defined by the following parametric equations:


x = (2 + cos(2*t)) * cos(3*t)

y = (2 + cos(2*t)) * sin(3*t)

z = sin(4*t)

 

plots:-tubeplot([(2+cos(2*t))*cos(3*t),(2+cos(2*t))*sin(3*t),sin(4*t),t=0..2*Pi],
   numpoints=100, radius=0.1, axes=none, color="Red", orientation=[75,30,0], style=surface);

 

plots:-tubeplot([(2+cos(2*t))*cos(3*t),(2+cos(2*t))*sin(3*t),sin(4*t),t=0..2*Pi],    numpoints=100,radius=0.1,axes=none,color=

 

The Lissajous knot can be defined by the following parametric equations:

 

x = cos(t*n[x]+phi[x])

y = cos(t*n[y]+phi[y])

z = cos(t n[z] + phi[z])

Where n[x], n[y], and n[z] are integers and the phase shifts phi[x], phi[y], and phi[z] are any real numbers.
The 8 21 knot ( n[x] = 3, n[y] = 4, and n[z] = 7) appears as follows:
 

plots:-tubeplot([cos(3*t+Pi/2),cos(4*t+Pi/2),cos(7*t),t=0..2*Pi],
   radius=0.05, axes=none, color="Brown", orientation=[90,0,0], style=surface);

 

plots:-tubeplot([cos(3*t+Pi/2),cos(4*t+Pi/2),cos(7*t),t=0..2*Pi],    radius=0.05,axes=none,color=

 

A star knot can be defined by using the following polynomial:
 

f = -x^5+y^2

 

f := -x^5+y^2
algcurves:-plot_knot(f,x,y,epsilon=0.7,
   radius=0.25, tubepoints=10, axes=none, color="Orange", orientation=[60,0], style=surfacecontour);

 

 

By switching x and y, different visualizations can be generated:

 

g=(y^3-x^7)*(y^2-x^5)+y^3

 

g:=(y^3-x^7)*(y^2-x^5)+y^3;
plots:-display(<
algcurves:-plot_knot(g,y,x, epsilon=0.8, radius=0.1, axes=none, color="CornflowerBlue", orientation=[75,30,0])|
algcurves:-plot_knot(g,x,y, epsilon=0.8, radius=0.1, axes=none, color="OrangeRed", orientation=[75,0,0])>);

 

 

f = (y^3-x^7)*(y^2-x^5)

 

f:=(y^3-x^7)*(y^2-x^5);
algcurves:-plot_knot(f,x,y,
  epsilon=0.8, radius=0.1, axes=none, orientation=[35,0,0]);

 

 

h=(y^3-x^7)*(y^3-x^7+100*x^13)*(y^3-x^7-100*x^13)

 

h:=(y^3-x^7)*(y^3-x^7+100*x^13)*(y^3-x^7-100*x^13);

algcurves:-plot_knot(h,x,y,
   epsilon=0.8, numpoints=400, radius=0.03, axes=none, color=["Blue","Red","Green"], orientation=[60,0,0]);

 

Please feel free to add more of your favourite knot visualizations in the comments below!

You can interact with the examples or download a copy of these examples from the MapleCloud here: https://maple.cloud/app/5654426890010624/Examples+of+Knots

First 619 620 621 622 623 624 625 Last Page 621 of 2097