From: Jay WONG on
Dear professionals,

I came across this problem. My model has to handle a large number of iterations.

I believe the following slows down my efficiency. Essentially, how do I convert the coefficients in large numbers to double/short format while still displaying them in symbolic expressions.

Would vpa(sym) work?

thank you,


84238493240293/239230209432* PD^19
+ 8098405089459834/21743259478543* PD^40
– 5126372434/98073473284329* PD^25
+84238493240293/239230209432* PD^10
+ 8098405089459834/21743259478543* PD^30
– 5126372434/98073473284329* PD^5

======>
352.123* PD^19
+ 21.23* PD^40
– 12.6 * PD^25
+ 42.38* PD^10
+ 0.94 * PD^30
– 1.26 * PD^5
From: Walter Roberson on
Jay WONG wrote:
> Dear professionals,
>
> I came across this problem. My model has to handle a large number of
> iterations.
>
> I believe the following slows down my efficiency. Essentially, how do I
> convert the coefficients in large numbers to double/short format while
> still displaying them in symbolic expressions.
>
> Would vpa(sym) work?
>
> thank you,
>
>
> 84238493240293/239230209432* PD^19 + 8098405089459834/21743259478543*
> PD^40 – 5126372434/98073473284329* PD^25
> +84238493240293/239230209432* PD^10
> + 8098405089459834/21743259478543* PD^30 –
> 5126372434/98073473284329* PD^5
>
> ======>
> 352.123* PD^19 + 21.23* PD^40 – 12.6 * PD^25 + 42.38* PD^10
> + 0.94 * PD^30 – 1.26 * PD^5


Yes, you could do that, or for equivalent effect, multiply the expression
by 1.0 as any arithmetic combination of decimal values and fractions is
simplified to a decimal number.

Just to be sure we are talking about the same thing: if you do the above, or
use vpa(), then once done, the expression will *not* display as fractions
afterwards, so if you want to see the fractions, you will still need to hold
on to the original expression. Also note that there are circumstances under
which doing this kind of conversion can result in significantly different
results using completely different internal routines than if the conversion
was not done. For example, when you ask to solve() or integrate expressions
that involve decimal values, the solution or integration may be done
numerically rather than by converting the decimal values as indicating an
implicit fraction with a power of 10 as the denominator (before fraction
reduction, that is.)