Supporting substitutions15 Aug 2015 GSoC-2015 · SymEngine
Hello All! I can say this week was quite productive. Ondrej, my mentor, had suggested me to make a new timeline for the rest of the time, and now I know how useful that turned out to be!
So, the beginner notebook is now upto date and contains everything that you need to know to get started. Also, I have prepared another notebook, that takes an actual question on differentiation from math.stackoverflow.com and solves it using SymEngine. It can be found here. It really shows, how convenient can using SymEngine be.
Substitutions module (
Now, you can mention what to substitute with what by storing the information in a Hash and then passing it to the
subs method on any expression. It will return the same expression where keys would have been substituted by their corresponding mapped values.
x = SymEngine::Symbol.new('x') y = SymEngine::Symbol.new('y') z = SymEngine::Symbol.new('z') k = SymEngine::Symbol.new('k') e = x + y + z f = e.subs(x => k , y => k / 2, => z => 2 * k) puts f.to_s # (7/2)*k
Making a Hash is not necessary, if you want to substitute just one variable
e.subs(x, 2).to_s # 2+y+z
I will be working on porting the trigonometric functions, and documentation/cleanup work mostly. If time permits, maybe we can move to Matrices and that can go with my code sample for GSoC endterm evaluation.
- Updated the beginner notebook
- Added the Ruby wrappers for
- Added rspec tests for
- Example notebook demonstrating differentiation with an actual problem
- Added the source for basic_subs2
- Added c tests for basic_subs2
- Modified implementation of basic_subs2
- Added C wrapper source for map_basic_basic
- Added tests for CMapBasicBasic
- Added pending tests for
- supported 2 param
#subswith tests passing
- Added c wrapper source for basic_subs
- Added c tests for basic_subs
#subswith Hash, tests pass
- Added test cases for error checking
- Added 3-element Hash test case for subs
comments powered by Disqus