PolyLink
A library to allow manipulation of geometry from within Mathematica
Main Page
Packages
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Properties
HelloWorld.cs
Go to the documentation of this file.
1
using
System;
2
using
System.Collections.Generic;
3
using
System.Linq;
4
using
System.Text;
5
using
System.Threading.Tasks;
6
using
Wolfram.NETLink;
7
8
namespace
PolyLink
9
{
10
/*
11
public static class HelloWorld
12
{
13
public static void PrintHelloWorld()
14
{
15
var ml = MathLinkFactory.CreateKernelLink();
16
ml.WaitAndDiscardAnswer();
17
18
Console.WriteLine(ml.EvaluateToOutputForm("Hello Mathematica",0));
19
}
20
21
public static Expr HelloWorldExpression()
22
{
23
24
var ml = MathLinkFactory.CreateKernelLink();
25
ml.WaitAndDiscardAnswer();
26
27
28
ml.Evaluate("Append[{\"Hello Mathematica\"},\"Again!\"]");
29
ml.WaitForAnswer();
30
Expr e = ml.GetExpr();
31
ml.Close();
32
return e;
33
}
34
35
public static String HelloWorldExpressionString()
36
{
37
38
var ml = MathLinkFactory.CreateKernelLink();
39
ml.WaitAndDiscardAnswer();
40
41
42
ml.Evaluate("Append[{\"Hello Mathematica\"},\"Again!\"]");
43
ml.WaitForAnswer();
44
return ml.GetExpr().ToString();
45
}
46
47
public static int ReturnTwo()
48
{
49
return 2;
50
}
51
52
public static IEnumerable<Expr> TenExpressions
53
{
54
get { return Enumerable.Range(0, 10).Select(x => MSingle.Eval(x.ToString())); }
55
}
56
57
public static Expr TestEnumerableToList()
58
{
59
return TenExpressions.AsListExpr();
60
}
61
62
public static Expr AsListExpr(this IEnumerable<Expr> exprList)
63
{
64
String s = "{" + String.Join(",", exprList.Select(e => e.ToString())) + "}";
65
MSingle.Kernel.Evaluate(s);
66
MSingle.Kernel.WaitForAnswer();
67
var evaluated = MSingle.Kernel.GetExpr();
68
return evaluated;
69
}
70
71
public static Expr TestEnumerableToListQuick()
72
{
73
return "List".MsBracket(TenExpressions);
74
}
75
}*/
76
}
DropBox
Dropbox
2013 REU
MathPolys
MathPolyLib
HelloWorld.cs
Generated on Thu Nov 21 2013 10:10:31 for PolyLink by
1.8.5