Post Reply 
not suitable format for function definitions, to display symbolic results (CAS)
01-20-2016, 05:20 PM (This post was last modified: 01-20-2016 05:29 PM by compsystems.)
Post: #1
not suitable format for function definitions, to display symbolic results (CAS)
Hello sorry for my bad English

I wish to make a program, which shows the step by step, yet not 2D expressions (math book) viewer on terminal, I am not satisfied with the current impression 1D (linear)

First consider the following definition

vector5(n) := seq (z^k, k, 1, n) [ENTER]

It is placed on history as:

(n)->seq( z ^ k, k, 1, n)

if you want to modify the above definition k => (k+1) , the expression (n)->seq( z^k, k, 1, n) is useless because it does not include the name of the function to overwrite function

I think it should include the name of the function to edit, otherwise you have to go to the original definition (ENTRY ANS). The idea is to edit in two ways

vector5(n) := seq (z^k, k, 1, n)

or

vector5(n)->seq( z^(k+1), k, 1, n)

... by showing a step (TERMINAL VIEW), creating implicit vector vector5 shown as

vec5 = (n)->seq( z^(k+1), k, 1, n) , it's confusing as a teaching tool

Now when I show the symbolic dot product, the expression is much more confusing

vec5(n) · vec6(n) = dot( ( n->seq(z^k,k,1,n) ) (n) , ( n->seq((1/(a+z)^k),k,1,n) )(n) )

Why is placing a postfix (n)?

To solve this problem, I suggest that the function RIGHT, get the right side of a definition, so I can capture the expression and not the definition

right( n->seq(z^k,k,1,n) ) => seq(z^k,k,1,n) =)

PHP Code:
#cas
vectorExamples()
BEGIN
    
//implicit definition of a vector
    
    // explicit *
    //vector1 := seq(3*k^3-5*k^2+17*k,k,-14,2,3);
    // implicit *
    //vector2:= seq(3k^3-5k^2+17k,k,-14,2,3);
    
    //print("vec1 = " + vector1); wait; print("vec2 = " + vector2); wait; print("");
    
    
vector3 := seq(k^2-3*k,k,1,5);
    
vector4 := seq(2*k^3+5*k,k,1,5);
    
    print(
"vec3 = " vector3); wait// print("vec3 = " + right( vector3)  ); 
    
print("vec4 = " vector4); wait// print("vec4 = " + right( vector4)  );
    
    //scalar product
    
scalar1 := dot(vector3,vector4);
    print(
"vec3 · vec4 = " scalar1); wait// print("vec3 · vec4 = " + right( scalar1)  );
    
print("");
    
    
vector5(n) := seq(z^k,k,1,n);
    
vector6(n) := seq(1/(a+z)^k,k,1,n);
    
    
    print(
"vec5 = " vector5); wait;
    print(
"vec6 = " vector6); wait;
    print(
"");
    
    
scalar2(n):= dot(vector5(n),vector6(n));
    print(
scalar2);
    print(
"");
    print(
"scalar2(3): " scalar2(3));
    print(
"");
    print(
"scalar2(3)|(a=8,z=9)): " approx(scalar2(3)|(a=8,z=9)));
    
wait;
    
    
scalar3(n,a_,z_):= scalar2(n)|(a=a_,z=z_);
    print(
scalar3);
    print(
scalar3(3,8,9));
    
    
//vectorial product
END;
#end 

// terminal view
vector1: [-9450,-4785,-1992,-585,-78,15]
vector2: [-9450,-4785,-1992,-585,-78,15]

vec3 = [-2,-2,0,4,10]
vec4 = [7,26,69,148,275]
vec3 · vec4 = 3276

vector5: (n)->seq (z^k, k, 1, n)
vector6: (n)->seq((1/(z+a)^k),k,1,n)
scalar2:
(n)-> dot( ( n->seq(z^k,k,1,n) )(n), ( n->seq((1/(a+z)^k),k,1,n) )(n) )

vector5(3) = [z,z^2,z^3]

vector6(3) = [1/(a+z),1/(a+z)^2,1/(a+z)^3]

vector5(3) · vector6(3) = (z/(a+z))+(z^2/(a+z)^2)+z^3/(a+z)^3

ans | (a=8,z=9)

4707/4913

0.958070425402
Find all posts by this user
Quote this message in a reply
Post Reply 




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