Post Reply 
problems when paste text // (commentary) to the entry line
06-06-2016, 09:53 PM (This post was last modified: 06-06-2016 10:19 PM by compsystems.)
Post: #10
RE: problems when paste text // (commentary) to the entry line
(06-06-2016 05:04 PM)Thomas_Sch Wrote:  I'm curious: Why you are trying to copy a comment to the entry line?
on the ENTRY line also you can create CAS programs

______________________________________________
f1(x,y,z):=BEGIN local, v1,v2,v3; return x+y+z; END; [enter]
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
then you can edit the program

[Shift]+[Tools](Mem)
then go to "CAS VARS" ITEM
select f1 [EDIT] [EDIT]

the edition appears in a new entry line, should be on full display for easy coding, note that if you paste // the interpreted as a double division and not as a comment also found another problem , the comments disappear when edited and loss of information

I like to comment on my programs, other absolutely not

Code:
// version 0.1 Jun 5 2016 by COMPSYSTEMS
#cas
diff_table(xpr,var):=
    BEGIN
        LOCAL nparts, operator, part1, part2;
        print("");
        //CASE 1: if the expression is a variable name or identifier
        if (type(xpr)==DOM_IDENT) then
            // CASE 2: if the expression is equal to the variable, example diff(x,x)=1, otherwise diff(x,y)=0
            return when(xpr==var,1,0);
        end;
        // number of parts of the expression
        nparts:=part(xpr);
        //operator
        operator:=part(xpr,0);
        //CASE 3: diff(k,v)=0
        //print(nparts); print(operator); wait;
        if (nparts==0) then
            return 0; // xpr=pi, i, numbers
        end;
        if (nparts>1) then
            part1:=part(xpr,1);
            part2:=part(xpr,2);
            print(part1);print(part2);wait;
            else
            part1:=part(xpr,1);
            print(part1); wait;
        end;
        //CASE 4: diff(-f(v),v)=0 // NEG(xpr)
        if (operator=="-") then
            return -1*diff_table(part1,var);
        end;
        //CASE 5: diff(k*f(v),v)=0 // NEG(xpr)
        if (operator="*" and type(part1)==DOM_INT) then
            return part1*diff_table(part2,var);
        end;
        //CASE 6: diff(|f(v)|,v) with f(v)=v
        if (operator=="abs" and string(part1)==string(var)) then
            return sign(var); // assuming a function from R -> R
            //return var/abs(var); // Alternate Form
        end;
        //CASE 7: diff(|f(v)|,v)
        if (operator=="abs" and string(part1)≠string(var)) then
            return sign(var)*diff_table(part1,var);
        end;
        //         //CASE 8: diff(√(f(v)),v)
        //         if operator=="√" and string(part1)==string(var) then
        //             return 1/(2*√(var));
        //         end;
        //         //CASE 9: diff(√(v),v)
        //         if operator=="√" and string(part1)≠string(var) then
        //             return diff_table(part1,var)/(2*√(var));
        //         end;
        
        //CASE 8: diff(ln(v),v)
        if (operator=="ln" and string(part1)==string(var)) then
            return 1/var;
        end;
        //CASE 9: diff(ln(f(v)),v)
        if (operator=="ln" and string(part1)≠string(var)) then
            return diff_table(part1,var)/part1;
        end;
        //fun.trig
        //CASE 10: diff(sin(v),v)
        if operator="sin" and string(part1)==string(var) then
            return cos(var);
        end;
        //CASE 11: diff(sin(f(v)),v)
        if operator="sin" and string(part1)≠string(var) then
            return cos(part1)*deriv(p1,var);
        end;
        //CASE 12: diff(cos(v),v)
        if operator="cos" and string(part1)==string(var) then
            return ­sin(var);
        end;
        //CASE 13: diff(cos(f(v)),v)
        if operator="cos" and string(part1)≠string(var) then
            return ­sin(part1)*deriv(part1,var);
        end;
        //CASE 14: diff(tan(v),v)
        if operator="tan" and string(part1)==string(var) then
            return sec(var)^2 ;
        end;
        //CASE 15: diff(tan(f(v)),v)
        if operator="tan" and string(p1)≠string(var) then
            return sec(part1)^2*deriv(part1,var);
        end;
        
        // codifying
        // ...
        return Done;
    END;
#end

Attached image view, comments disappear in this "windows", impossible uncomment, comments serve to not execute code while the code is created


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: - compsystems - 06-06-2016, 12:17 PM
RE: problems when paste text // (commentary) to the entry line - compsystems - 06-06-2016 09:53 PM



User(s) browsing this thread: 1 Guest(s)