conversion of sin to cos



  • 1. Convert funcion
    Hello Group, Someone could help me with this function? fConver[cmatrix], this function will find all subsets of rows of the rectangular matrix which have exactly one nonzero element in each column. For example: cmatrix=({{0,0,1,0,1,1,0},{1,0,0,1,0,0,1},{0,1,1,0,0,1,0}, {1,0,0,1,0,0,0},{0,1,0,0,0,0,1},{0,0,0,1,1,0,1}}); fConvert[cmatrix] the out put will be {{{1,4},{3,5,6},{2,7}}} Thank you All, Johum,
  • 2. crosshatch shading
    I am preparing a graph for publication. I have been able to shade various areas in the graph different colors using the Filling option. However, for publication the paper will be in black and white. I would like to change the shaded areas to be filled in with crosshatches, parallel lines, etc. What are the options and commands to do this? I have looked online, but have not found an answer. Thanks in advance.
  • 3. plot a function
    If i want to draw a function y=sinx*e^x in x =0.5 to 1.5 [only in this interval ] How I can do that with mathematica?
  • 4. Inverse of symbolic matrix
    The expressions a and b below seem reasonable. However when I assemble them into a matrix and take the inverse I get the message Inverse::"sing" singular. However the determinant seems fine. If I rationalize the matrix and then take its inverse then everything seems fine and I can almost get the unit matrix by multiplying back onto the original matrix. Is there a problem with approximate numbers in symbolic matrices? Is this a bug? Is Rationalize the best method for working around this problem? Thanks Hugh Goyder a = -((4.739*^-6 - 0.0008*I)/((0.0122 + 1.544*I) + s)) - (4.7395*^-6 + 0.00088*I)/ ((0.0122 - 1.544*I) + s); b = -((0.000015 - 0.00022*I)/((0.0122 + 1.544*I) + s)) - (0.000015 + 0.000226*I)/ ((0.0122 - 1.544*I) + s); mat = {{a, 0}, {0, b}}; Inverse[mat] Det[mat] matr = Rationalize[mat, 0]; inv = Inverse[matr] Rationalize[Factor[Together[mat . inv]], 1.*^-8]

conversion of sin to cos

Postby glenn077 » Mon, 31 Mar 2008 15:19:48 GMT

Hello all,

Here is my problem. I have a very long product of cosines with
arguments of the form k*Pi, k being integers.
I want to convert this expression to a sum of cosines. TrigReduce
works fine, except that it converts cos to sin.
So, I want all the sin (after the TrigReduce) to be converted to cos
and the arguments be of the form p*Pi, p being rational of course.
It has something to do with Hold or HoldAll, but I don't know the
details. Or perhaps the TrigReduce can be overridden
Can someone help?
Thank's for your time.

Re: conversion of sin to cos

Postby Narasimham » Tue, 01 Apr 2008 16:06:06 GMT

Cos[J Pi] is + or - depending on whether J is respy even/odd . If
there are m odd Pis and n even Pis, then J = m  alone decides the
sign, - for odd m and + for even m. HTH

Re: conversion of sin to cos

Postby David Bailey » Tue, 01 Apr 2008 16:06:51 GMT

It might be helpful to give a small actual example of what you want to 
achieve. As you have described it, I would have thought the answer would 
reduce to +1 or -1.

David Bailey

Re: conversion of sin to cos

Postby Jean-Marc Gulliet » Tue, 01 Apr 2008 16:08:44 GMT

Hi Glenn,

Please, could you post an actual (short) example of such a product as 
well as what you get having trigreduced it?

Meanwhile, Simplify/FullSimplify with the option ComplexityFunction 
might be what you are looking for.


Re: conversion of sin to cos

Postby Szabolcs Horv » Tue, 01 Apr 2008 16:09:28 GMT

Cos[k*Pi] == (-1)^k, so your expression is probably a bit more 
complicated than that :-)

Have you tried

expression /. Sin[a_] :> Cos[a - Pi/2]


expression /. Sin[a_] :> Cos[Collect[a - Pi/2, Pi]]


expression /. Sin[a_] :> Cos[Collect[a - Pi/2, Pi, Together]]

?  It would be easier to answer if you posted a short sample of a 
Sin-expression that you need converted to a Cos-expression.

Hold[] just prevents evaluation of its arguments.  HoldAll is not a 
function, but an attribute.  It is the attribute that gives Hold[] its 

Re: conversion of sin to cos

Postby Peter Pein » Tue, 01 Apr 2008 16:09:50 GMT

Hi Glenn,

you don't need a CAS for this. I'll just use Mathematica syntax here:

 For integer k: Cos[k*Pi]==(-1)^k.

If your product is Product[Cos[k[i]*Pi],{i,1,n}], then it can be written as
(-1)^Mod[Sum[k[i],{i,1,n}],2] or if you insist on cosines:


Re: conversion of sin to cos

Postby dh » Wed, 02 Apr 2008 17:19:51 GMT


you may simply replace all Sin[x] -> Cos[x-Pi/2]

hope this helps, Daniel

Return to Mathematica


Who is online

Users browsing this forum: No registered users and 89 guest