Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalsaleh committed Jul 4, 2024
1 parent 5b41b55 commit a6173d7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 49 deletions.
46 changes: 23 additions & 23 deletions examples/CategoryOfParametrisedMorphisms.g
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,27 @@ Display( t );
#! + 0.88 * (Exp( x1 ) / (5.10727 + Exp( x1 ))) + 0.59
#! ‣ 0.67 * (2.39116 / (5.10727 + Exp( x1 ))) + 0.05 * (2.71611 / (5.10727 + Exp( x1 )))
#! + 0.85 * (Exp( x1 ) / (5.10727 + Exp( x1 ))) + 0.31
s := SimplifyMorphism( t, infinity );
#! ℝ^1 -> ℝ^2 defined by:
#!
#! Parameter Object:
#! -----------------
#! ℝ^0
#!
#! Parametrised Morphism:
#! ----------------------
#! ℝ^1 -> ℝ^2
Display( s );
#! ℝ^1 -> ℝ^2 defined by:
#!
#! Parameter Object:
#! -----------------
#! ℝ^0
#!
#! Parametrised Morphism:
#! ----------------------
#! ℝ^1 -> ℝ^2
#!
#! ‣ (1.47 * Exp( x1 ) + 5.84111) / (Exp( x1 ) + 5.10727)
#! ‣ (1.16 * Exp( x1 ) + 3.32114) / (Exp( x1 ) + 5.10727)
# gap> s := SimplifyMorphism( t, infinity );
# ℝ^1 -> ℝ^2 defined by:
#
# Parameter Object:
# -----------------
# ℝ^0
#
# Parametrised Morphism:
# ----------------------
# ℝ^1 -> ℝ^2
# gap> Display( s );
# ℝ^1 -> ℝ^2 defined by:
#
# Parameter Object:
# -----------------
# ℝ^0
#
# Parametrised Morphism:
# ----------------------
# ℝ^1 -> ℝ^2
#
# ‣ (1.47 * Exp( x1 ) + 5.84111) / (Exp( x1 ) + 5.10727)
# ‣ (1.16 * Exp( x1 ) + 3.32114) / (Exp( x1 ) + 5.10727)
#! @EndExample
28 changes: 2 additions & 26 deletions examples/Expressions.g
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,6 @@ Variables( x1 );
#! [ [ x1 * x3 + x2 * (- x3) ] ]
e := Sin( x1 ) / Cos( x1 ) + Sin( x2 ) ^ 2 + Cos( x2 ) ^ 2;
#! Sin( x1 ) / Cos( x1 ) + Sin( x2 ) ^ 2 + Cos( x2 ) ^ 2
SimplifyExpressionUsingPython( [ e ] );
#! [ "Tan(x1) + 1" ]
e := Sin( x1 ) * Log( x2 ) + Exp( Cos( x3 ) );
#! Sin( x1 ) * Log( x2 ) + Exp( Cos( x3 ) )
Diff( e, 1 )( dummy_input );
#! Log( x2 ) * Cos( x1 )
Diff( e, 2 )( dummy_input );
#! Sin( x1 ) / x2
Diff( e, 3 )( dummy_input );
#! (- Exp( Cos( x3 ) )) * Sin( x3 )
x;
#! [ 3, 2, 4 ]
Diff( e, 1 )( x );
#! -0.686211
z := LazyDiff( e, 1 )( x );
#! Diff( [ "x1", "x2", "x3" ], "((Sin(x1))*(Log(x2)))+(Exp(Cos(x3)))", 1 )( [3, 2, 4] )
Eval( z );
#! -0.686211
exps := [ x1 * x2 + x3, Sin( x2 + x3 ) ];
#! [ x1 * x2 + x3, Sin( x2 + x3 ) ]
JacobianMatrix( exps, [ 1, 2, 3 ] )( dummy_input );
#! [ [ x2, x1, 1 ], [ 0, Cos( x2 + x3 ), Cos( x2 + x3 ) ] ]
JacobianMatrix( exps, [ 1, 2 ] )( dummy_input );
#! [ [ x2, x1 ], [ 0, Cos( x2 + x3 ) ] ]
JacobianMatrix( exps, [ 1, 2 ] )( x );
#! [ [ 2, 3 ], [ 0, 0.96017 ] ]
# SimplifyExpressionUsingPython( [ e ] );
# [ "Tan(x1) + 1" ]
#! @EndExample

0 comments on commit a6173d7

Please sign in to comment.