# Thread: Seeking some guidance from the wise.

1. ## Seeking some guidance from the wise.

I’ve written a basic maths program and am thinking about adding some algebra functions to it like if user enters

(A +2B)(4A + 6C)

It would output

4A^2 + 6AC + 8AB + 12BC

I can’t quite decide how to write it. Would you work with it like a string or turn each term into some sort of token and work with them. Does anyone know what category this falls into mathematically or in computer science. The rules, which help to do things by hand, aren’t always much use when you attempt to implement it in a program.

Been hunting for things like this but I’m not sure of its proper title so its hard to find.

2. ill just give you some idea, it will most likely be wrong or really messy but its just an idea to get you thinking i guess.

what you could is think of (A +2B)(4A + 6C) as 2 matrices and you can multiply the values in the matrices. im pretty sure doing this is hard but just an idea.

or just think of it as 2 arrays where you multiply their values and you get another 3rd array as the result.