MaplePrimes Questions

Hi,

How can I find the same result reported in the figure for dsolve the differential equation?

nima.mw

 

 

When I input
restart;
a := 2;
b := 3;
p := x^2 - a*x - b*x +a*b ;

I get p := x^2 - 5*x + 6
How can I get x^2 - 2 x - 3x + 6.
General question. I have (a,b) in a list [[2,3],[-3,7],[9,10]]. How to subtitute them to get the result
[[x^2 - 2x - 3x + 6, x^2 + 3x - 7x -21, x^2 - 9x - 10x + 90]? 

I am trying to learn Maple and Fourier transform by calculating the coefficients and the resuting summation as follows:

restart;

assume(n>0);

assume(N>0);

target_f := x -> piecewise(-Pi < x and x < 0, 0, 0 < x and x < Pi, x, Pi < x and x < 2*Pi, 0, 2*Pi < x and x < 3*Pi, x - 2*Pi)

a0 := simplify(int(target_f(x), x = -Pi .. Pi)/(2*Pi))

a_n := int(target_f(x)*cos(n . x), x = -Pi .. Pi)/Pi

b_n := int((target_f(x)) . (sin(n*x)), x = -Pi .. Pi)/Pi

fourier_f := N -> a0 + sum(a_n*cos(n*x) + b_n*sin(n . x), n = 1 .. N)

I am making fourier_f as a function of N becasue I want to see the effect of increasing partial sums. The resulting output of the summation "fourier_f" has a lot of terms. The output looks like this:

               /        /  N      
               |        |-----    
               |        | \       
1         1    |   2    |  )   /  
- Pi + ------- |4 N  Pi | /    |- 
4            2 |        |----- |  
       4 Pi N  \        \n = 1 \  

                                        \                     
                                        |                     
                                        |                     
  sin(n x) (cos(n Pi) n Pi - sin(n Pi))\|   /   2             
  -------------------------------------|| + \I N  Pi LerchPhi(
                   2                   ||                     
                  n  Pi                //                     

                         2                                    
  -exp(-I x), 1, N) - 2 N  LerchPhi(-exp(-I x), 2, N) - I N Pi

      \                  
   + 2/ exp(I N (Pi - x))

   - I N Pi (LerchPhi(-exp(I x), 1, N) N - 1) exp(I N (-Pi + x))

        2                                                 
   - I N  Pi LerchPhi(-exp(-I x), 1, N) exp(-I N (Pi + x))

                                 /   2                            
   + I Pi N exp(-I N (Pi + x)) + \I N  Pi LerchPhi(-exp(I x), 1, N

         2                                       \            
  ) - 2 N  LerchPhi(-exp(I x), 2, N) - I N Pi + 2/ exp(I N (Pi

                          2                          
   + x)) + 2 exp(-I x N) N  LerchPhi(exp(-I x), 2, N)

                   2                         
   + 2 exp(I x N) N  LerchPhi(exp(I x), 2, N)

        2                            2                     
   - 2 N  polylog(2, exp(-I x)) - 2 N  polylog(2, exp(I x))

        2                             2                      
   + 2 N  polylog(2, -exp(-I x)) + 2 N  polylog(2, -exp(I x))

                                 \
                                 |
                                 |
                                 |
   - 2 exp(-I x N) - 2 exp(I x N)|
                                 |
                                 /

The target function is not that complicated. I am using the target function shown in this YouTube video: https://www.youtube.com/watch?v=praNtRezlkw&list=PLPBSZvbAshbxULtiBcygm1qh7BtsDv3DW&index=12

It gave me similar output when the target function was x2.  I am not sure what's going on because for a simple square wave, I was able to make this work correctly.

I am deliberately not using existing packages because I want to learn Maple syntax.

Can someone please tell me what's my mistake ?

Wolfram's marketing literature states that a compiled function may generate the dates for the years 1 through 5.7 million in a couple of seconds rather than in minutes (comparing to the "uncompiled implementation").
The given function in this link can be translated into Maple language as follows: 

(*
  Note that this is only a mathematical program that outputs some data,
   hence 'Easter(-2, 1)' will never return real Gregorian Easter dates!
*)
Easter:=proc(BEGIN::integer[4],END::integer[4],$)::Array(BEGIN..END,[integer[1..12],integer[1..31]]);# the parent function
	description "https://www.wolfram.com/language/12/code-compilation/compute-the-date-of-easter.html";
	local computus::procedure[[integer[1 .. 12], integer[1 .. 31]]](integer):=proc(Year::integer,` $`)::[integer[1..12],integer[1..31]];# the child function
		options threadsafe;
		local a::nonnegint,b::integer,c::nonnegint,d::integer,e::nonnegint,f::integer,g::nonnegint,h::nonnegint,i::nonnegint,j::nonnegint,k::nonnegint,Month::integer[1..12],Day::integer[1..31];
		(* For compatibility, when `Year` is nonpositive, the command `iquo` must be replaced with slower `floor`. *)
		if Year<=0 then
			a,b,c:=Year mod 19,floor(Year/100),Year mod 100;
			d,e,f:=floor(b/4),b mod 4,floor((8*b+13)/25);
			g,h,i:=19*a+b-d-f+15 mod 30,floor(c/4),c mod 4;
			j:=floor((a+11*g)/319);k:=2*e+2*h-i-g+j+32 mod 7;
			Month:=floor((g-j+k+90)/25);Day:=g-j+k+Month+19 mod 32
		else
			a,b,c:=irem(Year,19),iquo(Year,100),irem(Year,100):
			d,e,f:=iquo(b,4),irem(b,4),iquo(8*b+13,25);
			g,h,i:=irem(19*a+b-d-f+15,30),iquo(c,4),irem(c,4);
			j:=iquo(a+11*g,319);k:=irem(2*e+2*h-i-g+j+32,7);
			Month:=iquo(g-j+k+90,25);Day:=irem(g-j+k+Month+19,32)
		fi;
		[Month,Day]
	end;
	Array(BEGIN..END,computus)
