Search code examples
mathequationmaplecalculus

Why is MAPLE not evaluating integrals and derivative inside my equations?


I'm using MAPLE 2019 and trying to insert different equations related with each other in order to evaluate one of them by insertions, integral and derivative calulations, till I get a compact short form where only independent variables appear.

Here my screenshot

As you can see, integrals and derivatives are no further computed. My goal is to evaluate R as function of all independent variables or costants.


Solution

  • Your Maple Document shows that you are in a muddle with the distinctions between expressions and operators (a.k.a. procedures).

    The Document is additionally confusing because some of the statements have been executed out of order. It looks as if you had gone back and re-executed earlier statements. (For example, it looks like you re-executed the 1st after the 2nd, and the 3rd after the 4th.) This is not going to help you, especially in the presence of fundamental misunderstanding about expressions and operators.

    Let's do a quick review of expressions and operators.

    An expression (such as exp(...)) is already a function call and cannot be directly applied as another function call. Here is an expression, assigned to the name R1:

    R1 := exp(-lambda1*t);
    

    You cannot just apply R1 to some arguments, functionally. That's not the way to evaluate that expression with a substituted value to replace, say, t. You can't usefully do the following,

    R1(ts);

             exp(-lambda1*t)(ts)
    

    What you can do with an expression is evaluate it with a new value for one of its symbols (names, like t). You can do this,

    eval(R1, t=ts);
    
                exp(-lambda1 ts)
    

    The diff command can be used on expressions, For example,

    f1 := diff(R1, t);
    
          f1 := -lambda1 exp(-lambda1 t)
    

    You could furthermore evaluate that new expression (for the derivative) at a new value for t. Eg,

    eval(f1, t=ts);
    
            -lambda1 exp(-lambda1 ts)
    

    Now let's discuss operators. An operator is kind of simple procedure that prints (and can be entered) using a pretty arrow notation.

    R1 := t -> exp(-lambda1*t);
    
              R1 := t -> exp(-lambda1 t)
    

    An operator can be applied to one or more arguments, using round brackets to denote that function call. In this example the argument passed, ts, is substituted for the operator's parameter t.

    R1(ts);
    
                exp(-lambda1 ts)
    

    The D command can produce a new operator which -- when executed -- computes the derivative.

    f1 := D(R1);
    
         f1 := t -> -lambda1 exp(-lambda1 t)
    
    f1(ts);
    
            -lambda1 exp(-lambda1 ts)
    

    Now let's consider a few ways to tackle your example. There are several, and I'm only going to show a few. The key thing is to keep straight whether you're dealing with expressions or operators.

    I won't include the outputs below. But some of the ways of doing it will have pretty-printed outputs which you might find more useful to seeing what's going on mathematically.

    I suggest that you try and understand all the following code written in 1D (plaintext) Maple notation, before trying to accomplish any of it using (typeset) 2D Input as in your screenshot.

    The following is all done with expressions. It uses the active commands diff, eval, and int (which evaluate right away).

    restart;
    R := R__1 + R__S*P__2;
    R__1 := exp(-lambda__1*t);
    f__1 := diff(R__1, t);
    R__2 := exp(-lambda__2*t);
    eval(f__1,t=t__s);
    eval(R__2,t=t-t__s);
    P__2 := int(eval(f__1,t=t__s)*eval(R__2,t=t-t__s),t__s=0..t);
    R;
    

    The following is also done with expressions. But it uses the inert commands Diff, Eval, and Int so that you can see what's going on in the output before using the value command.

    restart;
    R := R__1 + R__S*P__2;
    R__1 := exp(-lambda__1*t);
    f__1 := Diff(R__1, t);
    R__2 := exp(-lambda__2*t);
    Eval(f__1,t=t__s);
    Eval(R__2,t=t-t__s);
    P__2 := int(Eval(f__1,t=t__s)*Eval(R__2,t=t-t__s),t__s=0..t);
    R;
    value(R);
    

    The following uses operators all round.

    restart;
    R := t -> R__1(t) + R__S*P__2(t);
    R__1 := t -> exp(-lambda__1*t);
    f__1 := D(R__1);
    R__2 := t -> exp(-lambda__2*t);
    f__1(t__s);
    R__2(t-t__s);
    P__2 :=  t -> int(f__1(t__s)*R__2(t-t__s),t__s=0..t);
    R(t);
    

    The following uses operators for only R__1, f__, and R__2.

    restart;
    R := R__1(t) + R__S*P__2;
    R__1 := t -> exp(-lambda__1*t);
    f__1 := D(R__1);
    R__2 := t -> exp(-lambda__2*t);
    f__1(t__s);
    R__2(t-t__s);
    P__2 :=  int(f__1(t__s)*R__2(t-t__s),t__s=0..t);
    R;
    

    There are several other possible variants. You may want to read the Programming Guide (perhaps especially Chapter 3 and Section 6.9).