# Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating - Hewlett Packard

This is a discussion on Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating - Hewlett Packard ; Hi, i made a small UserRPL script which asks for Variables with an INFORM and calculates a value, which is done with ->NUM. 'a*b*c*d' ->NUM Now my problem is that i want to return the formula with Variables (i read ...

# Thread: Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating

1. ## Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating

Hi,
i made a small UserRPL script which asks for Variables with an INFORM
and calculates a value, which is done with ->NUM.

'a*b*c*d' ->NUM

Now my problem is that i want to return the formula with Variables (i
a=1 b=2 c=3 d=4 then i want to get returned:
'1*2*3*4'
and not
24.

I hope i put this problem across.

Thanks for help,
Max

2. ## Re: Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating

'A*B*C*D'
'A=1'
SUBST

gives

'1*B*C*D'

I hope this helps

Arnaud

3. ## Re: Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating

On Jun 26, 8:34 pm, Arnaud Amiel wrote:
> 'A*B*C*D'
> 'A=1'
> SUBST
>
> gives
>
> '1*B*C*D'
>
> I hope this helps
>
> Arnaud

not realy, i need it in a way where the UserRPL script can do it
automatic, SUBST works good by hand, but how automatic?
Thanks
Max

4. ## Re: Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating

> not realy, i need it in a way where the UserRPL script can do it
> automatic, SUBST works good by hand, but how automatic?
> Thanks
> Max

Um, if you can use the command it can be put into userRPL.

<< 'A=1' SUBST 'B=2' SUBST 'C=3' SUBST 'D=4' SUBST >>

However, perhaps you should use the | operator. 'A*B*C*D' { A 1 B 2
C 3 D 4 } | --> '1*2*3*4'
Build your list and then it is a single operation.

TW

5. ## Re: Hp 50g UserRPL: Substitute Variable in a formula with Number and Return without evaluating

On Jun 26, 10:17 pm, TW wrote:
> > not realy, i need it in a way where the UserRPL script can do it
> > automatic, SUBST works good by hand, but how automatic?
> > Thanks
> > Max

>
> Um, if you can use the command it can be put into userRPL.
>
> << 'A=1' SUBST 'B=2' SUBST 'C=3' SUBST 'D=4' SUBST >>
>
> However, perhaps you should use the | operator. 'A*B*C*D' { A 1 B 2
> C 3 D 4 } | --> '1*2*3*4'
> Build your list and then it is a single operation.
>
> TW

Hi, thx,
but the Chars i want to substitute have the same name as the Variables
i got of INFORM,
so if i try " | " it ends up like:
'A*B*C*D' { A A B B C C D D } |
and that doesnt work as " | " does the same as EVAL which ends up in
calculating the value, at least here .

Max