[Scilab-users] Summation query in Scilab

Lester Anderson arctica1963 at gmail.com
Thu Dec 13 19:42:51 CET 2012


I spotted the Kelvin conversion problem too :)

Cheers

Lester

On 13 December 2012 09:38, Serge Steer <Serge.Steer at inria.fr> wrote:

>  Le 13/12/2012 07:56, Lester Anderson a écrit :
>
> Hi Serge
>
> A quick question. In the context of the equation, what is the purpose of
> the ones(t) part? The help states that this creates a matrix composed of
> ones.
>
>
> (B./(m1.^3*%pi).*sin(m1*%pi/B)) is a column vector, the multiplication by ones(t) which is a row vector  is a way to create a matrix with identical columns
> . Ina similar manner m1.^2*t
>  creates a matrix multiplying the column vector m1.^2 by the row vector t
>
>  g=c*sum((B./(m1.^3*%pi).*sin(m1*%pi/B))*ones(t).*exp(-(m1.^2*t/tau)),1);
>
> Probabaly a very simple answer.
>
> Cheers
>
> Lester
>
> On 12 December 2012 22:46, Lester Anderson <arctica1963 at gmail.com> wrote:
>
>> Many thanks Serge :) That worked great!
>> Helps to see how the syntax should work.
>>
>> Cheers
>>
>> Lester
>>
>>
>> On 12 December 2012 22:29, Serge Steer <serge.steer at inria.fr> wrote:
>>
>>>  I think the following code fullfil your wish...
>>>
>>>
>>> n = 0:1:20 ;// series in the expansionB = 1.5; //beta factorTm = 1300*274.15; //base-lithosphere temperature [C]tau = 62.8; //lithosphere cooling thermal decay constant [Ma]a = 125000; //equilibrium lithospheric thickness [m]alpha = 3.28e-5 ;//thermal expansion coefficient K^-1// Tm needs to be converted to Kelvin - multiply by 274.15rho = 3300;t = 0:5:150; //lithosphere age [Ma]G = 6.67e-11;
>>> // LTGA with increasing age of oceanic lithosphere
>>> c=8*G*alpha*rho*a*Tm/%pi;m=(0:20)';m1=2*m+1;g=c*sum((B./(m1.^3*%pi).*sin(m1*%pi/B))*ones(t).*exp(-(m1.^2*t/tau)),1);clf;plot(t,g)
>>>
>>>
>>> Serge Steer
>>> ------------------------------
>>>
>>> *De: *"Lester Anderson" <arctica1963 at gmail.com>
>>> *À: *"International users mailing list for Scilab." <
>>> users at lists.scilab.org>
>>> *Envoyé: *Mardi 11 Décembre 2012 08:16:01
>>> *Objet: *[Scilab-users] Summation query in Scilab
>>>
>>>
>>> Hello,
>>>
>>> I have an equation structured like in the attached, however I am unsure
>>> of the correct syntax to compute in Scilab.
>>>
>>> One can calculate the first term of the expansion but obvioulsy it needs
>>> to go to a large number (approximating infinity eg 20).
>>> I am sure this is something very straightforward!
>>>
>>> Any ideas welcome.
>>>
>>> Thanks for the help
>>>
>>> Lester
>>>
>>> att: image of equation, test code
>>>
>>>  _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>>
>>>
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>>
>>>
>>
>
>
> _______________________________________________
> users mailing listusers at lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20121213/ffeab4ef/attachment.htm>


More information about the users mailing list