end:

However, as "no nested procedures can be translated" to optimized native machine code (cf. ), executing Easter(1, 5700000) has to take at least two minutes

Is there some workaround that can provide improved performance for such a numerical procedure that contains a nested procedure? In other words, is it possible to produce the `result` (without modifying the algorithm) in two seconds in modern Maple as that Wolfram marketing literature claims?

I think this is a simple thing but I cannot find the solution. I have lots of complicated computations in Maple 2015 (with different functions of different packages), but I need the final result to be real numbers/functions. Is there a way to prevent maple following along with computations if it detects a potential complex number? For example, if in some internal step is taking sqrt(x) it should stop and tell something like: "you must assume x is positive".

Dear Maple experts

I am using the following two implicitplot commands successfully for variables diffr1 and diffr2:

implicitplot(diffr1, 0. .. 1, 0. .. 1.0, filledregions = true, coloring = [cyan, yellow]);

implicitplot(diffr2, 0. .. 1, 0. .. 1.0, filledregions = true, coloring = [cyan, yellow]);

Now I want to have a plot that mixes them. For example, if diffr1>0 and diffr2>0 I get a color. if diffr1>0 and diffr2<0 I get another color, etc. Is there any way to do that? 

Could someone provide me with the references used when implementing the Statistics:-PredictiveLeastSquares function?

TIA

Hi,
Apparently I have a problem but I can't find it. Please advise what is the source of the error?
Please see the attached worksheet.
1.mw

I have a great deal of output from a procedure that I wrote clumsily.  How can I delete that output without highlighting and pressing the delete button.  Maple help is often of no help whatsoever.

What is the simplest way to direct all Maple output, and only Maple output, into a PDF?  

My preference would be to include a command at the beginning of a worksheet so that causes all output returned by Maple, print and graphics, to be directed to a named PDF.  Does such a command or set of commands exist, and if so, what is the process to get it to work?

An alternative is to have a command at the end of a worksheet that causes Maple to print the worksheet to a PDF.  Does that exist, and if so, what is it?

For example: n=78 (is squarefree because 2 x 3 x 13)

Possible periodlenghts in different bases for 1/78  are  {2,3,4,6,12} this is calculated with Multiplicative-Order (Maple).

Now we pick a period from above, for example 6.

The question is:

Which possible bases exist for 1/78 with  periodlenght of 6 ?

The result is: possible bases calculated with Multiplicative-Order
are {17,23,29,35,43,49}.

Question:
Is there a formular to calculate the bases directly or with less calculations than the Maple-Command ?

Thanks for helping :)

hi i am trying to create a procedure for newton rhapson method, which finds roots of a function. the first procedure i made work but now i want it to show an error message for when the function diverges at x0 and when the derivative at x0 = 0. can someone pls advise me how to fix it? thank you:)

NM1 := proc(f, xold)
    local x1, x0, precision;
    x0 := xold;
    x1 := evalf(x0 - f(x0)/D(f)(x0));
    precision := 10^(-3);
        if limit(f,(x0)) = 0 then
            error("Newton's Method cannot do the calculation");
        end if;
        if D(f)(x0) = 0 then
            error("Newton's Method cannot do the calculation");
        else
        while abs(x1-x0) > precision do
            x0 := x1;
            print(x0);        
            x1 := evalf(x0 - f(x0)/D(f)(x0));            
        end do;
        end if;

   return x1;
end proc:

Dear users! 

I hope everyone is fine here. I have the following expression:

r*y[0, 1]+y[0, 0]+(1/6)*r*(r-1)*(1+r)*y[-1, 3]+(1/2)*r*(r-1)*y[-1, 2]+(1/120)*r*(r-1)*(r-2)*(1+r)*(2+r)*y[-2, 5]+(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+(1/720)*r*(r-1)*(r-2)*(r-3)*(r-4)*(1+r)*y[-3, 8]+(1/360)*r*(r-1)^2*(r-2)*(r-3)*(1+r)*y[-3, 7]+(1/720)*r*(r-1)*(r-2)*(r-3)*(1+r)*(2+r)*y[-3, 6]:

What is the procedure to select some terms in the above expression for example for N=2 I just want the following terms:

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2];

and for N=3 I just want the following terms:

y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3];

and for N=4 I want:

(1/24)*r*(r-1)*(r-2)*(1+r)*y[-2, 4]+y[0, 0]+r*y[0, 1]+(1/2)*r*(r-1)*y[-1, 2]+(1/6)*r*(r-1)*(1+r)*y[-1, 3];

and so on,

in the descending order in first suffices and ascending order in second suffices (like term having y[0,0],  y[0,1], y[-1,2], y[-1,3], y[-2,4]). I am waiting for your response. Thanks.

 

1) the two cylinders are centered on the x and z axis respectively

2) any two intersecting cylinders

First 13 14 15 16 17 18 19 Last Page 15 of 2263