MaplePrimes Questions

What is the reason that error accepts its arguments without being inside paranthesis? This is different from all other Maple functions I've seen. For example, both these below work the same

f := proc (x) 
     if x<0 then 
        error "invalid x: %1", x; 
     else 
        x^(1/2); 
     end if 
end proc:

And

g := proc (x) 
     if x<0 then 
        error("invalid x: %1", x); 
     else 
        x^(1/2)
     end if 
end proc:

One can't do for other Maple functions. For example sin x  gives an error. It must be sin(x)

Looked at help page for error and did not see something about this difference.

I have been having difficulty with plotting these graphs from Cartesian to Polar. I know that with double integrals there is an inclusion of r when you go from Cartesian to Polar. I think my graph of the function being integrated is correct. I am having difficulty with the command for the shaded region. I know with Cartesian, I can use inequal command to get the right shaded area. Will this command work with polar coordinates? 

I attached the Maple worksheet.

Thank you all for help in advance!

When I select "oldest first", the first post shown is the newest.  Vice-versa when selecting "newest first".  Am I misunderstanding the meaning of the term?  I suppose it doesn't matter as both options are available but it's weird.

eqell := expand((x+(1/2)*R1-(1/2)*R)^2/a^2+y^2/b^2-1); geometry:-ellipse(ell, eqell, [x, y]); detail(ell); ellipse: hint: unable to determine if 1/(1/2*R+1/2*R1)^2*(1/(-8*R^3*R1+14*R^2*R1^2-3*R*R1^3)*R^2+2/(-8*R^3*R1+14*R^2*R1^2-3*R*R1^3)*R1*R+1/(-8*R^3*R1+14*R^2*R1^2-3*R*R1^3)*R1^2) is zero Error, (in geometry:-ellipse) the given polynomial/equation is not an algebraic representation of a ellipse. How to manage this error ? Thank you.

The expressions f(1), f(1,2,3), or f with any number of arguments, all match the type specfunc(f), while the expression f(g(1), 2 ,3) matches the type f(g(anything), anything, anything). However, is there a type which is matched by expressions like f(g(1), 2, 3 ...), with an arbitrary number of arguments after g(something)?

 

The command Typesetting:-Settings(prime=x,typesetprime=true):  makes diff(y(x),x) gives the latex as y'(x) which is what I wanted.

But I'd like to also be able to turn this off.  The reason is that in my program, I could have different variables in different places, and need to be able to turn this off/on as the program runs.

I know I can change the setting, by calling the above command again, with different variable. But I was looking for a way to turn it off as well. 

Similar to Typesetting:-Suppress  

Is there a way to do that? Actually the best solution would be, is to have the effect of Typesetting:-Settings(prime=x,typesetprime=true): be local to the proc. So if this command is used inside a proc, when leaving the proc, its effect will be automatically removed, as if this command was never issued.

Only when it is issued in global context, it will remain in effect until one does a restart.   Right now, the effect of Typesetting:-Settings(prime=x,typesetprime=true): is global. Even when called from inside a proc.  But this might be hard to implement. Therefore, being just able to turn it off is good for now.

Here is an example

restart;
foo:=proc(expr,x,y)
   Typesetting:-Settings(prime=x,typesetprime=true):
   print(Physics:-Latex(expr));

   #How to turn off the effect of above Typesetting command now?
   #so the following command works as the default setting?

   print(Physics:-Latex(expr));
end proc;


expr:=diff(y(x),x)=3:
foo(expr,x,y);

 

Hi

I am trying to implement a recursive algorithm for matrix inverses, its a seventh-order method

for n to 7 do
    new := (1/16*old) . (120*I + ((A . old) . (735*I + ((A . old) . (-861.*I + ((A . old) . (651*I + ((A . old) . (93*I + (A . (old(-15*I + (A . old)))))))))))));
    old := new;
    print(n);
end do

However I get a error informing me that this is a recursive statment. Which it is, but maple thinks this is a bad thing.

So it is clear that I am doing somthing wrong, Can anyone help me by explaining what I am doing wrong?

Mvh

Eric Ragnarsson

 

Hi,

I have questions about linestyle in maple, how to change solid and Dash whatever  to line with cross or line with plus 

Please see a plot attached.

Look forward to hearing from you as soon as possible.

Regards,

Mathastr

plots.pdf

I am new to Maple. I attempted to write a procedure that takes another procedure as input. It is not working correctly. As you can see from the output of a call to procedure A that something went wrong.
How do I do this correctly?
 

