|
[Date Index]
[Thread Index]
[Author Index]
Re: (Newbie question): New types of numbers
- To: mathgroup at smc.vnet.net
- Subject: [mg66556] Re: [mg66545] (Newbie question): New types of numbers
- From: "Carl K. Woll" <carlw at wolfram.com>
- Date: Sat, 20 May 2006 04:46:51 -0400 (EDT)
- References: <200605190740.DAA12871@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
craigugoretz at gmail.com wrote:
> Hello,
>
> I am new to Mathematica, but I have a potentially complex problem
> to solve. My goal is get Mathematica to understand a new type of
> number called a "neutrosophic number". Neutrosophic numbers have a
> similar form to complex numbers, except that I^2 = I instead of I^2=-1.
> Is it possible to add a new type for the neutrosophic numbers in
> addition to the four types that Mathematica currently supports
> (Integer, Real, Rational, Complex per Appendix A.1.5 in the help
> browser for Mathematica 5.1)? If so, what bases would I need to cover
> to make the implementation possible for user defined operators (to be
> developed) and the system operators '+' and '*' (to begin with). If it
> is not possible to create new types of numbers, is there a way to "fake
> it"? One possible example may involve intercepting input from the main
> evaluation loop and coercing it somehow.
>
> Sincerely,
> Craig
> Ugoretz
One possibility is to create your own data structure and give rules for
multiplication, addition and powers of the data structure:
neuro /: neuro[a_, b_] neuro[c_, d_] := neuro[a c, a d + b c + b d]
neuro /: neuro[a_, b_]^n_Integer := neuro[a^n, ((a + b))^n - a^n]
neuro /: neuro[a_, b_] + neuro[c_, d_] := neuro[a + c, b + d]
neuro /: x_ neuro[a_, b_] := neuro[a x, b x]
neuro /: x_ + neuro[a_, b_] := neuro[a + x, b]
For example:
In[17]:= neuro[0, 1] neuro[0, 1]
Out[17]= neuro(0, 1)
In[18]:= a + b neuro[0, 1]
Out[18]= neuro(a, b)
In[19]:= neuro[a, b] neuro[c, d]
Out[19]= neuro(a c, b c + a d + b d)
In[20]:= neuro[a, b]^3
Out[20]= neuro(a^3, ((a + b))^3 - a^3)
One can also create formatting rules so that neuro[a,b] displays as
a+b *n*
where *n* is your I element.
Carl Woll
Wolfram Research
Prev by Date:
Re: NonlinearFit problem
Next by Date:
Re: Packages--JLink class is loaded but cannot be found?
Previous by thread:
(Newbie question): New types of numbers
Next by thread:
Re: (Newbie question): New types of numbers
|