MaplePrimes Questions

Dear all,

I need your help

I have a problem with dchange ....  use the dchange command to transform pde to the
                                 x[1], x[2].

 

> restart;
> with(PDEtools); with(LinearAlgebra);
> pde := diff(u(t), t, t)+2*GAMMA*(diff(u(t), t))+omega^2*u(t) = 0;
           / d  / d      \\           / d      \        2         
           |--- |--- u(t)|| + 2 GAMMA |--- u(t)| + omega  u(t) = 0
           \ dt \ dt     //           \ dt     /                  
> deq1 := diff(u(t), t) = v(t);
                                d             
                               --- u(t) = v(t)
                                dt            
>
> deq2 := subs(deq1, pde);
                 / d      \                       2         
                 |--- v(t)| + 2 GAMMA v(t) + omega  u(t) = 0
                 \ dt     /                                 
>
> dsolve({deq1, deq2}, {u(t), v(t)});
>
> eqns := [rhs(deq1) = lhs(deq1), rhs(deq2) = lhs(deq2)];
       [        d            / d      \                       2     ]
       [v(t) = --- u(t), 0 = |--- v(t)| + 2 GAMMA v(t) + omega  u(t)]
       [        dt           \ dt     /                             ]
> y := [u, v]; b := diff(y(t), t);
                                   [u, v]
                            [ d         d      ]
                            [--- u(t), --- v(t)]
                            [ dt        dt     ]
> A, b := GenerateMatrix(eqns, y(t));
          Matrix(%id = 122038892), Vector[column](%id = 135944696)
 # Return a vector of eigenvalue of A and matrix  whose columns are eigenvectors of A
> gnat := Eigenvectors(A);
> lambda := gnat[1]; Lambda := gnat[2];
                       Vector[column](%id = 135975976)
                           Matrix(%id = 136787860)
> Y := Vector([y]);
                       Vector[column](%id = 123771808)
> tr := solve(GenerateEquations(Lambda, [x[1], x[2]], Y), {u, v});
     /           /                                    (1/2)             
     |      1    |                   /     2        2\                  
    < u = ------ \-x[1] GAMMA - x[1] \GAMMA  - omega /      - x[2] GAMMA
     |         2                                                        
     \    omega                                                         

                               (1/2)\                 \
              /     2        2\     |                 |
       + x[2] \GAMMA  - omega /     /, v = x[1] + x[2] >
                                                      |
                                                      /
>
> dchange(tr, pde, [x[1], x[2]]);

I am a begnnier of Maple. I have got some problems when solving the economic maximization problem.

When I set Digits:=15, then I could solve the problem and the solve command will give me the answer.

But when I set Digits:=20, it seems Maple cann't give me a numerical solution even I put restrictions on the form of solutions.

Can anybody help me about this?

Thank you!

I need a small help again. I have a basic question. Not able to figure how to do this.
(I am a newbie in Maple)

Maple handles things little different inside a proc() vs. global. http://www.maplesoft.com/support/help/Maple/view.aspx?path=procedure

And I could not understand what this below means in plain English:

Within a procedure, during the execution of its statementSequence, local
variables have
single level evaluation. This means that using a variable
in an expression will yield the current value of that variable, rather than
first evaluating that value. This is in contrast to how variables are evaluated
outside of a procedure, but is similar to how variables work in other programming languages.

 

But here is my question. In global name space, A variable inside an expression will automaticaly
update to the current value of the the variable. So one can do this:

x:='x';z:='z';
expr:=3*z;
z:=solve(x-1=0,x);
expr;

and now expr will have value "3" and not "3 z" since "z" was assigned a new numerical value in between
as one can see. The same code inside a proc()  behave differently

f:=proc()
  local z,x,expr;
  expr:=3*z;
  z:=solve(x-1=0,x);
  expr;
  end proc:

f();

return "3 z" and not "3" as the case with global scope. I tried subs() insid the proc,
but still it did not work. What is the recommded way to handle this? I want "expr" to
use the most recent value of any variables inside it. I can't do sub(z=z,expr) ofcourse
since this makes no sense. I need the value of z inside expr to be updated.i.e. I need
to refresh "expr" somehow.

 thank you,

Ok, I am not able to find about this after 30 minutes search (my limit of giving up :).

One can ofcourse make a local variables in a proc. But sometimes I need to make a temporary variable within the proc, say inside an if...fi to use for some local temporary computation. There is no need for this temporary variable to be declared at the whole proc() scope, since it is used only inside some limited scope.  I am not able to find how to do this in Maple. Here is some silly example

f:=proc()
     local x;
     x:=9;
     if x<10 then
        local z;
        z:=20;
        x:=z;
        ....
     fi;
     x;
     end proc;

the above is illegal. I can do this:

f:=proc()
     local x;
     x:=9;
     if x<10 then
        proc()
        z:=20;
        x:=z;
          ....
        end proc;    
     fi;
     x;
     end proc;