H := proc (n::integer)::real; local s, i; s := 0; for i by 2 to n do if i <= n-1 then s := s+1./((i*(i+1))) else s := s+1./i end if end do; return s end proc

A := proc (n::integer, T::procedure)::real; local d1, d2, s; d1 = T(n+1)-T(n); d2 = T(n+2)-T(n); s := T(n+1)-d1*d2/(d2-d1); return s end proc

proc (n::integer, T::procedure)::real; local d1, d2, s; d1 = T(n+1)-T(n); d2 = T(n+2)-T(n); s := T(n+1)-d1*d2/(d2-d1); return s end proc

(1)

H(11)

.7365440115

(2)

A(10, H)

.7365440115-d1*d2/(d2-d1)

(3)

``


 

Download st.mw

Maple Apps-Venn Diagrams does not work.  In box on the right there is an error message.

How do I calculate the first 5 values of the bisection method using the starting values of 4 and 5 of the function f(x) = (5 - x) * (e^x)-5

 

a := 4;
b := 5;
nStep := 5;
                               4
                               5
                               5
 

To obtain the columns of matrix as a list, this is what I currently do

A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);

Now

[seq(A[..,i],i=1..4)];

Also this does it

map(i->A[..,i],[$1..4]);

Is there a "shorter" way to do it?  For example, A[..,[$1..4]] does not do it ofcourse, it just gives the matrix itself back.

 

 

To solve this, I got this far but am not sure where to go next?

 

f2 := x^2 - 3;
f2d := diff(f2, x);
                              2    
                             x  - 3
                              2 x

set value for x0, number precision

x0 := 3;
eps := 0.1*10^(-5);
                               3
                            0.000001
 

I do not understand what ColumnSpace is doing in Maple, as I can't get it to match my hand solution and the book. It must be using different definition which is not the book standard.

In the textbook, it says to find column space of matrix A, is to find the Echelon form, then lookup the pivot columns. Then pick the corresponding columns from the original A. These are the column space.

I'll show the book example, and Maple code to try to get same answer.

Here is an example from the book

Notice the columns space are the first, second and fourth columns of A. Since these correspond to the pivot columns of the Echelon form.

In Maple, the Echelon is found using LinearAlgebra:-GaussianElimination(A,'method'='FractionFree'); which gives the same pivot columns as the book. So far so good (the numbers are not the same, but this is normal, as Echelon form is not unique. Only reduced Echelon form is unique), but as long as the pviot columns are correct, that is the important part. 

But when I do LinearAlgebra:-ColumnSpace(A); I get completely different result. The only thing I could see in help, is that it says The Vectors are returned in canonical form with leading entries 1.

I do not underand what that means or how to convert Maple answer to make it match the expeted result since the result is completely different and I do not see the mapping needed.

restart;
A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);
LinearAlgebra:-GaussianElimination(A,'method'='FractionFree');
LinearAlgebra:-ColumnSpace(A);


I also tried this on Wolfram Alpha, and got same answer as the book

 

 

Maple 2020.1

reference: Differential Equations and linear algebra, 4th ed., Edwards, Penney and Calvis. Pearson. 2017. page 247.

Hi,

I do not understand why this simple procedure evaluates so differently depending on the type of its second parameter?

A typo somewhere or a bug?


 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

KL := (a, b) -> (1/4)*(2*ln(a+b)*a^2+4*ln(a+b)*b*a+2*ln(a+b)*b^2-2*ln(b)*b^2-a^2-2*a*b)/a

proc (a, b) options operator, arrow; (1/4)*(2*ln(a+b)*a^2+4*ln(a+b)*b*a+2*ln(a+b)*b^2-2*ln(b)*b^2-a^2-2*a*b)/a end proc

(2)

evalf(KL(1e-10, 1/2))

-.2

(3)

evalf(KL(1e-10, 0.5))

-0.2500000000e-10

(4)

evalf(KL(1e-10, convert(0.5, rational)))

-.2

(5)

limit(KL(a, 1/2), a=0, left);
limit(KL(a, 1/2), a=0, right)

-(1/2)*ln(2)

 

-(1/2)*ln(2)

(6)

limit(KL(a, 0.5), a=0, left);
limit(KL(a, 0.5), a=0, right)

Float(-infinity)

 

Float(infinity)

(7)

 


 

Download I_am_lost.mw

4 5 6 7 8 9 10 Last Page 6 of 1946