mathnet / mathnet-symbolics

Math.NET Symbolics
http://symbolics.mathdotnet.com
MIT License
341 stars 66 forks source link

declare symbolic #76

Open Electrowolf2 opened 4 years ago

Electrowolf2 commented 4 years ago

Hello, my problem is the following: I am working with unity3d in C # language and when I want to declare a variable, I need to specify the type of variable first, it does not allow me to place the word "var", and try all the types of variable that the program but I always get that you can not convert any type to the expression type.

how should I do it? Thanks for the help

FoggyFinder commented 4 years ago

Hello. There is a sample in docs:

using Expr = MathNet.Symbolics.SymbolicExpression;

var x = Expr.Variable("x");

https://symbolics.mathdotnet.com

cdrnet commented 4 years ago

So in this example, instead of var x = you could write Expr x =. When using the SymbolicExpression wrapper, then all expressions will always have that type.

Electrowolf2 commented 4 years ago

I have already seen the example as you mention foggy, but as I mentioned before, the word "var" does not recognize me, I get an error, cdrnet, try to do it in the way you tell me but also does not recognize me, I still have the problem .

I don't know if it's any use, I could upload photos so that you can see that the visual studio doesn't recognize those words.

Electrowolf2 commented 4 years ago

Hello guys, well I tell you that I have managed to fix the problem, but I have found another one and I guess it is easier to solve than the previous one but I still have not been able to solve it, maybe it is a problem of the VS version (2019).

The new problem is the following: I have already described the mathnet.symbolics nuguet from the VS download manager, I include it in the middle of the script, and there is no error, but when I want to run it in unity3d, it tells me the following:

Assets \ scripts \ testeo_mathnet.cs (4.7): error CS0246: The type or namespace name 'MathNet' could not be found (are you missing a using directive or an assembly reference?)

I thought it would be solved by copying the dlls to the folder where I have the script but it didn't work.

Could you help me? I appreciate the help in advance.

FoggyFinder commented 4 years ago

The new problem is the following: I have already described the mathnet.symbolics nuguet from the VS download manager, I include it in the middle of the script, and there is no error, but when I want to run it in unity3d, it tells me the following:

@Electrowolf2 Are you sure that package was installed successfully?