Changeset 16551
- Timestamp:
- 01/24/19 18:52:18 (6 years ago)
- Location:
- branches/2520_PersistenceReintegration
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2520_PersistenceReintegration
- Property svn:mergeinfo changed
/trunk merged: 16542-16543
- Property svn:mergeinfo changed
-
branches/2520_PersistenceReintegration/HeuristicLab.ExtLibs
- Property svn:mergeinfo changed
/trunk/HeuristicLab.ExtLibs merged: 16542
- Property svn:mergeinfo changed
-
branches/2520_PersistenceReintegration/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/HeuristicLab.NativeInterpreter-0.1.csproj
r16452 r16551 39 39 </PropertyGroup> 40 40 <ItemGroup> 41 <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">42 <SpecificVersion>False</SpecificVersion>43 <HintPath>..\..\..\..\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>44 <Private>False</Private>45 </Reference>46 41 <Reference Include="System" /> 47 42 <Reference Include="System.Core" /> … … 69 64 </Content> 70 65 </ItemGroup> 66 <ItemGroup> 67 <ProjectReference Include="..\..\..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 68 <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project> 69 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 70 <Private>False</Private> 71 </ProjectReference> 72 </ItemGroup> 71 73 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 72 74 </Project> -
branches/2520_PersistenceReintegration/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 16543
- Property svn:mergeinfo changed
-
branches/2520_PersistenceReintegration/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/DerivativeCalculator.cs
r16453 r16551 48 48 private static readonly Cosine cosSy = new Cosine(); 49 49 private static readonly Square sqrSy = new Square(); 50 private static readonly Absolute absSy = new Absolute(); 51 private static readonly SquareRoot sqrtSy = new SquareRoot(); 50 52 51 53 public static ISymbolicExpressionTreeNode Derive(ISymbolicExpressionTreeNode branch, string variableName) { … … 138 140 return Product(Div(CreateConstant(1.0), Product(CreateConstant(2.0), f)), Derive(u, variableName)); 139 141 } 142 if (branch.Symbol is CubeRoot) { 143 var f = (ISymbolicExpressionTreeNode)branch.Clone(); 144 var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone(); 145 return Product(Div(CreateConstant(1.0), Product(CreateConstant(3.0), Square(f))), Derive(u, variableName)); 146 } 147 if (branch.Symbol is Cube) { 148 var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone(); 149 return Product(Product(CreateConstant(3.0), Square(f)), Derive(f, variableName)); 150 } 151 if (branch.Symbol is Absolute) { 152 var f = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone(); 153 var absf = Abs((ISymbolicExpressionTreeNode)f.Clone()); 154 return Product(Div(f, absf), Derive(f, variableName)); 155 } 156 if (branch.Symbol is AnalyticQuotient) { 157 // aq(a(x), b(x)) = a(x) / sqrt(b(x)²+1) 158 var a = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone(); 159 var b = (ISymbolicExpressionTreeNode)branch.GetSubtree(1).Clone(); 160 161 var definition = Div(a, SquareRoot(Sum(Square(b), CreateConstant(1.0)))); 162 return Derive(definition, variableName); 163 } 140 164 if (branch.Symbol is Sine) { 141 165 var u = (ISymbolicExpressionTreeNode)branch.GetSubtree(0).Clone(); … … 195 219 return cos; 196 220 } 221 private static ISymbolicExpressionTreeNode Abs(ISymbolicExpressionTreeNode f) { 222 var abs = absSy.CreateTreeNode(); 223 abs.AddSubtree(f); 224 return abs; 225 } 197 226 private static ISymbolicExpressionTreeNode Square(ISymbolicExpressionTreeNode f) { 198 227 var sqr = sqrSy.CreateTreeNode(); 199 228 sqr.AddSubtree(f); 200 229 return sqr; 230 } 231 private static ISymbolicExpressionTreeNode SquareRoot(ISymbolicExpressionTreeNode f) { 232 var sqrt = sqrtSy.CreateTreeNode(); 233 sqrt.AddSubtree(f); 234 return sqrt; 201 235 } 202 236 … … 221 255 !(n.Symbol is Square) && 222 256 !(n.Symbol is SquareRoot) && 257 !(n.Symbol is Cube) && 258 !(n.Symbol is CubeRoot) && 259 !(n.Symbol is Absolute) && 260 !(n.Symbol is AnalyticQuotient) && 223 261 !(n.Symbol is Sine) && 224 262 !(n.Symbol is Cosine) && -
branches/2520_PersistenceReintegration/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Tests merged: 16543
- Property svn:mergeinfo changed
-
branches/2520_PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/DeriveTest.cs
r16529 r16551 59 59 Assert.AreEqual("(SIN((3*'x')) * (-3))", Derive("cos(3*x)", "x")); 60 60 Assert.AreEqual("(1 / (SQR(COS((3*'x'))) * 0.333333333333333))", Derive("tan(3*x)", "x")); // diff(tan(f(x)), x) = 1.0 / cos²(f(x)), simplifier puts constant factor into the denominator 61 62 Assert.AreEqual("((9*'x') / ABS((3*'x')))", Derive("abs(3*x)", "x")); 63 Assert.AreEqual("(SQR('x') * 3)", Derive("cube(x)", "x")); 64 Assert.AreEqual("(1 / (SQR(CUBEROOT('x')) * 3))", Derive("cuberoot(x)", "x")); 61 65 62 66 Assert.AreEqual("0", Derive("(a+b)/(x+SQR(x))", "y")); // df(a,b,x) / dy = 0
Note: See TracChangeset
for help on using the changeset viewer.