which compiles , but does not do what is expected. The body of the `if` statement is not called. I added a print statments there and they are not being called. (I guess since it is non-named proc(), it is not called, I thought it will fall through....

I looked for some kind of BLOCK , or DECLARE construct or such in Maple but can't find it.

is it possible to introduce a temporary local scope within a proc()? What would be the syntax? That would be really useful. Ada has this feature.

   

Hi,

My first post here.

I want to create my own questions on Maple T.A.  and it seems to me the User Guide is my only reference. Are there quick tutorials out there that I can refer to? Webinars would be helpful too.  I want to eventually create questions with partial credits.

Thanks in advance.

I could not find a way to do this in Maple looking at http://www.maplesoft.com/support/help/Maple/view.aspx?path=parameter_classes

and I see that Maple is missing from http://rosettacode.org/wiki/Named_parameters

Is it possible to call a Maple proc using named parameters? Here is an example of what this looks like from a small Ada example from the above link:

procedure Foo (Arg_1 : Integer; Arg_2 : Float := 0.0);
Foo (Arg_2 => 0.0, Arg_1 => 1);

This is very useful for proc with many arguments, and it also makes the code much
more clear and less change in using the wrong value for the wrong parameter.

In Maple notation, this can be like

foo:=proc(arg1::integer,arg2::float) ..... end proc;
foo(arg2=>10,arg1=>200);

(This editor is so bad, can't someone fix it?)

I'm taking calculus and my professor introduced us to maple software. The professor asked us to plot the families of curves for this orthogonal equation:

dy/dx = (x^2) - (2y^2) - C = 0

This is what I had so far:

 

restart;

with(DEtools):

with(plots):

 

Function:=unapply(simplify(x^2-2y^2-C),(x,y)):

'Function'(x,y) = Function(x,y);

plotFunction:=C->implicitplot(eval(F(x,y),a=C),x=-5..5,y=5..5,scaling=constrained):

plot1:=display(seq(plotFunction(a),a=-5..5)):

display(plot1);

 

This is only display one family. How do I code for it plot the other families?

(The graph should look like curves converging from left, top and right sides toward to the origin of the axes)

Please help.

(Observeration, Hypothesis) = (then,if)

I want to use all logic with just a custom logic MP(A,B), simply notation as (A,B)

and convert all basic logics into above definition

A -> B = (B,A)  --- implication
(not (not A)) v B = (B,not A) -- Disj
not (not (A ^ B)) = not( (not A) v (not B) ) = not(not B, A) -- Conj

when i meet Disj and Conj

Is not(not B, A) = (B, not A) ?

if so, i am confused as it conclude Disj = Conj ?!

the reason i ask this is that Not logic make pattern not match

i have thought to make not(Prop("Go")) to become Prop("not Go") if not logic can move into proposition

if not logic has distributivity

i design this

(Observeration, Hypothesis) = (then,if)

because convenient of calculation

however, i do not understand not applied in not(Observeration, Hypothesis) if it can not move into bracket to become (not Observeration, not Hypothesis)

or 

should it not(Observeration, Hypothesis) = (Observeration, not Hypothesis) ?correct?

Hi, I would like to write this :


as simply as possible with maple instructions.

Example :


thx.

restart:

Eq1:=diff(f(x),x)=1;

f:=1:

plot(1,x=0..10);

cs:=(f)(0)=0;

p:=dsolve({Eq1,cs},numeric);

odeplot(p, [x,diff(f(x),x)], 0..10);

why I cannot get a plot diff(f(x),x) like this?

 

whats going on here?

 

 

 

Hello everyone!

I have a question that I can't seem to find a straight answer to. I need to fit a circle to a collection of points that a circular in nature. I was trying to use the following elliptical least squares fit, but I can't determine what I should be minimizing.

Here's the page:

http://www.maplesoft.com/applications/view.aspx?SID=1395&view=html

 

For an ellipse, I used the general conic:

F:=a*x^2+b*x*y+c*y^2+d*x+e*y+f

I minimize using:

V:=Minimize(E,{4*a*c-b^2=1});

 

What would I use for a circle? Or is there a better way for a circle?

Let me first explain what I mean by 'color mapped scatter plot'.

Suppose we have a three dimensional coloum data like

[[1, 1, 0],[1, 2, 2],[1, 3, 3],[2, 1, 1],[2, 2, 4],[2, 3, 5],[3, 1, 2],[3, 2, 1],[3, 3, 3]]

The first two numbers are independendant variables, and the 3rd ones indicate 'values' at the given two independent variables.

Then, for example, if I use Origin 8.5, I can make a so called color mapped scatter plot which gives me a plot like usual two dimensional scatter plot but the color of the symbols are determined by the values in the third column.

I show an example from the Originlab, http://www.originlab.com/www/helponline/origin/en/UserGuide/Color_Mapped_Graph.html,

An example of the color mapped scatter plot made with Origin

 

I looked into the manual, etc. but I could not find a way. Because data are not evenly and homogeneously spread over x-y plane, and not dense, typical contour plot cannot be used.

 

Does anyone have a quick idea?

 

 

 

 

 

 

write a maple package for quaternion polynomials.it must include the following procedures:

1) for quaternion polynomials f, g:  find degree of f , compute f +g ,f-g, fg.

2)for matrices over quarternion polynomials A,B: compute A+B,A-B, AB.

hint using records to represent quaternions.

I have a procedure I need to place Inline and am not sure how to do this. 


Please help me to write a procedure that calculate the Integer remainder ( that do the same job as irem but I should not use any other maple procedures)

Thanks

First 1458 1459 1460 1461 1462 1463 1464 Last Page 1460 of 2434