# Catching Up

# Prologue

I want to catch up with what I’ve implemented so far.

This is not what’s new, but rather a glimpse on what I’ve done and still remembering it

I really need to organize my thoughts about what is happening in this project

the scattering thoughts are frightening me :S

# Tensor Parsing:

I want to add Tensor badly in Qs because I wasn’t able to understand it I had to include it

however I’ve Added Tensor parsing

Qs> <|4 3;3 2| 4 5; 5 3 |>

Yes this is a 3rd rank tensor or you may see it as a two matrices in the Z-Axis

what about 4th Tensor (You may ask) ??!! Bear with me I am still thinking of a natural syntax to add it.

also I would like to remind my self that Stress tensor is a 2nd rank tensor (which looks like matrix but with special operations)

using <|…|> syntax you can define also zero rank tensor up to 3rd rank tensor (what will I do with this?? I don’t KNOW)

# Text

yes I included the text at last (I was struggling against putting text in Qs, but it was necessary :S or let me say I couldn’t come up with another strategy.

Qs> ml = “c d e f g a b c>”;

Qs> Music:Play(ml + ” ” ml); #Music:Play is an extension function that play midi and the music library is 100% implemented by me (I mean sequencer part and music DSL as it contains eastern tones also – another story indeed)

and yes you can add text to text, also imagine you can add text to number

Qs> 4 + “44”

DimensionlessQuantity: 48 <1>

but the opposite is will not act like this (because I am casting to the left type always – which is the first one in fact)

What is meant by adding text is to differentiate between sending text to functions and sending other types.

so Windows:MessageBox function now accept Text

Windows:MessageBox(“Hello There”) will result into messagebox ofcourse (just try it)

to escape quotation mark use back slash “\”hello\””

# Functions

I like it 🙂 (do you ?!? :):))

## Function Extensions

With C# or any .Net language frankly {put static class with static functions under Qs.Modules namespace}

the class name becomes namespace in Qs.

– I’ve enhanced the function binding so you can write your C# native function with native numerical type and I will cast it to you without you notice it ( no more QsValue as a parameter type), however this will add other processing lag (but who cares 😀 everything is cached after this)

also I can map vector to array of numbers so use ff(int[] ia) declaration 🙂 it will work

Why I was enhancing the extension functions {simply because I am planning to include OpenGL } asking me why :O :O :O ??

silly, every numerical system has a 3d device to render to it.

but frankly I am thinking of visualizing Scalars, vectors, and tensors into 3d conceptual drawings

however OpenGL is a very far idea

emmm

don’t forget the Graph:Plot(xvector, y1vector) it really draws and I consumed a free opensource library to do it.

may be a freakin plot but hey it works and I can visualize some quick samples indeed.

## Function Named Arguments

Quantity System Engine can consume different declaration to the function with the same name

however you must change the parameter names

that’s why you can call the function with named arguments (shhsh argument==parameter so I use it interchangeably)

all the following are correct declarations

f(x) = x

f(y) = y^1.5

f(z) = z^2

f(er) = er/4

f(g) = g+9/g^2

**Note**: the first function name declared is the (default function) the one you call it without specify named arguments

to call any of these functions use the ‘=’ equal sign

f(g=5)+f(er=3)

## Function Variables

Now you can treat the functions as normal variables because they are inherited from QsValue (internal structure of Qs)

so that when declaring

u(x) = x^2

v(x) = x/2

w(x) = x*9

r = @u+@v+@w # <== this sum all functions and generate new function in r

r(x) = x^2+x/2+x*9

and don’t worry about parameters, as they are merged for you with any number of them

all basic operations supported (simply I merge the function declaration text with the desired operator :))

HOWEVER this is going to change after I put the symbolic algebra library 🙂 (another library I am making) 😦 😦

What about named argument functions??!! (clever question)

imagine you have a x-component speed in u function

u(x) = x

u(y) = y/2

u(z) = z^2.1

you can write

u = @u(x) + @u(y) +@u(z)

and yes

Qs> u(3,4,5) #IT WILL Work

because you may not remember but I encode the functions in the memory based on their arguments number also

so u(x,y,z) now is the default function of u in 3 arguments 😉 (impressive for me I admit)

# Sequence

my beloved feature.

sequence now can return a function series

for example

e[n](x) ..> x^n/n!

e[1](1) gives 1

however calling the sequence without specify argument (IN argument enables sequence)

e[1] gives _(x) = x^1/1!

and you can assign it to a function also

let me make it fast

exp = e[0++20]

gives

_(x) = (x^0/0!) + (x^1/1!) + (x^2/2!) + (x^3/3!) + (x^4/4!) + (x^5/5!) + (x^6/6!) + (x^7/7!) + (x^8/8!) + (x^9/9!) + (x^10/10!) + (x^11/11!) + (x^12/12!) + (x^13/13!) + (x^14/14!) + (x^15/15!) + (x^16/16!) + (x^17/17!) + (x^18/18!) + (x^19/19!) + (x^20/20!)

which when you can call your exp normally

exp(1)

# Shifting Operators

I’ve added ‘**>>**‘ right shift as C family and ‘**<<**‘ left shift

simply the operators is shifting vectors and matrices

not implemented yet for tensors

and also you will find these operators starting of Qs 1.1.9.94 release Changeset 39690

I hope I listed things that I remembered for now

and chaao 😀