create a vector with a variable as an element

Hi

I want to create a vector called "gss" with m but got the following:

m=-ln(0.5/0.24212945-1);
gss={m,1};

m
-0.062985214

gss[1,1]
+DEN

Why is that gss[1,1] is not equal to m? Plus why can't I just do gss={m}?

Thanks for your help!

Laura

1 Answer

0

The reason that gss[1,1] is not equal to the value of m (-0.06298) is because GAUSS allows you to add character elements to matrices and vectors. So what you actually added to gss was the character element m. You can see this by printing it as a character element by prepending with the $ like this:

m=-ln(0.5/0.24212945-1);
gss={m,1};

print $gss[1,1];

results in:

   m

Depending upon what else is going on in the program you could do something like this:

//the pipe operator '|' performs vertical concatenation
gss = -ln(0.5/0.24212945-1)|1;

//or this
gss = ones(2,1);
gss[1,1] = -ln(0.5/0.24212945-1);

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

FREE REQUEST A QUOTE NOW

Thank you for your interest in the GAUSS family of products.

© Aptech Systems, Inc. All rights reserved.

Privacy Policy | Sitemap