MaplePrimes Questions

restart;
a := 10;
ff := proc()

       ##local a,b;

        b := a + 10:  #### implicit local

         return b:

        end proc:
ff();

output: 20

restart;

a := 10:
ff := proc()

       ##local a,b;

        b := a + 10:   #### implicit local

        a:=b:

        return b:

        end proc:
ff();

output: a+10

expected: 20

Please explain the reason

 

How can I create an even function, g, in Maple? I want Maple to give g(x) - g(-x) as 0.

Good day sirs, I write a system of DAE but giving me this code "(The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)". The code is attached below.

Thanking you in anticipating for your help.

Help!!!!.mw

Hello, I was given the problem "Set N:=100. (i) Form four lists L[1], L[3], L[5], L[7] where L[r] contains all primes 2< p < N such that p mod 8 = r ." and came up with the following code:

N := 100;
List1 := [];
List3 := [];
List5 := [];
List7 := [];
for p from 2 to N do
    if isprime(p) and p mod 8 = 1 then List1 := [op(List1), p]; end if;
    if isprime(p) and p mod 8 = 3 then
        List3 := [op(List3), p];
    end if;
    if isprime(p) and p mod 8 = 5 then
        List5 := [op(List5), p];
    end if;
    if isprime(p) and p mod 8 = 7 then
        List7 := [op(List7), p];
    end if;
end do;
List1;
List3;
List5;
List7;
 

this gave me the answer I wanted, however using the above code I have to answer this second question: 

In the notation of Problem 1, make a procedure with input = arbitrary  positive integer N and output = the list [nops(L[1]), nops(L[3]), nops(L[5]), nops(L[7])]. Do some experiments to see for which (if any) r, L[r] is largest. 

I am unsure of how to create a procedure out of the code I already have. I created this: 
 

restart;
F := proc(n)

local N, p, List1, List3, List5, List7;

List1 := [];

List3 := [];

List5 := [];

List7 := [];

for p from N do

if isprime(p) and p mod 8 = 1 then List1 := [op(List1), p]; end if;

if isprime(p) and p mod 8 = 3 then List3 := [op(List3), p]; end if;

if isprime(p) and p mod 8 = 5 then List5 := [op(List5), p]; end if;

if isprime(p) and p mod 8 = 7 then List7 := [op(List7), p]; end if;

return [nops(List1), nops(List3), nops(List5), nops(List7)];

end do;

end proc;

 

however, when I input F(100) or any other value of N, I am receiving the error message "Error, (in F) initial value in for loop must be numeric or character"

 

Any ideas on how to improve my program to get the output I desire?

thank you 

 

 

 


 

restart;

with(PDEtools):

with(plot):

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received plot

 

A1:=Matrix([[phi,(chi),conjugate(phi),conjugate(chi)],
          [chi,(phi),conjugate(chi),conjugate(phi)],
          [lambda*phi,-(lambda)*(chi),
           conjugate(lambda)*conjugate(phi),-conjugate(lambda)*conjugate(chi)],
          [lambda*chi,-(lambda)*(phi),
           conjugate(lambda)*conjugate(chi),-conjugate(lambda)*conjugate(phi)]]);

A1 := Matrix(4, 4, {(1, 1) = phi, (1, 2) = chi, (1, 3) = conjugate(phi), (1, 4) = conjugate(chi), (2, 1) = chi, (2, 2) = phi, (2, 3) = conjugate(chi), (2, 4) = conjugate(phi), (3, 1) = lambda*phi, (3, 2) = -lambda*chi, (3, 3) = conjugate(lambda)*conjugate(phi), (3, 4) = -conjugate(lambda)*conjugate(chi), (4, 1) = lambda*chi, (4, 2) = -lambda*phi, (4, 3) = conjugate(lambda)*conjugate(chi), (4, 4) = -conjugate(lambda)*conjugate(phi)})

(1)

d1 := LinearAlgebra:-Determinant(A1):

d1; length(%);

conjugate(lambda)^2*conjugate(phi)^2*chi^2-conjugate(lambda)^2*conjugate(phi)^2*phi^2-conjugate(lambda)^2*conjugate(chi)^2*chi^2+conjugate(lambda)^2*conjugate(chi)^2*phi^2+2*conjugate(lambda)*conjugate(phi)^2*chi^2*lambda+2*conjugate(lambda)*conjugate(phi)^2*lambda*phi^2-8*conjugate(lambda)*conjugate(phi)*conjugate(chi)*chi*lambda*phi+2*conjugate(lambda)*conjugate(chi)^2*chi^2*lambda+2*conjugate(lambda)*conjugate(chi)^2*lambda*phi^2+conjugate(phi)^2*chi^2*lambda^2-conjugate(phi)^2*lambda^2*phi^2-conjugate(chi)^2*chi^2*lambda^2+conjugate(chi)^2*lambda^2*phi^2

 

