102 Reputation

8 Badges

8 years, 101 days

MaplePrimes Activity

These are replies submitted by Honigmelone

@Christian Wolinski 

hey thanks for your solution. I tested it a bit and I found a strange behaviour. Most of the times it already seems to work without assume and simplify, but see for yourself:



abs(a-b)*abs(1, a-b)


convert(f_symbol,signum);                                   #works




abs(a(t)+b)*abs(1, a(t)+b)


(convert(f_plus,signum));                                   #works





abs(-a(t)+b)*abs(1, a(t)-b)


# assume(a(t),real,b,real);                                 #it always works with this assumption

c:=simplify(simplify(simplify(convert(f_minus,signum))));   #expected result: a(t)-b



simplify(c);                                                #???????







Download simplify_abs.mw


thank you for your answer! Your addition works for me.


thanks for your answers, I guess I missunderstood the assume facility. Yes I use Maple 18.


Well I agree that if you set b(t):= 0 this means that b(t) equals 0 for all t  and thus diff(b(t),t) is zero for all t too. However in some situations you might want to evaluate an expression at a t0 for which you know that b(t0):=0 but eval(diff(b(t),t),t0) is whatever. So we are discussing difrent points here I guess. If you know any better way to tell maple that a funktion has a specified value at a given value of its argument but not for all values you might have the better solution for OP's problem.

OP wants the result a(t)*(diff(b(t), t))  and that is exactly the result of my answer.

@Carl Love 

Thank you both for your suggestions, my code will run smoothly now:)



@Mac Dude  EDIT: this is supposed to be a reply to mac dude, but somehow I replied to myself :(

Hey, thanks for your suggestion. Just to clarify the problem that I had: When a vector e.g.


and a list



VectorCalculus[Jacobian](v,diff~(r,t)) only returns the error:

"Error, invalid input: too many and/or wrong type of arguments passed to VectorCalculus:-Jacobian; first unused argument is [r1(t), r2(t)]"

Maybe there is something else that I am doing wrong, but thank to thaw /freeze my workaround became much simpler.


@Preben Alsholm

Thanks for your suggestions! With them and the help of freeze thaw I was able to write a function that computes the Jacobian even if there are anonymous functions and their derivatives involved. I also didn't know about selectremove, however I think it's quite difficult to use this in a function when the order of derivative is not known. Here is what I wrote if anyone else ever stumbles across this.

MyJacobian := proc(a::Vector,b::Vector)
    # a consists of expressions of the elements of b(t)
    description "Computes the Jacobian of two vectors even if vector b is made up of anoymous functions and vector a contains derivatives of b(i)"
    local a_subs;
    local b_subs;
    local sizeb:
    local i,j,J_subs:

    sizeb := LinearAlgebra[Dimension](b);
    a_subs := convert(a,D);
    b_subs := convert(b,D);

   #substitution loops
    for j from 1 to sizeb do
        a_subs := subs(b_subs(j)=freeze(b_subs(j)),a_subs);
    end do;

    for i from 1 to sizeb do
        b_subs := subs(b_subs(i)=freeze(b_subs(i)),b_subs);
    end do;

    J_subs := VectorCalculus[Jacobian](a_subs,convert(b_subs,list)):

    return convert(thaw(J_subs),diff);
end proc:

Hey, I also got the error and I think it's normally caused if any statement is between the variable declaration and the proc().


1 2 Page 2 of 2