MaplePrimes Questions

Hi, 

I have always asked myself this question: why do the colon after the proc(...) statement generate an error if the following statement is local or global?
(the third example is here to show that no error occurs if local is omitted... the warning is of course obvious)

restart:
interface(version);
Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895

f := proc(x) local y: y:=x+1 end proc:

g := proc(x): local y: y:=x+1 end proc:
Error, unexpected `local` declaration in procedure body

h := proc(x): y:=x+1 end proc:
Warning, `y` is implicitly declared local to procedure `h`

TIA

plot(['h'(floor(n))[1], 'h'(floor(n))[2]],n=1..10);
Error, (in plot) ifactors takes an integer or a factored integer

 

h simply uses ifactors. I can calculate with it no problem, e.g., h(3), h(10)... but in plot it does not work. I've tried convert, Integer, etc and nothing works.

Calculation of these integrals takes much time.

Is there a way to reduce the time?

MY_SYSTEM.mw

 

Hi

can anyone help me to solve second order ode, I am unable to find the value of the involved constant of integration

 

ode_solution_help.mw

 

 

 

 

We consider an ellipse  E defined by the equation x²/a²+y²/b²=1. Either F1 and F2 its foci. 
We consider a point M of E  such the angle F1,M,F2 is equal to a given value phi.
Find F1M et F2M in function of a, b and phi . Then find the coordiinates x0 and y0 of M in function of a, b, and phi. Here is the begining of my code;

restart;
_EnvHorizontalName := x: _EnvVerticalName := y:
with(plots):
line := proc (x1, y1, x2, y2) options operator, arrow; (x-x1)*(y2-y1)-(y-y1)*(x2-x1) end proc:
Vdot := proc (U, V) add(U[i]*V[i], i = 1 .. 2) end proc:
dist := proc (M, N) sqrt(Vdot(expand(M-N), expand(M-N))) end proc:

ell := x^2/a^2+y^2/b^2 = 1: 
c := sqrt(a^2-b^2):
F1 := [c, 0]: F2 := [-c, 0]:
M := [a*cos(t), b*sin(t)]:
MF2 := simplify(expand(sqrt((c+a*cos(t))^2+(b*sin(t))^2)));
MF1 := simplify(expand(sqrt((c-a*cos(t))^2+(b*sin(t))^2)));
varphi := arccos((MF1^2+MF2^2-4*c^2)/(2*MF1*MF2));
f := unapply(varphi, t);
`maxϕ` := f((1/2)*Pi);
diff(f(t), t);

a := 7: b := 5: t := (1/3)*Pi:
evalf(varphi);
evalf(MF1); evalf(dist(M, F1));
evalf(MF2); evalf(dist(M, F2));
MF1+MF2; evalf(%);
`maxϕ`; evalf(%);
ELL := implicitplot(ell, x = -a-2 .. a+2, y = -2-b .. b+2, color = blue):
tp := textplot([[F1[], "F1"],[F2[],"F2"],[M[],"M"]], 'align' = {'above', 'left'}):
po := plot([F1,F2, M], style = point, symbolsize = 15, symbol = solidcircle, color = red):

display([ELL, tp, po], scaling = constrained): Would  you help me to answer the questions ? Thank you.

Hi,

I am studying nonlinear differential equations, and I want to compare software that gives exact solutions to software that gives numerical solutions.

In the attached Maple document, I try to solve a nonlinear ordinary differential equation numerically, but it seems like the numerical solver cannot solve this type of nonlinear ODE.  Are there any numerical solvers in maple that can find a solution to this equation?

 

Steve

Differential_equation_to_solve_numerically.mw

Hello,

I would like to define two vectors in spherical coordinates (preferably using Physics[Vectors] package) such that these two vectors have the magnitudes of r1 and r2, resepctively, but pointing in different directions.

In Physics[Vectors] package, basis vectors _r,_theta,_phi are predefined. So, I cannot define the vectors as r1_:=r1*_r1 and r2_:=r2*_r2 and use all the cool features of physics package.

I will eventually be needing the norm of the difference of these vectors at a later calculation, but this representation turned out to be a problem.

I am avoiding to define these vectors  in cartesian basis with spherical coordinates such as r1_=r1*(sin(theta1)*cos(phi1) i + sin(theta1)*sin(phi1) j + cos(theta1) k), etc. which is a work around. 

How can I do this in Maple?

Thank you.

 

 

 