705

(2)

den:=simplify(d1,size); length(%);

-(-(conjugate(chi)-conjugate(phi))*(chi+phi)*conjugate(lambda)+lambda*(conjugate(chi)+conjugate(phi))*(chi-phi))*(-(conjugate(chi)+conjugate(phi))*(chi-phi)*conjugate(lambda)+lambda*(conjugate(chi)-conjugate(phi))*(chi+phi))

 

333

(3)

 

con1:=phi=exp(I*lambda*(x-t/(4*lambda^2)-w^2)):con2:=chi=exp(-I*lambda*(x-t/(4*lambda^2)-w^2)):

 

den1:=simplify(dsubs({con1,con2},den));

4*conjugate(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2-4*conjugate(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+8*conjugate(lambda)*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda+8*conjugate(lambda)*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda+4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda^2-4*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda^2-16*conjugate(lambda)*lambda

(4)

plot3d(subs(Re(lambda)=1, Im(lambda)=.2, w=1, rhs(den1)),x=-6..6, t=-6..6)

Warning, inserted missing semicolon at end of statement

 

Error, invalid input: rhs received 4*conjugate(lambda)^2*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2-4*conjugate(lambda)^2*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2+8*conjugate(lambda)*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda+8*conjugate(lambda)*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda+4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*...

 

NULL

``

 

``


 

Download 23May(1).mw

Seems to make no difference with or without RETURN() for the procedure ?

 

vraag_op_forum_gesteld_over_boek_vb_binomium.mw

 

For to know what each graph is standing for in the plot legenda

Could not yet get it  in y , y' , y '' , to 5th derative 

Better is perhaps to have vertical table with the names and function expression together , but that could be difficult betounes_ex_set_task_4def.mw  

 

f := x -> exp(-x)*sin(x); intvx:= 0..3;
f := proc (x) options operator, arrow; exp(-x)*sin(x) end proc
intvx := 0 .. 3

 

And this one below ( i prefer this one ) , but got in worksheet now the one above
Probably a option issue ?

 

 

f := x -> exp(-x)*sin(x); intvx:= 0..3;

proc (x) options operator, arrow; exp(-x)*sin(x) end proc


 

2 determinants equal, solve for the unknowns in one determinant/Linear Algebra

Hi guys, thank you for reading my question.

A is one determinant "Matrix(2, 3, [[1, 2, 3], [3, 1, 2]])".B is" Matrix(2, 3, [[1, x, 3], [y, 1, z]])"

I wrote 2 matrice in the maple

As I try to solve the unknowns,I wrote:

A:= B, solve(x, y, z) It doesn't work

I switch another phrase,

A = B;solve(B:x,y,z)    It doesn't work as well

Could you help me with it ?

Thank you

 

 

Dear All.

Please kindly help to correct the attached code on discretization of fourth order PDE using method of line.
Thank you and kind regards.

restart

``

``

Discretization of parabolic equation with method of line

diff(u(x, t), t) = -2*(diff(diff(u(x, t), x), x))-(diff(diff(diff(diff(u(x, t), x), x), x), x))-u(x, t)*(diff(u(x, t), x))

u(x, t)

u(x, t)

u(x, 0) = 0.3e-1*sin(x)

8

``

``

``

Convert the BC to finite difference

(1/2)*(u[m+1](t)-u[m-1](t))/h

(u[m-1](t)-2*u[m](t)+u[m+1](t))/h^2

(u[m-2](t)-4*u[m-1](t)+6*u[m](t)-4*u[m+1](t)+u[m+2](t))/h^4

````

Convert the governing equation to finite difference form

Error, invalid input: diff received 2*h, which is not valid for its 2nd argument

Error, invalid input: diff received 2*h, which is not valid for its 2nd argument

Error, invalid input: LinearAlgebra:-GenerateMatrix expects its 1st argument, eqns, to be of type ({list, set})({`=`, algebraic}), but received eqs

A

``


 

Download Discretization_of_PDE_Order_4.mw

restart;

ii := 50;

seq(ii, ii = 0 .. 5);

evalf(int(ii, ii = 0 .. 5))

 

For sequence the syntax is correct i.e the output is 0,1,2,3,4,5. is ii inside sequence command takes the value 5 assigned it then changes when ii ranges from 0 to 5?

restart;

ii:=50:
seq(ii)

output: 50

restart;

ii:=50:

seq(seq(ii),ii=1..5)

expected answer: 50,50,50,50,50

obtained: 1,2,3,4,5

please explain how seq command works

 

Trebuchet, Phase I, 2020-05-27 Ki restart; with(RealDomain); with(SolveTools); assume(h < r1); additionally(h < r2); [Im, Re, ^, arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, cos, cosh, cot, coth, csc, csch, eval, exp, expand, limit, ln, log, sec, sech, signum, simplify, sin, sinh, solve, sqrt, surd, tan, tanh ] [AbstractRootOfSolution, Basis, CancelInverses, Combine, Complexity, Engine, GreaterComplexity, Identity, Inequality, Linear, Parametric, Polynomial, PolynomialSystem, RationalCoefficients, SemiAlgebraic, SortByComplexity] hz1 := g*(r3*m3*cos(phi1(t))-r1*m2*sin(phi2(t))/sin(phi2(t)-phi1(t)))/theta3; whattype(phi1(t)); whattype(phi2(t)); / r1 m2 sin(phi2(t)) \ g |r3 m3 cos(phi1(t)) + -----------------------| \ sin(-phi2(t) + phi1(t))/ hz1 := ------------------------------------------------ theta3 function function hz2 := phi1(t)+arcsin((h+r1*sin(phi1(t)))/r2); /h + r1 sin(phi1(t))\ hz2 := phi1(t) + arcsin|-------------------| \ r2 / subs(phi2 = hz2, hz1); / / | | 1 | | ------ |g |r3 m3 cos(phi1(t)) theta3 | | | | \ \ // /h + r1 sin(phi1(t))\\ \ \\ r1 m2 sin||phi1(t) + arcsin|-------------------||(t)| || \\ \ r2 // / || + ----------------------------------------------------------|| / / /h + r1 sin(phi1(t))\\ \|| sin|-|phi1(t) + arcsin|-------------------||(t) + phi1(t)||| \ \ \ r2 // /// deq := diff(phi1(t), t, t)-% = 0; / / / 2 \ | | | d | 1 | | deq := |---- phi1(t)| - ------ |g |r3 m3 cos(phi1(t)) | 2 | theta3 | | \ dt / | | \ \ / /h + r1 sin(phi1(t))\ \ \ r1 m2 sin|phi1(t)(t) + arcsin|-------------------|(t)| | \ \ r2 / / | + -----------------------------------------------------------| / /h + r1 sin(phi1(t))\ \| sin|-phi1(t)(t) - arcsin|-------------------|(t) + phi1(t)|| \ \ r2 / // \ | | | = 0 | | / ics := phi1(0) = -arcsin(h/r1), (D(phi1))(0) = 0; /h \ ics := phi1(0) = -arcsin|--|, D(phi1)(0) = 0 \r1/ dsolve({deq, ics}, phi1(t)); dsolve(deq); deq_numeric := subs(r1 = 8, r2 = 8, r3 = 1, h = 5, m2 = 1, m3 = 20, theta3 = 20, deq); / | / d / d \\ 1 | |--- |--- phi1(t)|| - -- g |20 cos(phi1(t)) \ dt \ dt // 20 | | \ / /5 \ \ \ 8 sin|phi1(t)(t) + arcsin|- + sin(phi1(t))|(t)| | \ \8 / / | + --------------------------------------------------------| = 0 / /5 \ \| sin|-phi1(t)(t) - arcsin|- + sin(phi1(t))|(t) + phi1(t)|| \ \8 / // ics_numeric := phi1(0) = 0, (D(phi1))(0) = -.63; ics_numeric := phi1(0) = 0, D(phi1)(0) = -0.63 hz1 := dsolve({ics, deq_numeric}, phi1(t), numeric); Error, (in dsolve/numeric/process_input) unknown arcsin(5/8+sin(phi1(t))) present in ODE system is not a specified dependent variable or evaluatable procedure sin(-phi1(t)-arcsin((h+r1*sin(phi1(t)))/r2)); / /h + r1 sin(phi1(t))\\ -sin|phi1(t) + arcsin|-------------------|| \ \ r2 //

How to convert expression below to LaTex:  $\lim _{x \rightarrow 2} \frac{2}{x+3}$

And How to convert expression below to LaTex:  $\int_{2}^{3} \frac{1}{x^{2}+2} d x$

file test: newLaTex.mw

ode3 := diff(P(t), t) = 0.2*P(t) - 300;
                        d                       
              

ICs := [[0, 1300], [0, 1800]];
DEplot(ode3, p(t), p = -50 .. 2000, t = 0 .. 2000, ICs, arrows = LINE, color = RED, linecolor = BLUE, title = "Solution Curves ode3");
Error, (in DEtools/DEplot) invalid variable in specification of independent variable range
 

I want to plot y=sec(x) and x=-pi/4, x= pi/4. I also want the bounded region shaded. I have been able to graph sec(x) but I can't figure out how to get the two vertical lines and the bounded region shaded.

First 429 430 431 432 433 434 435 Last Page 431 of 2308