Thank you very much. That's exactly what i want. I really appreciate this
forum. You are really very efficient and helpful. Thanks again.
Le lundi 8 juin 2015 23:11:46 UTC+2, Ralf Hemmecke a écrit :
>
> > Is it possible to simplify the matrix M in one shot? Idest all the
> elements
> > of the matrix M in one shot?
>
> As I said, use map for this.
>
> (1) -> m := matrix([[a*log(sin x)-2*log(x), log(x)+log(y)],
> [log(x)-log(y), 3*log(x)-4*log(x+3)+log(y)]])
>
> +a log(sin(x)) - 2log(x) log(y) + log(x) +
> (1) | |
> + - log(y) + log(x) log(y) - 4log(x + 3) + 3log(x)+
> Type:
> Matrix(Expression(Integer))
> (2) -> logrules:=rule(log(x)+log(y)==log(x*y);
> log(x)-log(y)==log(x/y);y*log(x)==log(x^y))
>
> (2)
> {log(y) + log(x) + %B == log(x y) + %B,
> x y
> - log(y) + log(x) + %C == log(-) + %C, y log(x) == log(x )}
> y
> Type:
> Ruleset(Integer,Integer,Expression(Integer))
> (3) -> map(c +-> logrules c, m)
>
> + a +
> | sin(x) |
> |log(-------) log(x y) |
> | 2 |
> | x |
> (3) | |
> | 3 |
> | x x y |
> | log(-) log(----------------------------)|
> | y 4 3 2 |
> + x + 12x + 54x + 108x + 81 +
> Type:
> Matrix(Expression(Integer))
>
> Note that you defined logrules to work on "Expression(Integer)" (I
> abbreviate by E), however "Matrix(E)" is not the same type as E. But the
> entries of the matrix are of type E, so "map" does the job of applying
> logrules to each entry.
>
> The form "c +-> logrules c" is a lambda expression that locally defines
> a function that takes an entry c of the matrix and applies logrules to it.
>
> Hope that helps.
>
> Ralf
>
>
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.