How can we obtain the expression of the function f : R --> R defined, for each (a, b) such that -oo < a <= b < +oo, by this equality?

Int(f(x), x=a..b) = Int(f(x), x=1/b..1/a)

Replacing x by 1/y in the rhs integral shows that f satisfies this functional equation 

f(y) = f(1/y)/y^2

(note this impose y <> 0, see the PS below)
Functional equations is not y cup of tea and Maple (2015) doesn't seem to have any feature to solve them.
Could anyone explain me how f can be obtained?

PS:
I inadvertently obtained this equality between integrals as I was comparing the performances of different numerical integration methods.
One of the functions in my benchmarks suite had the expression f(x)=1/(1+x^2)... and I "discovered", by changing x to 1/y to ease the numerical integration, that f checked the inequality of the first code snippet.
Thus , for any constant C, C*f  is a solution of the functional equation.
Note that f(x) being strictly positive, 1/y > 0 and the functional equation is always defined.

Im new to Maple. My instructor asked us to use it, but I can't find a student free version, please help.

Consider the following simple example. It works fine and we get a plot with two blue points and two red points when we run it inside Maple. However, when we right click on it and choose export as `.eps` file, the result is a plot with four black points!

List := [[[0, 0], 1], [[1, 2], 0], [[2, 3], 0], [[3, 1], 1]]:
plots[pointplot]([seq(List[i][1], i = 1 .. nops(List))], color = [seq(`if`(List[j][2] = 1, red, blue), j = 1 .. nops(List))], symbolsize = 12, symbol = solidcircle, labels = [typeset(t), typeset(x[t])]);

Of course one solution is to make a seperate pointplot for each color and then use `plots[display]`. But what if there is a situation with more number of colors or a gradient of colors which you can't know how many colors will be in the end?

Is there any specific reason behind becoming black when I export the output of this plot? I wonder why it is displayed properly inside Maple, but not in the eps output.

Why this fails in solve in Maple 2020.2?

restart;

A:=-ln(u)/2 + ln(3*u - 2)/6;
B:=_C1 + ln(x);
sol := solve(A-B= 0,u) assuming real

No error if I try the above code in Maple 2019.2.

Also, the error goes away if I replace assuming real  with assuming x::real

restart;

A:=-ln(u)/2 + ln(3*u - 2)/6;
B:=_C1 + ln(x);
sol := solve(A-B= 0,u) assuming x::real

Is this a bug in solve?

Maple 2020.2 on windows 10.

 

I have this procedure to perform a Boole-Mobius Transform. I took me quite a while to figure out. Whereas it works, I wonder how it should be done efficiently? The document is also attached which shows the steps I went through to derive the procedure. I can't get the document to display.

BooleMobiusTransform := proc(V) 
local n, im, istep, jm, h, istart, i, j, k; n := ilog2(numelems(V)); im := 2^n/2; istep := im; jm := 1; h := 2^n; 
for k to n do
 istart := 1; 
for j to jm do 
for i from istart to im - 1 + istart do 
V(istep + i) := (V[istep + i] + V[i]) mod 2;
 end do;
 istart := istart + h; 
end do;
 im := 1/2*im; istep := 1/2*istep; jm := 2*jm; h := 1/2*h; 
end do; 
return V; 
end proc

Boole-Mobius_Transform.mw

Why this error shows up when adding assuming?

restart;
expr:= ln(c^2*y/sqrt(c^2)+sqrt(c^2*y^2+1));
simplify(expr,size=true,evaluate_known_functions=false);
simplify(expr,size=true,evaluate_known_functions=false) assuming real;  #error

 

Is this to be expected?

Maple 2020.2

I got the plot of an ellipsis and a hyperbola using the following code:

plot([sqrt((1^2 - 0.5)*(1 - x^2/(2^2 - 0.5))), -sqrt((1^2 - 0.5)*(1 - x^2/(2^2 - 0.5))), sqrt((1^2 - 2.5)*(1 - x^2/(2^2 - 2.5))), -sqrt((1^2 - 2.5)*(1 - x^2/(2^2 - 2.5)))], x = -2 .. 2, scaling = constrained, color = [blue, blue, red, red])

How can I get the two vectors n1,n2 as shown in the following picture (the intersection point of the curves defines the beginning of the vectors)

 

DEAR SIR,

 

GOOD EVENING.

 

HOW TO FIND THE AREA BETWEEN THE CURVES  USING MAPLE? 

First 330 331 332 333 334 335 336 Last Page 332 of 2308