481 - Hermite

24 days ago by Professor481

# This cell in Sage mode var('u') H0 = (1-u)^2*(1+2*u) H1 = (1-u)^2*u H2 = (u-1)*u^2 H3 = (3-2*u)*u^2 G = plot(H0,(u,0,1),color='black')+plot(H1,(u,0,1),color='red')+plot(H2,(u,0,1),color='green')+plot(H3,(u,0,1),color='blue') show(G,aspect_ratio=1) 
       
Traceback (click to the left of this block for traceback)
...
error: source: error sourcing file
'/home/sageserver/.sage/temp/travis-PowerEdge-T430/837729/interface/tmp8\
37735'
Traceback (most recent call last):    G = plot(H0,(u,0,1),color='black')+plot(H1,(u,0,1),color='red')+plot(H2,(u,0,1),color='green')+plot(H3,(u,0,1),color='blue')
  File "", line 1, in <module>
    
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sagenb/misc/support.py", line 437, in syseval
    return system.eval(cmd, sage_globals, locals=sage_globals)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1348, in eval
    return self._eval_line_using_file(code)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 791, in _eval_line_using_file
    s = self._eval_line(self._read_in_file_command(tmp_to_use), allow_use_file=False, restart_if_needed=False)
  File "/home/sageserver/sage-8.7/local/lib/python2.7/site-packages/sage/interfaces/octave.py", line 311, in _eval_line
    raise SyntaxError(out)
SyntaxError: source("/home/sageserver/.sage/temp/travis-PowerEdge-T430/837729/interface/tmp837735");
parse error near line 7 of file /home/sageserver/.sage/temp/travis-PowerEdge-T430/837729/interface/tmp837735

  syntax error

>>> G = plot(H0,(u,0,1),color='black')+plot(H1,(u,0,1),color='red')+plot(H2,(u,0,1),color='green')+plot(H3,(u,0,1),color='blue')
                  ^

error: source: error sourcing file '/home/sageserver/.sage/temp/travis-PowerEdge-T430/837729/interface/tmp837735'
function y = H0(u) y = (1-u) .^2 .* (1+2*u) end function y = H1(u) y = (1-u) .^2 .*u end function y = H2(u) y = (u-1) .* u .^2 end function y = H3(u) y = (3-2 .*u) .* u .^2 end n = 3 x = [-1 2 3 7] y = [5 4 2 3] m = [1 -2 1 -1] for k = 2:n+1 xx = x(k-1):0.5:x(k); delx = x(k)-x(k-1); yy = H0( (xx-x(k-1))/(x(k)-x(k-1)) )*y(k-1) + H1( (xx-x(k-1))/(x(k)-x(k-1)) )*m(k-1)*delx + H2( (xx-x(k-1))/(x(k)-x(k-1)) )*m(k)*delx + H3( (xx-x(k-1))/(x(k)-x(k-1)) )*y(k); plot(xx,yy) hold on end 
       
n = 3
x =

 -1 2 3 7

y =

 5 4 2 3

m =

 1 -2 1 -1

y =

 1 0.925926 0.740741 0.5 0.259259 0.0740741 0

y =

 0 0.115741 0.148148 0.125 0.0740741 0.0231481 0

y =

 -0 -0.0231481 -0.0740741 -0.125 -0.148148 -0.115741 0

y =

 0 0.0740741 0.259259 0.5 0.740741 0.925926 1

y =

 1 0.5 0

y =

 0 0.125 0

y =

 -0 -0.125 0

y =

 0 0.5 1

y =

 1 0.957031 0.84375 0.683594 0.5 0.316406 0.15625 0.0429688 0

y =

 0 0.0957031 0.140625 0.146484 0.125 0.0878906 0.046875 0.0136719 0

y =

 -0 -0.0136719 -0.046875 -0.0878906 -0.125 -0.146484 -0.140625
-0.0957031 0

y =

 0 0.0429688 0.15625 0.316406 0.5 0.683594 0.84375 0.957031 1

                                                                        

 6
|-----------------------------------------------------------------------\
|   
   |             +              +             +              +          
|   
   |            *********                                               
|   
   |         ***         *                                              
|   
   |       **             *                                             
|   
 5 |-+    *                *                                            
+-|   
   |                        *                                           
|   
   |                         *                                          
|   
   |                          *                                         
|   
   |                           *                                        
|   
 4 |-+                          #                                       
+-|   
   |                            #                                       
|   
   |                             #                   $$$$$$$$$$$        
|   
   |                             #                 $$           $$$     
|   
   |                              #             $$$                $    
|   
 3 |-+                            #           $$                    $   
+-|   
   |                               #         $                          
|   
   |                               ##       $                           
|   
   |                                 ##   $$                            
|   
   |             +              +       $$    +              +          
|   
 2
|-----------------------------------------------------------------------\
|   
  -2             0              2             4              6          
8   
                                                                        
n = 3
x =

 -1 2 3 7

y =

 5 4 2 3

m =

 1 -2 1 -1

y =

 1 0.925926 0.740741 0.5 0.259259 0.0740741 0

y =

 0 0.115741 0.148148 0.125 0.0740741 0.0231481 0

y =

 -0 -0.0231481 -0.0740741 -0.125 -0.148148 -0.115741 0

y =

 0 0.0740741 0.259259 0.5 0.740741 0.925926 1

y =

 1 0.5 0

y =

 0 0.125 0

y =

 -0 -0.125 0

y =

 0 0.5 1

y =

 1 0.957031 0.84375 0.683594 0.5 0.316406 0.15625 0.0429688 0

y =

 0 0.0957031 0.140625 0.146484 0.125 0.0878906 0.046875 0.0136719 0

y =

 -0 -0.0136719 -0.046875 -0.0878906 -0.125 -0.146484 -0.140625 -0.0957031 0

y =

 0 0.0429688 0.15625 0.316406 0.5 0.683594 0.84375 0.957031 1

                                                                               
 6 |-----------------------------------------------------------------------|   
   |             +              +             +              +             |   
   |            *********                                                  |   
   |         ***         *                                                 |   
   |       **             *                                                |   
 5 |-+    *                *                                             +-|   
   |                        *                                              |   
   |                         *                                             |   
   |                          *                                            |   
   |                           *                                           |   
 4 |-+                          #                                        +-|   
   |                            #                                          |   
   |                             #                   $$$$$$$$$$$           |   
   |                             #                 $$           $$$        |   
   |                              #             $$$                $       |   
 3 |-+                            #           $$                    $    +-|   
   |                               #         $                             |   
   |                               ##       $                              |   
   |                                 ##   $$                               |   
   |             +              +       $$    +              +             |   
 2 |-----------------------------------------------------------------------|   
  -2             0              2             4              6             8