Sunday, 30 August 2015

CircuitSimulator Component Specification Aug 30 2015

I made some progress to circuit simulator with a the addition of components.

Now there is a components dialog with a list of components.

Example component:

So here is the component specification:

  • component_name represents the tooltip name
  • graphic represents how the component is drawn on the grid
  • icon is data for the img on the button
  • id is reference id with is used to retrieve properties for components
  • attributes are the component's values(e.g voltage,current,resistance)
graphic specification is different:
  • polygon represents a polygon,it has [x1,y1,x2,y2,x3,y3 ...] coordinates for every point
  • line represents a line [x1,y1,x2,y2]
  • linecircle is a circle made of lines [centerx,centery,outerradius,thickness]

Friday, 28 August 2015

nerdamer2AsciiMath Aug 29 2015

nerdamer has built in LaTeX generation but it lacks some support for some symbols. nerdamer2AsciiMath is meant to fill the gaps of the support and be independent of nerdamer. nerdamer2AsciiMath is better off independent from nerdamer because of these reasons:
  • nerdamer needs to be lightweight
  • nerdamer is mostly a parser
  • development cycles don't match up
  • both projects need to be simple
nerdamer2AsciiMath purpose is to parse nerdamer symbols into AsciiMath. From there you could convert them into LaTeX or MathML.

nerdamer LaTeX bug Aug 28 2015

I wrote some tests for the LaTeX in preparation for fix this bug.

After an hour of narrowing down the code in the LaTeX generation. I came across this....

The abs value tells the function to ignore the signs of the symbols. The first symbol is treated differently from the other symbols some how.

Well I took a guess and comment that line out and this happened.

The bug is now fixed somehow? Or I might have introduced new bugs?

Wednesday, 26 August 2015

Circuit Simulator Moving from qooxdoo to jquery ui Aug 26 2015

I have been using qooxdoo for a while.... and it is not bad. However, qooxdoo desktop version is very very heavy and has lots of dependencies. So I won't use it. Also the build time takes a while even if your application is very minimal.

On jquery ui side. The fonts don't resize well so I will have to use fortawesome instead.

Tuesday, 25 August 2015

Circuit simulator Aug 25 2015

Today, I built the foundation for a circuit simulator. It will use easeljs for the graphics, qooxdoo for UI,C3 for graphs, and nerdamer for equation solving.

Specification for Circuit Simulator 0.1.0:
  • Solve all resistor networks
  • Solve all networks with constant voltage sources
  • Save and load .sch files
  • Develop plug able modules
  • Write tests

nerdamer Symbolic Continuous Time Fourier Transform Aug 25 2015

Some progress has been made on the symbolic Fourier Transform. It was very hard to check the output using software because most of the software packages use numerical methods instead of symbolic. That makes them discrete instead of continuous. The other packages that are symbolic don't have advanced features. So I had to check them by hand.

The tests:

Right now, it has basic functions,time/frequency shift, and linearity. This makes nerdamer unique because there isn't any other javascript library that could do symbolic Fourier transform.

I have to get cos,sine,differential/integral equations, convolution ,amplitude shifting... and so on..

Sunday, 23 August 2015

nerdamer npm Aug 23 2015

If you read this. Then you know why nerdamer 0.5.6 doesn't exist on npm.

I can't undo the 0.5.6 publish,so I published 0.5.3 instead.

The npm package is identical with the releases except it has package.json.

How to use:
npm install nerdamer

>var nerdamer = require('nerdamer');
>var nerdamer = require('nerdamer/Calculus.js');

npm publish Aug 23 2015

npm is a harsh tool. npm publish is final and there is no going back ever.

If you publish a package with a version number. Then decide to update the package with the same version number. It won't let you. It also give no warning that publishing is final. So never publish anything until you are sure it works.

nerdamer Travis CI Aug 23 2015

For dev branch only not master

Travis CI is a cloud service that builds and tests software packages.I am focusing on node.js ,grunt, and qunit.

The basic idea is the package runs grunt. Then grunt runs the qunit tests. If the qunit tests pass then the badge will be green.
Smiley face

Starting with .travis.yml

 The language of the tests is set to node.js which is javascript. The versions 0.10, 0.11 , 0.12 tell it to only run tests under those. npm install -g grunt-cli tells it to install grunt before running the script.


The information for a node.js package. The important part is the scripts. It tells node.js to run grunt.

Grunt looks for a file called Gruntfile.js

It uses qunit to go through all the tests.

Well on to packaging for npm.

Saturday, 22 August 2015

nerdamer Powers Aug 22 2015

The original this.pow didn't check for edge cases and was written weirdly.

For one of the edge cases 0^0, the original code was:

The code didn't account for symbol1 to be 0 or infinity. The fix only applies to 0. Infinity is another case.......

Modified code:

Now for other other case of (-1)^x being wrong. The original:

I isolated the problem to Math.abs(symbol1.multiplier). Why Math.abs? I have no idea. It just doesn't work if symbol1.multiplier is -1.

Fixed code:

The problem is covert function doesn't account for negative numbers again....

Original convert code:

Math.abs(this.multiplier) is the problem again...

New convert code:

Now that the exponents are fixed... I need to fix the rounding issues.

Friday, 21 August 2015

nerdamer exp for complex numbers Aug 21 2015

After creating the im and re functions. I have to fix the exp function.

For any complex argument in exp:

It is just Euler's formula and exponent laws. a is real part and b is imaginary part.

So the new exp function becomes:

On to solving the (a+bi)^(f(x)) bug.....

nerdamer Complex numbers Aug 21 2015

nerdamer is lacking some functions for complex numbers.
So... I made functions for re, and im.

re takes in a complex number and gives the real part:

The function breaks down the symbols by + -. Then it filters the real part of the symbol and adds them up.

im function does the same thing:

However it divides by i at the end.

I also had to change the callfunction to take in complex numbers:

Thursday, 20 August 2015

OSEPP as an ISP Aug 20 2015

I bought a OSEPP Uno R3 Plus for an ISP, but I can't get it to work. I tested the functional of OSEPP before trying to program an atmega328p-pu. OSEPP  works works for everything except as an ISP. I only used the minimal configuration for an ISP. It might be the internal quartz crystal of OSEPP that is not working.

Wednesday, 19 August 2015

nerdamer Symbols Aug 19 2015

Everything in nerdamer revolves around symbol manipulation..... well most of the time.

Staring with a simple symbol
It looks like a function. You can see it from the group value. group: 4. Each symbol is organised into one of these groups:

 Group 4 belongs to the function, so it makes sense.
Moving on, multiplier is "5" in "5*delta". It doesn't make a lot of sense for it to be group with the function symbol. It should be a symbol by itself. The value is text without the multiplier. Ok... args is the arguments of the function.

Closer inspection of this argument.

 We are looking at "t+t^2". Again the group: 5 is some kind of polynomial. The value is t,so it is polynomial made out of t. The symbols of the object is the individual components.

Even.. deeper

Aha it is just "t" and "t^2". The parser breaks up the input by * / + -
So each symbol is just seperated by those operators.

Another example:

 You can see the structure is just like a tree.